webpack-isomorphic-compiler-reporter

Pretty reporting for webpack-isomorphic-compiler

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
webpack-isomorphic-compiler-reporter
701.3.36 years ago7 years agoMinified + gzip package size for webpack-isomorphic-compiler-reporter in KB

Readme

webpack-isomorphic-compiler-reporter
!NPM versionnpm-imagenpm-url !Downloadsdownloads-imagenpm-url !Build Statustravis-imagetravis-url !Coverage Statuscodecov-imagecodecov-url !Dependency statusdavid-dm-imagedavid-dm-url !Dev Dependency statusdavid-dm-dev-imagedavid-dm-dev-url !Greenkeeper badgegreenkeeper-imagegreenkeeper-url
Beautiful reporting for webpack-isomorphic-compiler compilation events.
While webpack-sane-compiler-reporter works fine with this compiler, the output is incomplete. This reporter is specially designed to be isomorphic aware.
Example output

Installation

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

Usage

const startReporting = require('webpack-isomorphic-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 and the defaults

Available options

| Name | Description | Type | Default | | ------ | ------------- | -------- | ------- | | stats | Display webpack stats after each compilation | boolean/string (true, false or 'once') | true | | humanErrors | Detects human errors related to webpack configuration mistakes (done only once) | boolean | true | | write | Function responsible for printing/outputting the generated report messages | function | Prints to stderr | | printStart | Function responsible for generating a message for when a compilation starts | function | Example output | | printSuccess | Function responsible for generating a message when a compilation succeeds | function | Example output | | printFailure | Function responsible for generating a message when a compilation fails | function | Example output | | printInvalidate | Function responsible for generating a message when invalidate() is called when watching | function | Example output | | printStats | Function responsible for generating a message representing a WebpackStats instance | function | Example client  output Example server output | | printError | Function responsible for generating a message of a Error instance | function | Example output |

Other exports

renderers

For convenience this package also exports the renderers used internally:
const reporter = require('webpack-isomorphic-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-isomorphic-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