-
Notifications
You must be signed in to change notification settings - Fork 2
/
cli.js
executable file
·75 lines (69 loc) · 2.25 KB
/
cli.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
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/env node
'use strict';
const meow = require('meow');
const run = require('./lib/run-cli');
const cli = meow(`
Usage
$ check-packages <checklist.json> [options]
Run 'check-packages' without checklist path and it will use the default
path 'packages-whitelist.json' (or 'packages-blacklist.json' when called
with flag --blacklist).
The content of the checklist file must be an array of package names
(e.g. [ 'react', 'react-dom', 'redux', 'react-redux' ]).
Options
--topLevelOnly Checks only direct dependencies listed in the
top level package.json (equivalent to depth=0).
Note: You cannot use --topLevelOnly together
with --depth.
--depth Max depth of the dependency tree analysis.
Default: Infinity
Note: You cannot use --depth together
with --topLevelOnly.
--blacklist -black Interpret content of checklist as blacklist.
--development -dev Analyze the dependency tree for devDependencies.
--production -prod Analyze the dependency tree for dependencies.
--verbose Lists unallowed dependencies.
--exitCode Exit code in case of unallowed dependencies. Default: 1
--version -v Displays the version number.
--help -h Displays the help.
Examples
$ package "check-packages"
$ package "check-packages --blacklist"
$ package "check-packages my-whitelist.json --dev --depth=10"
$ package "check-packages my-whitelist.json --dev --topLevelOnly --verbose"
$ package "check-packages my-blacklist.json --prod --blacklist
`, {
alias: {
dev: 'development',
prod: 'production',
h: 'help', // eslint-disable-line
v: 'version' // eslint-disable-line
},
flags: {
blacklist: {
type: 'boolean',
alias: 'black'
},
topLevelOnly: {
type: 'boolean'
},
depth: {
type: 'number'
},
development: {
type: 'boolean',
alias: 'dev'
},
production: {
type: 'boolean',
alias: 'prod'
},
verbose: {
type: 'boolean'
},
exitCode: {
type: 'number'
}
}
});
run(cli);