analyze.js 720 Bytes
Newer Older
Julien Benchetrit's avatar
Julien Benchetrit committed
1 2 3 4 5 6 7 8 9 10 11
#!/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');

shelljs.exec(
  'webpack --config internals/webpack/webpack.prod.babel.js --profile --json > stats.json',
dengxiaofeng's avatar
dengxiaofeng committed
12
  addCheckMark.bind(null, callback),
Julien Benchetrit's avatar
Julien Benchetrit committed
13 14 15 16 17 18 19 20 21 22 23 24 25
);

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',
      ),
  );
}