analyze.js 855 B

123456789101112131415161718192021222324252627
  1. #!/usr/bin/env node
  2. const shelljs = require('shelljs')
  3. const animateProgress = require('./helpers/progress')
  4. const chalk = require('chalk')
  5. const addCheckMark = require('./helpers/checkmark')
  6. const progress = animateProgress('Generating stats')
  7. // Generate stats.json file with webpack
  8. shelljs.exec(
  9. 'webpack --config internals/webpack/webpack.prod.babel.js --profile --json > stats.json',
  10. addCheckMark.bind(null, callback) // Output a checkmark on completion
  11. )
  12. // Called after webpack has finished generating the stats.json file
  13. function callback () {
  14. clearInterval(progress)
  15. process.stdout.write(
  16. '\n\nOpen ' +
  17. chalk.magenta('http://webpack.github.io/analyse/') +
  18. ' in your browser and upload the stats.json file!' +
  19. chalk.blue(
  20. '\n(Tip: ' + chalk.italic('CMD + double-click') + ' the link!)\n\n'
  21. )
  22. )
  23. }