Patch api-augment exports map instead of filesystem shim

Node.js checks package.json exports before filesystem, so the
mkdir+echo shim didn't work. Now patches the exports map with
node -e to add ./substrate pointing to pezkuwi augmentation.
This commit is contained in:
2026-02-14 04:33:32 +03:00
parent 01ec544b84
commit a8b7d16b97
+12 -4
View File
@@ -28,9 +28,17 @@ RUN npm init -y && \
@polkadot/wasm-crypto-init@npm:@pezkuwi/wasm-crypto-init@^7.5.17
# @subql/node requires '@polkadot/api-augment/substrate' but @pezkuwi uses
# chain-specific paths (./pezkuwi, ./bizinikiwi). Create a substrate shim
# that re-exports the pezkuwi augmentation.
RUN mkdir -p /app/node_modules/@polkadot/api-augment/substrate && \
echo "require('../cjs/pezkuwi/index.js');" > /app/node_modules/@polkadot/api-augment/substrate/index.js
# chain-specific paths (./pezkuwi, ./bizinikiwi). Patch the exports map in
# package.json to add ./substrate pointing to pezkuwi augmentation.
RUN node -e " \
const fs = require('fs'); \
const p = '/app/node_modules/@polkadot/api-augment/package.json'; \
const pkg = JSON.parse(fs.readFileSync(p, 'utf8')); \
pkg.exports['./substrate'] = { \
require: './cjs/pezkuwi/index.js', \
default: './pezkuwi/index.js' \
}; \
fs.writeFileSync(p, JSON.stringify(pkg, null, 2)); \
"
ENTRYPOINT ["/app/node_modules/.bin/subql-node"]