Statoscope CLI
This package supplies Statoscope as CLI tool
Installation
npm i @statoscope/cli -g
Usage
statoscope [command] [...args]
Commands
validate
Validate or compare webpack stats.
validate [...args]
--input
(-i
) - path to a stats.json--reference
(-r
) - path to a stats-file to compare with (optional)--config
(-c
) - path to statoscope config (by default {pwd}/statoscope.config.js
has used)--warn-as-error
(-w
) - treat warnings as errors
Example:
- Install webpack-plugin for the validator:
npm install --save-dev @statoscope/stats-validator-plugin-webpack @statoscope/stats-validator-reporter-console @statoscope/stats-validator-reporter-stats-report
- Create a statosope-config:
statoscope.config.js
module.exports = {
validate: {
plugins: ['@statoscope/webpack'],
reporters: [
'@statoscope/console',
['@statoscope/stats-report', {open: true}],
],
rules: {
'@statoscope/webpack/build-time-limits': ['error', 10000],
'@statoscope/webpack/restricted-packages': ['error', ['lodash', 'browserify-crypto']],
'@statoscope/webpack/no-packages-dups': ['error'],
'@statoscope/webpack/entry-download-time-limits': ['error', { global: { maxDownloadTime: 3000 } }],
'@statoscope/webpack/entry-download-size-limits': ['error', { global: { maxSize: 3 * 1024 * 1024 } }],
'@statoscope/webpack/diff-entry-download-size-limits': [
'error',
{ global: { maxSizeDiff: 3*1024 } },
],
'@statoscope/webpack/diff-deprecated-packages': ['error', ['rxjs']],
}
}
}
- Exec the command:
statoscope validate --input path/to/stats.json
- Analyze results in the console or generated UI-report
Learn more on @staoscope/stats-validator and @statoscope/stats-validator-plugin-webpack
serve
Start HTTP-server and serve JSON-stats as HTML report
serve input [...args]
--input
(-i
) - path to one or more webpack stats--host
(-h
) - server host--port
(-p
) - server port--open
(-o
) - open browser after server start
Example:
statoscope serve path/to/stats.json -o
Start server and open browser.
generate
Generate HTML report from JSON-stats.
generate input output [...args]
--input
(-i
) - path to one or more webpack stats--output
(-t
) - path to generated HTML--open
(-o
) - open browser after generate
Example:
statoscope generate path/to/stats.json path/to/report.html -o
Create statoscope report, save it to path/to/report.html
and open
Support
If you are an engineer or a company that is interested in Statoscope improvements, you may support Statoscope by
financial contribution at OpenCollective.