bundle-stats 4.0.0-alpha.11 → 4.0.0-alpha.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/index.js CHANGED
@@ -1,92 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const path = require('path');
4
- const yargs = require('yargs');
5
- const updateNotifier = require('update-notifier');
3
+ const { cli } = require('..');
4
+ const packageInfo = require('../package.json');
6
5
 
7
- const pkg = require('../package.json');
8
- const run = require('./run');
9
-
10
- const DEFAULT_OUTPUT_DIR = './dist';
11
-
12
- const notifier = updateNotifier({
13
- pkg,
14
- updateCheckInterval: 1000 * 60 * 60 * 24 * 7,
15
- });
16
-
17
- if (notifier.update) {
18
- notifier.notify();
19
- }
20
-
21
- const { demo } = yargs.parse();
22
-
23
- if (demo) {
24
- run({
25
- html: true,
26
- json: true,
27
- outDir: DEFAULT_OUTPUT_DIR,
28
- artifactFilepaths: [
29
- path.resolve(__dirname, '../__fixtures__/webpack-stats-current.json'),
30
- path.resolve(__dirname, '../__fixtures__/webpack-stats-baseline.json'),
31
- ],
32
- });
33
-
34
- process.exit(0);
35
- }
36
-
37
- const args = yargs
38
- .usage('Usage: $0 OPTIONS [STATS_FILE]...')
39
- .demandCommand(1, 'Webpack stats file path is required.')
40
- .option('out-dir', {
41
- description: 'Output directory',
42
- default: DEFAULT_OUTPUT_DIR,
43
- })
44
-
45
- .option('compare', {
46
- description: 'Use local saved stats for comparison',
47
- boolean: true,
48
- default: true,
49
- })
50
- .option('baseline', {
51
- description: 'Save current stats as baseline',
52
- boolean: true,
53
- default: false,
54
- })
55
-
56
- .option('html', {
57
- description: 'Save HTML report',
58
- boolean: true,
59
- default: true,
60
- })
61
- .option('json', {
62
- description: 'Save JSON data',
63
- boolean: true,
64
- default: false,
65
- })
66
- .option('demo', {
67
- description: 'Generate demo reports',
68
- default: false,
69
- })
70
- .alias('d', 'out-dir')
71
- .alias('h', 'help')
72
- .alias('v', 'version')
73
- .help().argv;
74
-
75
- const {
76
- compare,
77
- baseline,
78
-
79
- html,
80
- json,
81
- outDir,
82
- _: artifactFilepaths,
83
- } = args;
84
-
85
- run({
86
- baseline,
87
- compare,
88
- html,
89
- json,
90
- outDir,
91
- artifactFilepaths,
92
- });
6
+ cli(packageInfo);