aboutsummaryrefslogtreecommitdiff
path: root/npmPackages/_scripts
diff options
context:
space:
mode:
Diffstat (limited to 'npmPackages/_scripts')
-rw-r--r--npmPackages/_scripts/strip.js48
1 files changed, 33 insertions, 15 deletions
diff --git a/npmPackages/_scripts/strip.js b/npmPackages/_scripts/strip.js
index e76bf6d..526730d 100644
--- a/npmPackages/_scripts/strip.js
+++ b/npmPackages/_scripts/strip.js
@@ -5,14 +5,20 @@ const {
} = require('./package.js');
-var stripDependencies = false;
+var phase;
const args = process.argv.slice(2);
for (var i = 0; i < args.length; i++) {
switch (args[i]) {
- case '--strip-dependencies':
- stripDependencies = true;
+ case '--post-configure':
+ phase = 'postConfigure';
+ break;
+ case '--pre-install':
+ phase = 'preInstall';
+ break;
+ case '--post-install':
+ phase = 'postInstall';
break;
default:
;
@@ -20,18 +26,30 @@ for (var i = 0; i < args.length; i++) {
}
pipeThrough((pkg, done) => {
- delete pkg.devDependencies;
- delete pkg.engines;
- delete pkg.keywords;
- delete pkg.optionalDependencies;
- delete pkg.peerDependencies;
- delete pkg.scripts;
- delete pkg.tap;
- delete pkg.xo;
-
- if (stripDependencies) {
- delete pkg.dependencies;
+ switch (phase) {
+ case 'postInstall':
+ delete pkg.dependencies;
+ // fall throw
+
+ case 'preInstall':
+ delete pkg.engines;
+ delete pkg.keywords;
+ delete pkg.scripts;
+ delete pkg.tap;
+ delete pkg.xo;
+ // fall throw
+
+ case 'postConfigure':
+ delete pkg.devDependencies;
+ delete pkg.optionalDependencies;
+ delete pkg.peerDependencies;
+ if (pkg.scripts) {
+ delete pkg.scripts.prepublish;
+ }
+ break;
+ default:
+ throw (`Unknown phase: "${phase}"`);
}
done(pkg);
-});
+}); \ No newline at end of file