blob: 653df97bad02fd87106d4b58420f0ee98a37e72a (
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
const process = require('process');
const {
pipeThrough
} = require('./package.js');
var phase;
const args = process.argv.slice(2);
for (var i = 0; i < args.length; i++) {
switch (args[i]) {
case '--post-configure':
phase = 'postConfigure';
break;
case '--pre-install':
phase = 'preInstall';
break;
case '--post-install':
phase = 'postInstall';
break;
default:
;
}
}
pipeThrough((pkg, done) => {
switch (phase) {
case 'postInstall':
// fall through
case 'preInstall':
delete pkg.engines;
delete pkg.keywords;
delete pkg.scripts;
delete pkg.tap;
delete pkg.xo;
// fall through
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);
});
|