aboutsummaryrefslogtreecommitdiff
path: root/npmPackages/_scripts/strip.js
blob: e76bf6d6e08402a1744969000470046f1902995b (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
26
27
28
29
30
31
32
33
34
35
36
37
const process = require('process');

const {
    pipeThrough
} = require('./package.js');


var stripDependencies = false;

const args = process.argv.slice(2);

for (var i = 0; i < args.length; i++) {
    switch (args[i]) {
        case '--strip-dependencies':
            stripDependencies = true;
            break;
        default:
            ;
    }
}

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;
    }

    done(pkg);
});