]> git.ardis.lu - csvio/commitdiff
Remove `scripts` and `devDependencies` from packed `package.json`
authorArdis Lu <ardisglu@gmail.com>
Sun, 15 Jun 2025 08:54:34 +0000 (01:54 -0700)
committerArdis Lu <ardisglu@gmail.com>
Sun, 15 Jun 2025 08:54:34 +0000 (01:54 -0700)
These keys are used for development purposes only, so it is wasting bandwidth to ship them with the final package.

npm/postpack.js [new file with mode: 0644]
npm/prepack.js
package.json

diff --git a/npm/postpack.js b/npm/postpack.js
new file mode 100644 (file)
index 0000000..2eeffb6
--- /dev/null
@@ -0,0 +1,4 @@
+import { copyFile, unlink } from 'node:fs/promises';
+
+await copyFile('./package.backup.json', './package.json');
+await unlink('./package.backup.json');
index 624283753eed2be6c9cfde4bc30760903a16eae1..054d18a48239d0dd5a8293a67f5b8fec11fb0c82 100644 (file)
@@ -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');
index 050048306817911202edb68ff541251ced2c08a4..e6be717743364295dd1e2cdd7f256944842be486 100644 (file)
@@ -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",
This page took 0.036903 seconds and 4 git commands to generate.