generated from wednesday-solutions/react-template
-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathanalyze.js
More file actions
27 lines (23 loc) · 924 Bytes
/
analyze.js
File metadata and controls
27 lines (23 loc) · 924 Bytes
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
#!/usr/bin/env node
const shelljs = require('shelljs');
const chalk = require('chalk');
const animateProgress = require('./helpers/progress');
const addCheckMark = require('./helpers/checkmark');
const progress = animateProgress('Generating stats');
// Generate stats.json file with webpack
shelljs.exec(
'export ENVIRONMENT_NAME=production NODE_ENV=production && webpack --config internals/webpack/webpack.config.prod.js --profile --json > stats.json',
addCheckMark.bind(null, callback), // Output a checkmark on completion
);
// Called after webpack has finished generating the stats.json file
function callback() {
clearInterval(progress);
process.stdout.write(
'\n\nOpen ' +
chalk.magenta('http://webpack.github.io/analyse/') +
' in your browser and upload the stats.json file!' +
chalk.blue(
'\n(Tip: ' + chalk.italic('CMD + double-click') + ' the link!)\n\n',
),
);
}