aboutsummaryrefslogtreecommitdiff
path: root/npmPackages/_scripts/drop-dev-deps.js
blob: bc8c2f6611246170521000742896b7b0bfa00a4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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);
});