From b229d4ede84e34820d236ccf22af9e24dd518c19 Mon Sep 17 00:00:00 2001 From: Hanssen Date: Thu, 1 Aug 2024 10:52:35 +0800 Subject: [PATCH] fix: commonjs support (#639) --- packages/ckb-sdk-core/misc/basedirs/lib-esm/package.json | 3 +++ packages/ckb-sdk-core/misc/basedirs/lib/package.json | 3 +++ packages/ckb-sdk-core/package.json | 4 ++-- packages/ckb-sdk-rpc/misc/basedirs/lib-esm/package.json | 3 +++ packages/ckb-sdk-rpc/misc/basedirs/lib/package.json | 3 +++ packages/ckb-sdk-rpc/package.json | 4 ++-- packages/ckb-sdk-utils/misc/basedirs/lib-esm/package.json | 3 +++ packages/ckb-sdk-utils/misc/basedirs/lib/package.json | 3 +++ packages/ckb-sdk-utils/package.json | 3 +-- 9 files changed, 23 insertions(+), 6 deletions(-) create mode 100644 packages/ckb-sdk-core/misc/basedirs/lib-esm/package.json create mode 100644 packages/ckb-sdk-core/misc/basedirs/lib/package.json create mode 100644 packages/ckb-sdk-rpc/misc/basedirs/lib-esm/package.json create mode 100644 packages/ckb-sdk-rpc/misc/basedirs/lib/package.json create mode 100644 packages/ckb-sdk-utils/misc/basedirs/lib-esm/package.json create mode 100644 packages/ckb-sdk-utils/misc/basedirs/lib/package.json diff --git a/packages/ckb-sdk-core/misc/basedirs/lib-esm/package.json b/packages/ckb-sdk-core/misc/basedirs/lib-esm/package.json new file mode 100644 index 00000000..3dbc1ca5 --- /dev/null +++ b/packages/ckb-sdk-core/misc/basedirs/lib-esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/packages/ckb-sdk-core/misc/basedirs/lib/package.json b/packages/ckb-sdk-core/misc/basedirs/lib/package.json new file mode 100644 index 00000000..5bbefffb --- /dev/null +++ b/packages/ckb-sdk-core/misc/basedirs/lib/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/packages/ckb-sdk-core/package.json b/packages/ckb-sdk-core/package.json index 27ec3cb9..dff3cf06 100644 --- a/packages/ckb-sdk-core/package.json +++ b/packages/ckb-sdk-core/package.json @@ -6,8 +6,8 @@ "homepage": "https://github.com/ckb-js/ckb-sdk-js#readme", "license": "MIT", "main": "lib/index.js", + "module": "lib-esm/index.js", "typings": "lib/index.d.ts", - "type": "module", "directories": { "lib": "lib", "lib-esm": "lib-esm", @@ -41,7 +41,7 @@ "url": "git+https://github.com/ckb-js/ckb-sdk-js.git" }, "scripts": { - "tsc": "tsc --project tsconfig.json && tsc --project tsconfig.esm.json", + "tsc": "tsc --project tsconfig.json && tsc --project tsconfig.esm.json && npx copyfiles -u 2 misc/basedirs/**/* .", "test": "../../node_modules/.bin/jest" }, "bugs": { diff --git a/packages/ckb-sdk-rpc/misc/basedirs/lib-esm/package.json b/packages/ckb-sdk-rpc/misc/basedirs/lib-esm/package.json new file mode 100644 index 00000000..3dbc1ca5 --- /dev/null +++ b/packages/ckb-sdk-rpc/misc/basedirs/lib-esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/packages/ckb-sdk-rpc/misc/basedirs/lib/package.json b/packages/ckb-sdk-rpc/misc/basedirs/lib/package.json new file mode 100644 index 00000000..5bbefffb --- /dev/null +++ b/packages/ckb-sdk-rpc/misc/basedirs/lib/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/packages/ckb-sdk-rpc/package.json b/packages/ckb-sdk-rpc/package.json index c193ff65..e95799f7 100644 --- a/packages/ckb-sdk-rpc/package.json +++ b/packages/ckb-sdk-rpc/package.json @@ -6,8 +6,8 @@ "homepage": "https://github.com/ckb-js/ckb-sdk-js/packages/ckb-rpc#readme", "license": "MIT", "main": "lib/index.js", + "module": "lib-esm/index.js", "typings": "lib/index.d.ts", - "type": "module", "directories": { "lib": "lib", "lib-esm": "lib-esm", @@ -34,7 +34,7 @@ "url": "git+https://github.com/ckb-js/ckb-sdk-js.git" }, "scripts": { - "tsc": "tsc --project tsconfig.json && tsc --project tsconfig.esm.json", + "tsc": "tsc --project tsconfig.json && tsc --project tsconfig.esm.json && npx copyfiles -u 2 misc/basedirs/**/* .", "test": "../../node_modules/.bin/jest", "doc": "../../node_modules/.bin/typedoc --out docs --mode modules --includeDeclarations --excludeExternals --ignoreCompilerErrors --theme default", "test:watch": "../../node_modules/.bin/jest --watch" diff --git a/packages/ckb-sdk-utils/misc/basedirs/lib-esm/package.json b/packages/ckb-sdk-utils/misc/basedirs/lib-esm/package.json new file mode 100644 index 00000000..3dbc1ca5 --- /dev/null +++ b/packages/ckb-sdk-utils/misc/basedirs/lib-esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/packages/ckb-sdk-utils/misc/basedirs/lib/package.json b/packages/ckb-sdk-utils/misc/basedirs/lib/package.json new file mode 100644 index 00000000..5bbefffb --- /dev/null +++ b/packages/ckb-sdk-utils/misc/basedirs/lib/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/packages/ckb-sdk-utils/package.json b/packages/ckb-sdk-utils/package.json index 6e277848..b03000d0 100644 --- a/packages/ckb-sdk-utils/package.json +++ b/packages/ckb-sdk-utils/package.json @@ -8,7 +8,6 @@ "main": "lib/index.js", "module": "lib-esm/index.js", "types": "lib/index.d.ts", - "type": "module", "directories": { "lib": "lib", "lib-esm": "lib-esm", @@ -35,7 +34,7 @@ "url": "git+https://github.com/ckb-js/ckb-sdk-js.git" }, "scripts": { - "tsc": "tsc --project tsconfig.json && tsc --project tsconfig.esm.json", + "tsc": "tsc --project tsconfig.json && tsc --project tsconfig.esm.json && npx copyfiles -u 2 misc/basedirs/**/* .", "test": "../../node_modules/.bin/jest" }, "bugs": {