Skip to content

Latest commit

 

History

History
112 lines (74 loc) · 4.79 KB

README.md

File metadata and controls

112 lines (74 loc) · 4.79 KB

webpack-build-notifier

A Webpack plugin that uses the node-notifier module to display OS-level notifications for Webpack build errors and warnings.

NPM version

Are you tired of having to constantly switch between your IDE and terminal window to see whether your latest edits resulted in a failed build? Why didn't your latest changes get hot-loaded? Was there a syntax error or failed unit test? With this plugin, you will always be apprised of build problems without having to keep an eye on your terminal window.

To use, install the webpack-build-notifier package npm install webpack-build-notifier --save-dev and add the plugin to your Webpack configuration file:

// webpack.config.js
var WebpackBuildNotifierPlugin = require('webpack-build-notifier');

module.exports = {
  // ... snip ...
  plugins: [
    new WebpackBuildNotifierPlugin()
  ],
  // ... snip ...
}

Config Options

title

The notification title. Defaults to Webpack Build.

logo

The absolute path to the project logo to be displayed as a content image in the notification. Optional.

sound

The sound to play for notifications. Set to false to play no sound. Valid sounds are listedin the node-notifier project, here. Defaults to Submarine.

successSound

The sound to play for success notifications. Defaults to the value of the sound configuration option. Set to false to play no sound for success notifications. Takes precedence over the sound configuration option.

failureSound

The sound to play for failure and warning notifications. Defaults to the value of the sound configuration option. Set to false to play no sound for failure and warning notifications. Takes precedence over the sound configuration option.

suppressSuccess

True to suppress the success notifications, otherwise false (default). Note that the success notification will always be shown following a failed build regardless of this setting.

suppressWarning

True to suppress the warning notifications, otherwise false (default).

activateTerminalOnError

True to activate (focus) the terminal window when a compilation error occurs. Note that this only works on Mac OSX (for now). Defaults to false. Regardless of the value of this config option, the terminal window can always be brought to the front by clicking on the notification.

successIcon

The absolute path to the icon to be displayed for success notifications. Defaults to the included ./icons/success.png.

Success

warningIcon

The absolute path to the icon to be displayed for warning notifications. Defaults to the included ./icons/warning.png.

Warning

failureIcon

The absolute path to the icon to be displayed for failure notifications. Defaults to the included ./icons/failure.png.

Failure

onClick

What to do when the notification is clicked. By default it activates the Terminal application.

Future Improvements

  • TBD

Notes

After publishing this package I discovered a couple other similar plugins that are worth looking into:

Given the purpose and similarities, this project probably should have been a fork of one of these.

Changelog

1.0.11

July 16, 2016
  • Bugfix for #6; added null check for error messages.

1.0.10

July 14, 2016
  • Added reference to strip-ansi NPM package to remove CLI color formatting from notifications.

1.0.9

July 5, 2016
  • Added new onClick configuration option to allow for specifying of notification click behavior.

1.0.8

February 17, 2016
  • Added new successSound and failureSound configuration options to allow different sounds depending upon the notification type. The sound configuration is still supported, but these two new options will take precedence.

1.0.7

January 18, 2016
  • Fixed sound configuration option to allow "false" value to disable sound.

1.0.6

December 17, 2015
  • Added suppressWarning configuration option.