diff --git a/cjs-package.json b/cjs-package.json new file mode 100644 index 0000000..b731bd6 --- /dev/null +++ b/cjs-package.json @@ -0,0 +1 @@ +{"type": "commonjs"} diff --git a/cjs/package.json b/cjs/package.json index 90c11b8..b731bd6 100644 --- a/cjs/package.json +++ b/cjs/package.json @@ -1 +1 @@ -{"type": "commonjs"} +{"type": "commonjs"} diff --git a/esm-package.json b/esm-package.json new file mode 100644 index 0000000..6990891 --- /dev/null +++ b/esm-package.json @@ -0,0 +1 @@ +{"type": "module"} diff --git a/esm/package.json b/esm/package.json index b89a8b3..6990891 100644 --- a/esm/package.json +++ b/esm/package.json @@ -1 +1 @@ -{"type": "module"} +{"type": "module"} diff --git a/package-lock.json b/package-lock.json index a5a0c1c..4bb24d8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,6 +22,7 @@ "eslint": "^9.17.0", "markdownlint-cli2": "^0.17.1", "minimist": "^1.2.8", + "ncp": "^2.0.0", "prettier": "3.4.2", "supports-color": "^10.0.0", "typescript": "^5.7.2", @@ -2146,6 +2147,16 @@ "dev": true, "license": "MIT" }, + "node_modules/ncp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ncp/-/ncp-2.0.0.tgz", + "integrity": "sha512-zIdGUrPRFTUELUvr3Gmc7KZ2Sw/h1PiVM0Af/oHB6zgnV1ikqSfRk+TOufi79aHYCW3NiOXmr1BP5nWbzojLaA==", + "dev": true, + "license": "MIT", + "bin": { + "ncp": "bin/ncp" + } + }, "node_modules/node-gyp-build": { "version": "4.8.4", "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.4.tgz", diff --git a/package.json b/package.json index 7e9b294..8ed4991 100644 --- a/package.json +++ b/package.json @@ -73,7 +73,7 @@ }, "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "build": "tsc --module commonjs --moduleResolution classic --outDir cjs/ && echo {\"type\": \"commonjs\"} > cjs/package.json && tsc --outDir esm/ && echo {\"type\": \"module\"} > esm/package.json", + "build": "tsc --module commonjs --moduleResolution classic --outDir cjs/ && ncp cjs-package.json cjs/package.json && tsc --outDir esm/ && ncp esm-package.json esm/package.json", "example": "tsc && node esm/example.js", "lint": "eslint . && prettier . --check && markdownlint-cli2 **/*.md", "lint:fix": "eslint . --fix && prettier . --write && markdownlint-cli2 --fix **/*.md", @@ -93,6 +93,7 @@ "eslint": "^9.17.0", "markdownlint-cli2": "^0.17.1", "minimist": "^1.2.8", + "ncp": "^2.0.0", "prettier": "3.4.2", "supports-color": "^10.0.0", "typescript": "^5.7.2",