3.3.2 • Published 6 years ago

webpack-sane-compiler-reporter v3.3.2

Weekly downloads
2,037
License
MIT
Repository
github
Last release
6 years ago

webpack-sane-compiler-reporter

NPM version Downloads Build Status Coverage Status Dependency status Dev Dependency status Greenkeeper badge

Beautiful reporting for webpack-sane-compiler compilation events.

Installation

$ npm install webpack-sane-compiler-reporter --save-dev

Usage

const startReporting = require('webpack-sane-compiler-reporter');

const { stop, options } = startReporting(compiler, {/* options */});

// Now, just call compiler.run() or compiler.watch() to start a compilation and start outputting reports
// Calling stop() will stop listening to the compiler events
// Furthermore, you have access to the options that were computed by the merge of provided options with the defaults

Available options

NameDescriptionTypeDefault
statsDisplay webpack stats after each compilationboolean/string (true, false or 'once')true
writeFunction responsible for printing/outputting the generated report messagesfunctionPrints to stderr
printStartFunction responsible for generating a message when a compilation startsfunctionExample output
printSuccessFunction responsible for generating a message when a compilation succeedsfunctionExample output
printFailureFunction responsible for generating a message when a compilation failsfunctionExample output
printInvalidateFunction responsible for generating a message when invalidate() is called when watchingfunctionExample output
printStatsFunction responsible for generating a message representing a WebpackStats instancefunctionExample  output
printErrorFunction responsible for generating a message of a Error instancefunctionExample output

Other exports

renderers

For convenience this package also exports the renderers used internally:

const reporter = require('webpack-sane-compiler-reporter');

reporter(compiler, {
    printError: (err) => `${reporter.renderers.renderError(err)}\n`,
});

symbols

You can also access the symbols that precede some messages.

const reporter = require('webpack-sane-compiler-reporter');

reporter(compiler, {
    printStart: () => `${reporter.symbols.start} A iniciar a compilação...\n`,
});

Tests

$ npm test
$ npm test -- --watch during development

License

MIT License