-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathindex-install.js
executable file
·64 lines (61 loc) · 1.81 KB
/
index-install.js
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
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env node
const updateNotifier = require('update-notifier');
const c = require('chalk');
const {argv} = require('yargs')
.parserConfiguration({
'short-option-groups': true,
'camel-case-expansion': false,
'dot-notation': false,
'parse-numbers': true,
'boolean-negation': false
})
.usage('Usage: $0 <package-name> [other-package-names...]')
.describe('warn', 'Install despite of negative check but warn about predicate violation')
.alias('warn', 'w')
.boolean('warn') // no force, use npm instead ;)
.describe('interactive', 'Ask for override in case of predicate violation')
.alias('interactive', 'i')
.boolean('interactive')
.describe('max-size', 'Size threeshold of individual library to install')
.alias('max-size', 'm')
.string('max-size')
.describe('max-gzip-size', 'Gzip Size threeshold of individual library to install')
.alias('max-gzip-size', 'M')
.string('max-gzip-size')
.describe('max-overall-size', 'Overall size threeshold of dependencies')
.alias('max-overall-size', 'o')
.string('max-overall-size')
.describe('max-overall-gzip-size', 'Overall Gzip size threeshold of dependencies')
.alias('max-overall-gzip-size', 'O')
.string('max-overall-gzip-size')
// List of npm install flags
.boolean([
's',
'S',
'save',
'P',
'save-prod',
'D',
'save-dev',
'O',
'save-optional',
'E',
'save-exact',
'-B',
'save-bundle',
'no-save',
'dry-run'
])
.help('h')
.alias('h', 'help')
.pkgConf('bundle-phobia');
const pkg = require('./package');
const {main} = require('./src/install');
if (!module.parent) {
/* eslint-disable no-console */
main({argv}).catch(err => {
console.log(c.red.bold('bundle-phobia-install failed: ') + err.message);
process.exit(1);
});
updateNotifier({pkg}).notify();
}