From: Ardis Lu Date: Sun, 15 Jun 2025 08:54:34 +0000 (-0700) Subject: Remove `scripts` and `devDependencies` from packed `package.json` X-Git-Tag: v0.1.2~11 X-Git-Url: https://git.ardis.lu/?a=commitdiff_plain;h=a7027c2d2a654a0deffd1355f7503166c1446001;p=csvio Remove `scripts` and `devDependencies` from packed `package.json` These keys are used for development purposes only, so it is wasting bandwidth to ship them with the final package. --- diff --git a/npm/postpack.js b/npm/postpack.js new file mode 100644 index 0000000..2eeffb6 --- /dev/null +++ b/npm/postpack.js @@ -0,0 +1,4 @@ +import { copyFile, unlink } from 'node:fs/promises'; + +await copyFile('./package.backup.json', './package.json'); +await unlink('./package.backup.json'); diff --git a/npm/prepack.js b/npm/prepack.js index 6242837..054d18a 100644 --- a/npm/prepack.js +++ b/npm/prepack.js @@ -1,3 +1,8 @@ +import { copyFile } from 'node:fs/promises'; import { execSync } from 'node:child_process'; execSync('npm run types'); + +await copyFile('./package.json', './package.backup.json'); +execSync('npm pkg delete scripts'); +execSync('npm pkg delete devDependencies'); diff --git a/package.json b/package.json index 0500483..e6be717 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,8 @@ "test:large": "node --test --test-name-pattern=\"/^large:/\"", "test:coverage": "npm run test -- --experimental-test-coverage", "bench": "node ./benchmark/core.bench.js", - "prepack": "node ./npm/prepack.js" + "prepack": "node ./npm/prepack.js", + "postpack": "node ./npm/postpack.js" }, "devDependencies": { "@types/node": "^24.0.0",