包详细信息

webpack-notifier

Turbo872.1mISC1.15.0

webpack + node-notifier = build status system notifications

webpack, notify, notification, node-notifier

自述文件

webpack-notifier

npm Version GitHub Workflow Status Coverage Status Code Style
npm npm bundle size

This is a webpack plugin that uses the node-notifier package to display build status system notifications to the user.

webpack-notifier screenshot

This is a fork of the webpack-error-notification plugin. It adds support for Windows and there is no need to manually install the terminal-notifier package on OS X anymore.

The plugin will notify you about the first run (success/fail), all failed runs and the first successful run after recovering from a build failure. In other words: it will stay silent if everything is fine with your build.

Installation

Use npm to install this package:

npm install --save-dev webpack-notifier

Check the node-notifier Requirements whether you need to install any additional tools for your OS.

Usage

In the webpack.config.js file:

var WebpackNotifierPlugin = require('webpack-notifier');

var config = module.exports = {
  // ...

  plugins: [
    new WebpackNotifierPlugin(),
  ]
}

Configuration

Title

Title shown in the notification.

new WebpackNotifierPlugin({title: 'Webpack'});
new WebpackNotifierPlugin({title: function (params) {
  return `Build status is ${params.status} with message ${params.message}`;
}});

Emojis in message text

Show status emoji icon before the message.

new WebpackNotifierPlugin({emoji: true});

Content Image

Image shown in the notification. Can be a path string or object with paths.

String path:

var path = require('path');

new WebpackNotifierPlugin({contentImage: path.join(__dirname, 'logo.png')});

Object string path:

var path = require('path');

const statusesPaths = {
  success: path.join(__dirname, 'success.png'),
  warning: path.join(__dirname, 'warning.png'),
  error: path.join(__dirname, 'error.png')
}

new WebpackNotifierPlugin({contentImage: statusesPaths});

Exclude Warnings

If set to true, warnings will not cause a notification.

new WebpackNotifierPlugin({excludeWarnings: true});

Always Notify

Trigger a notification every time. Call it "noisy-mode".

new WebpackNotifierPlugin({alwaysNotify: true});

Notify on error

Trigger a notification only on error.

new WebpackNotifierPlugin({onlyOnError: true});

Skip Notification on the First Build

Do not notify on the first build. This allows you to receive notifications on subsequent incremental builds without being notified on the initial build.

new WebpackNotifierPlugin({skipFirstNotification: true});

更新日志

Changelog

v1.13.0

  • Update node-notifier to v9

v1.12.0

  • fix(dependencies): moved the erroneous dependency to devDependencies
  • Add support set of images for different build status
  • fix default title, when title option skipped
  • Update node-notifier to v8

Minimum supported Node version is 6+

v1.11.1

  • support child compilation errors in webpack@<3.11.0

v1.11.0

  • Support for title function for dynamic titles (#53)

v1.10.1

  • fix(emoji): show success icon
  • docs(emoji): documentation about emoji option

v1.10.0

  • Add onlyOnError option (#51)

v1.9.1

  • reduced package size by 2 times

v1.9.0

  • Update node-notifier to v6 (#56)

v1.8.0

  • Add --emoji option (#55)

v1.7.0

  • Handle errors/warnings in child compilations (#49)

v1.6.0

  • Add support for webpack 4 plugin system (#39)

v1.5.1

  • Update node-notifier dependency (#23 and #36)

v1.5.0

  • Add skipFirstNotification option (#21)

v1.4.1

  • Add missing logo.png to published NPM package (#18)

v1.4.0

  • Pass all options to node-notifier (@opensrcken)
  • Strip ANSI escape codes from the messages (@opensrcken)
  • Remove unnecessary files from NPM package

v1.3.2

  • Use contentImage as icon on linux (#17)

v1.3.1

  • Republished v1.3.0 due to NPM deployment failure

v1.3.0

  • Prefix error + warning messages (#13)

v1.2.1

  • fixed Cannot read property 'rawRequest' of undefined error (#5)

v1.2.0

  • alwaysNotify option (#4)

v1.1.1

  • fixed error is undefined exception

v1.1.0

  • title and contentImage options (#1)
  • excludeWarnings option (#2)
  • fixed warnings display

v1.0.1

  • documentation improvements

v1.0.0

  • initial release after fork