diff options
Diffstat (limited to 'npmPackages/_scripts/drop-dev-deps.js')
-rw-r--r-- | npmPackages/_scripts/drop-dev-deps.js | 25 |
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); +}); |