webpack-bundle-analyzer
Advanced tools
Comparing version 1.1.2-alpha to 1.2.0-alpha
#! /usr/bin/env node | ||
'use strict'; | ||
var path = require('path'); | ||
'use strict'; | ||
var commander = require('commander'); | ||
var _require = require('chalk'); | ||
var bold = _require.bold; | ||
var magenta = _require.magenta; | ||
var analyzer = require('../analyzer'); | ||
var viewer = require('../viewer'); | ||
var _process$argv$slice = process.argv.slice(2); | ||
var program = commander.version(require('../../package.json').version).usage('<bundleStatsFile> [bundleDir] [options]\n\n Arguments:\n \n bundleStatsFile Path to Webpack Stats JSON file.\n It can be generated with ' + bold('webpack --profile --json > stats.json') + '\n bundleDir Directory containing all generated bundles. By default a directory of stats file is used.').option('-p, --port <n>', 'Port that will be used by bundle analyzer to start HTTP server.', Number, 8888).parse(process.argv); | ||
var bundleStatsFile = _process$argv$slice[0]; | ||
var bundleDir = _process$argv$slice[1]; | ||
var port = program.port; | ||
var _program$args = program.args; | ||
var bundleStatsFile = _program$args[0]; | ||
var bundleDir = _program$args[1]; | ||
if (!bundleStatsFile) showHelp('Provide path to Webpack Stats file as first argument'); | ||
if (isNaN(port)) showHelp('Invalid port number'); | ||
if (!bundleDir) bundleDir = path.dirname(bundleStatsFile); | ||
var bundleStats = void 0; | ||
@@ -23,2 +38,8 @@ try { | ||
viewer.start(bundleStats, { bundleDir: bundleDir }); | ||
viewer.start(bundleStats, { bundleDir: bundleDir, port: port }); | ||
function showHelp(error) { | ||
if (error) console.log('\n ' + magenta(error)); | ||
program.outputHelp(); | ||
process.exit(1); | ||
} |
{ | ||
"name": "webpack-bundle-analyzer", | ||
"version": "1.1.2-alpha", | ||
"version": "1.2.0-alpha", | ||
"description": "Webpack Bundle Analyzer that represents all the information in convenient interative treemap", | ||
@@ -25,2 +25,3 @@ "author": "Yury Grunin <grunin.ya@ya.ru>", | ||
"chalk": "^1.1.3", | ||
"commander": "^2.9.0", | ||
"express": "^4.14.0", | ||
@@ -27,0 +28,0 @@ "file-exists": "^2.0.0", |
@@ -1,3 +0,1 @@ | ||
'use strict'; | ||
const fs = require('fs'); | ||
@@ -4,0 +2,0 @@ const path = require('path'); |
#! /usr/bin/env node | ||
'use strict'; | ||
const path = require('path'); | ||
const commander = require('commander'); | ||
const { bold, magenta } = require('chalk'); | ||
const analyzer = require('../analyzer'); | ||
const viewer = require('../viewer'); | ||
const [bundleStatsFile, bundleDir] = process.argv.slice(2); | ||
const program = commander | ||
.version(require('../../package.json').version) | ||
.usage( | ||
`<bundleStatsFile> [bundleDir] [options] | ||
Arguments: | ||
bundleStatsFile Path to Webpack Stats JSON file. | ||
It can be generated with ${bold('webpack --profile --json > stats.json')} | ||
bundleDir Directory containing all generated bundles. By default a directory of stats file is used.` | ||
) | ||
.option( | ||
'-p, --port <n>', | ||
'Port that will be used by bundle analyzer to start HTTP server.', | ||
Number, | ||
8888 | ||
) | ||
.parse(process.argv); | ||
let { | ||
port, | ||
args: [bundleStatsFile, bundleDir] | ||
} = program; | ||
if (!bundleStatsFile) showHelp('Provide path to Webpack Stats file as first argument'); | ||
if (isNaN(port)) showHelp('Invalid port number'); | ||
if (!bundleDir) bundleDir = path.dirname(bundleStatsFile); | ||
let bundleStats; | ||
@@ -18,2 +48,8 @@ try { | ||
viewer.start(bundleStats, { bundleDir }); | ||
viewer.start(bundleStats, { bundleDir, port }); | ||
function showHelp(error) { | ||
if (error) console.log(`\n ${magenta(error)}`); | ||
program.outputHelp(); | ||
process.exit(1); | ||
} |
@@ -1,3 +0,1 @@ | ||
'use strict'; | ||
const fs = require('fs'); | ||
@@ -4,0 +2,0 @@ const _ = require('lodash'); |
@@ -1,3 +0,1 @@ | ||
'use strict'; | ||
const _ = require('lodash'); | ||
@@ -4,0 +2,0 @@ const filesize = require('filesize'); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
209940
2853
11
+ Addedcommander@^2.9.0
+ Addedcommander@2.20.3(transitive)