gauge-webpack-plugin

0.1.0 • Public • Published

gauge-webpack-plugin

Progress bar for Webpack built on Gauge supporting multiple targets

asciicast

Install

$ npm install -D webpack gauge-webpack-plugin

Usage

This plugin supports multiple webpack targets, and all options of Gauge.

Basic

const GaugePlugin = require('gauge-webpack-plugin');

In your Webpack config, add GaugePlugin() to your plugins property:

plugins: [
  GaugePlugin()
]

This will display a simple progress bar suitable for your terminal.

Note: Instantiating the plugin with new is not required.

Custom Section

plugins: [
  GaugePlugin('my webpack build')
]

This will display a progress bar with a section of "my webpack build".

Gauge Options

plugins: [
  GaugePlugin({
    write: process.stdout
  })
]

The above will write gauge to the process.stdout stream instead of the default progress.stderr stream.

plugins: [
  GaugePlugin('my webpack build', {
    write: process.stdout,
    theme: 'ASCII'
  })
]

The above combines a custom section with a custom stream, and forces the "ASCII" Gauge theme.

Multiple Targets

If your Webpack config exports an Array of objects, then you're generating multiple targets (which happens in parallel).

Basic

const GaugePlugin = require('gauge-webpack-plugin');

module.exports = [
  {
    // ...
    plugins: [
      GaugePlugin('electron build')
    ]
    // ...
  },
  {
    // ...
    plugins: [
      GaugePlugin('web build')
    ]
    // ...
  }
];

Custom Gauge Options in Multiple Targets

Since only one progress bar can be displayed at once (reliably), the Gauge object itself is a singleton. If you need to use custom Gauge options (not custom section names), then you should configure the plugin up-front, like this:

const GaugePlugin = require('gauge-webpack-plugin');

GaugePlugin({
  write: process.stdout
});

module.exports = [
  {
    // ...
    plugins: [
      GaugePlugin('electron build')
    ]
    // ...
  },
  {
    // ...
    plugins: [
      GaugePlugin('web build')
    ]
    // ...
  }
];

Both targets will "inherit" the Gauge options from the first call to the plugin.

License

©️ 2016 Christopher Hiller. Licensed MIT.

Package Sidebar

Install

npm i gauge-webpack-plugin

Weekly Downloads

1

Version

0.1.0

License

MIT

Last publish

Collaborators

  • boneskull