All files / bundle-phobia-cli index.js

0% Statements 0/7
100% Branches 0/0
0% Functions 0/1
0% Lines 0/7
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 28 29 30 31 32 33 34 35 36                                                                       
 
 
const updateNotifier = require('update-notifier');
const c = require('chalk');
const argv = require('yargs')
  .usage('Usage: $0 <package-names...>')
  .describe('range', 'Get a range of version (0 for all, 8 by default)')
  .alias('range', 'r')
  .number('range')
  .describe('json', 'Output json rather than a formater string')
  .alias('json', 'j')
  .boolean('j')
  .describe('size', 'Output just the module size')
  .alias('size', 's')
  .boolean('s')
  .describe('gzip-size', 'Output just the module gzip size')
  .alias('gzip-size', 'g')
  .boolean('g')
  .describe('dependencies', 'Output just the number of dependencies')
  .alias('dependencies', 'd')
  .boolean('d')
  .help('h')
  .alias('h', 'help').argv;
const pkg = require('./package.json');
 
const {main} = require('./src/core');
 
if (!module.parent) {
  /* eslint-disable no-console */
  main({argv}).catch(err => {
    console.log(c.red.bold('bundle-phobia failed: ') + err.message);
    process.exit(1);
  });
  updateNotifier({pkg}).notify();
}