bundle-stats 4.0.0-alpha.10 → 4.0.0-alpha.15
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 +3 -89
- package/dist/bundle-stats.html +2 -0
- package/dist/bundle-stats.json +39258 -0
- package/lib/cli.js +76 -0
- package/lib/cli.js.map +1 -0
- package/lib/index.js +11 -11
- package/lib/index.js.map +1 -0
- package/lib/locales.json +3 -0
- package/lib/run.js +128 -0
- package/lib/run.js.map +1 -0
- package/lib-esm/cli.js +70 -0
- package/lib-esm/cli.js.map +1 -0
- package/lib-esm/index.js +3 -0
- package/lib-esm/index.js.map +1 -0
- package/lib-esm/locales.json +3 -0
- package/lib-esm/run.js +122 -0
- package/lib-esm/run.js.map +1 -0
- package/package.json +18 -8
- package/tsconfig.esm.json +11 -0
- package/tsconfig.json +4 -0
- package/tsconfig.lib.json +7 -0
- package/types/cli.d.ts +1 -0
- package/types/index.d.ts +2 -0
- package/types/run.d.ts +11 -0
- package/bin/run.js +0 -161
- package/locales.json +0 -3
package/bin/index.js
CHANGED
|
@@ -1,92 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const updateNotifier = require('update-notifier');
|
|
3
|
+
const { cli } = require('..');
|
|
4
|
+
const packageInfo = require('../package.json');
|
|
6
5
|
|
|
7
|
-
|
|
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);
|