aboutsummaryrefslogtreecommitdiff
path: root/npmPackages/_scripts
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2019-10-13 13:16:17 +0200
committerIgor Pashev <pashev.igor@gmail.com>2019-10-13 13:16:17 +0200
commit4eaea26c3dddba80ef6d783fccc9ca35e6fcf153 (patch)
tree5a65f3df45f24e57a7f0ad6a80b58222598afeda /npmPackages/_scripts
parent72482943b0de51f3fec852476a4329ec86314517 (diff)
downloadnpm.nix-4eaea26c3dddba80ef6d783fccc9ca35e6fcf153.tar.gz
Allow drop some dev. dependencies
Diffstat (limited to 'npmPackages/_scripts')
-rw-r--r--npmPackages/_scripts/drop-dev-deps.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/npmPackages/_scripts/drop-dev-deps.js b/npmPackages/_scripts/drop-dev-deps.js
new file mode 100644
index 0000000..bc8c2f6
--- /dev/null
+++ b/npmPackages/_scripts/drop-dev-deps.js
@@ -0,0 +1,25 @@
+const process = require('process');
+
+const {
+ pipeThrough
+} = require('./package.js');
+
+pipeThrough((pkg, done) => {
+ var notFound = [];
+ pkg.devDependencies = pkg.devDependencies || {};
+
+ process.argv.slice(2).forEach((d) => {
+ if (pkg.devDependencies[d]) {
+ delete pkg.devDependencies[d];
+ } else {
+ notFound.push(d);
+ }
+ });
+
+ if (notFound.length > 0) {
+ console.error(`** ERROR: these dev. dependencies are not declared: ${notFound}`);
+ process.exit(1);
+ }
+
+ done(pkg);
+});