diff --git a/.github/workflows/pr-deno.yml b/.github/workflows/pr-deno.yml index 903688a7..9535978c 100644 --- a/.github/workflows/pr-deno.yml +++ b/.github/workflows/pr-deno.yml @@ -23,5 +23,5 @@ jobs: if [ "${{ matrix.step }}" != "check" ]; then ./scripts/install-build-deps.sh fi - yarn deno:setup + yarn polkadot-dev-deno-map yarn deno:${{ matrix.step }} diff --git a/.gitignore b/.gitignore index 4a8e4d27..fbced530 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,8 @@ pkg/ target/ tmp/ wabt/ +/import_map.json +/mod.ts .DS_Store .env.local .env.development.local diff --git a/deno/check.ts b/deno/check.ts deleted file mode 100644 index b8d33259..00000000 --- a/deno/check.ts +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2019-2022 @polkadot/wasm authors & contributors -// SPDX-License-Identifier: Apache-2.0 - -// auto-generated via deno/setup.ts, do not edit - -export * as wasmBridge from 'https://deno.land/x/polkadot/wasm-bridge/mod.ts'; -export * as wasmCrypto from 'https://deno.land/x/polkadot/wasm-crypto/mod.ts'; -export * as wasmCryptoAsmjs from 'https://deno.land/x/polkadot/wasm-crypto-asmjs/mod.ts'; -export * as wasmCryptoInit from 'https://deno.land/x/polkadot/wasm-crypto-init/mod.ts'; -export * as wasmCryptoWasm from 'https://deno.land/x/polkadot/wasm-crypto-wasm/mod.ts'; -export * as wasmUtil from 'https://deno.land/x/polkadot/wasm-util/mod.ts'; diff --git a/deno/import_map.json b/deno/import_map.json deleted file mode 100644 index af946461..00000000 --- a/deno/import_map.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "imports": { - "crypto": "https://deno.land/std/node/crypto.ts", - "@polkadot/util": "https://deno.land/x/polkadot/common/mod.ts", - "https://deno.land/x/polkadot/wasm-crypto-init/": "../packages/wasm-crypto-init/build-deno/", - "https://deno.land/x/polkadot/wasm-bridge/": "../packages/wasm-bridge/build-deno/", - "https://deno.land/x/polkadot/wasm-crypto-wasm/": "../packages/wasm-crypto-wasm/build-deno/", - "https://deno.land/x/polkadot/wasm-crypto/": "../packages/wasm-crypto/build-deno/", - "https://deno.land/x/polkadot/wasm-crypto-asmjs/": "../packages/wasm-crypto-asmjs/build-deno/", - "https://deno.land/x/polkadot/wasm-util/": "../packages/wasm-util/build-deno/" - } -} diff --git a/deno/setup.ts b/deno/setup.ts deleted file mode 100644 index 0063133d..00000000 --- a/deno/setup.ts +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2019-2022 @polkadot/wasm authors & contributors -// SPDX-License-Identifier: Apache-2.0 - -/* eslint-disable sort-keys */ - -import { stringCamelCase } from 'https://deno.land/x/polkadot/util/mod.ts'; - -const exports: string[] = []; -const imports: Record = { - '@polkadot/util': 'https://deno.land/x/polkadot/common/mod.ts', - crypto: 'https://deno.land/std/node/crypto.ts' -}; - -for await (const entry of Deno.readDir('packages')) { - if (entry.isDirectory) { - try { - await Deno.readTextFile(`packages/${entry.name}/src/mod.ts`); - - exports.push(`export * as ${stringCamelCase(entry.name)} from 'https://deno.land/x/polkadot/${entry.name}/mod.ts';`); - - imports[`https://deno.land/x/polkadot/${entry.name}/`] = `../packages/${entry.name}/build-deno/`; - } catch { - // ignore - } - } -} - -await Deno.writeTextFile('deno/check.ts', `// Copyright 2019-${new Date().getFullYear()} @polkadot/wasm authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\n// auto-generated via deno/setup.ts, do not edit\n\n${exports.sort().join('\n')}\n`); - -await Deno.writeTextFile('deno/import_map.json', `${JSON.stringify({ imports }, null, 2)}\n`); diff --git a/import_map.in.json b/import_map.in.json new file mode 100644 index 00000000..ad8752de --- /dev/null +++ b/import_map.in.json @@ -0,0 +1,6 @@ +{ + "imports": { + "crypto": "https://deno.land/std/node/crypto.ts", + "@polkadot/util": "https://deno.land/x/polkadot/common/mod.ts" + } +} diff --git a/package.json b/package.json index d45ea01f..badf9644 100644 --- a/package.json +++ b/package.json @@ -23,12 +23,11 @@ "build:wasm": "./scripts/build.sh", "clean": "./scripts/clean.sh", "deno:build": "yarn build", - "deno:check": "yarn build:js && deno check --import-map=deno/import_map.json deno/check.ts", - "deno:setup": "deno run --import-map=deno/import_map.json --allow-read --allow-write deno/setup.ts", + "deno:check": "yarn build:js && deno check --import-map=import_map.json mod.ts", "lint": "polkadot-dev-run-lint", "postinstall": "polkadot-dev-yarn-only", "test": "yarn test:wasm-crypto:rust", - "test:wasm-crypto:deno": "deno test --allow-read --import-map=deno/import_map.json packages/wasm-crypto/test/deno.ts", + "test:wasm-crypto:deno": "deno test --allow-read --import-map=import_map.json packages/wasm-crypto/test/deno.ts", "test:wasm-crypto:js": "yarn test:wasm-crypto:js:jest && yarn test:wasm-crypto:js:node", "test:wasm-crypto:js:jest": "polkadot-dev-run-test ./test/jest.spec.js", "test:wasm-crypto:js:node": "cd packages/wasm-crypto && node ./test/wasm.cjs && node ./test/asm.cjs", @@ -36,7 +35,7 @@ }, "devDependencies": { "@babel/core": "^7.18.6", - "@polkadot/dev": "^0.67.57", + "@polkadot/dev": "^0.67.63", "fflate": "^0.7.3", "override-require": "^1.1.1" }, diff --git a/yarn.lock b/yarn.lock index 1f5e9c09..fdef3e86 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1941,9 +1941,9 @@ __metadata: languageName: node linkType: hard -"@polkadot/dev@npm:^0.67.57": - version: 0.67.57 - resolution: "@polkadot/dev@npm:0.67.57" +"@polkadot/dev@npm:^0.67.63": + version: 0.67.63 + resolution: "@polkadot/dev@npm:0.67.63" dependencies: "@babel/cli": ^7.18.6 "@babel/core": ^7.18.6 @@ -2019,6 +2019,7 @@ __metadata: polkadot-dev-clean-build: scripts/polkadot-dev-clean-build.mjs polkadot-dev-contrib: scripts/polkadot-dev-contrib.mjs polkadot-dev-copy-to: scripts/polkadot-dev-copy-to.mjs + polkadot-dev-deno-map: scripts/polkadot-dev-deno-map.mjs polkadot-dev-run-lint: scripts/polkadot-dev-run-lint.mjs polkadot-dev-run-prettier: scripts/polkadot-dev-run-prettier.mjs polkadot-dev-run-test: scripts/polkadot-dev-run-test.mjs @@ -2031,7 +2032,7 @@ __metadata: polkadot-exec-rollup: scripts/polkadot-exec-rollup.mjs polkadot-exec-tsc: scripts/polkadot-exec-tsc.mjs polkadot-exec-webpack: scripts/polkadot-exec-webpack.mjs - checksum: 65e2b4c6a50b174332fe88fac580f4a6e5123e58aea59ff3888ac47f18d83c7d0881bd533b761b5643c477f09f41bd7f3652d8a61b6105265fd9a4e04c44c88e + checksum: dcd126122c2bc793930e9974dfd0fae035e1a8b97bd6df4a3cfc82bee5ec76a328570401b0b81dd1d2db7459c08a50b8169b1814934fca677d8b25b699097cc4 languageName: node linkType: hard @@ -8595,7 +8596,7 @@ resolve@^2.0.0-next.3: resolution: "root-workspace-0b6124@workspace:." dependencies: "@babel/core": ^7.18.6 - "@polkadot/dev": ^0.67.57 + "@polkadot/dev": ^0.67.63 fflate: ^0.7.3 override-require: ^1.1.1 languageName: unknown