This commit is contained in:
chrosey
2017-09-13 07:52:34 +02:00
parent a1f16c37f4
commit 2340b0226b
24621 changed files with 2912161 additions and 149 deletions
+72
View File
@@ -0,0 +1,72 @@
Changelog
===============================================================================
v1.4.1
-------------------------------------------------------------------------------
- Add missing `logo.png` to published NPM package ([#18](https://github.com/Turbo87/webpack-notifier/pull/18))
v1.4.0
-------------------------------------------------------------------------------
- Pass all options to `node-notifier` ([@opensrcken](https://github.com/opensrcken))
- Strip ANSI escape codes from the messages ([@opensrcken](https://github.com/opensrcken))
- Remove unnecessary files from NPM package
v1.3.2
-------------------------------------------------------------------------------
- Use contentImage as icon on linux ([#17](https://github.com/Turbo87/webpack-notifier/pull/17))
v1.3.1
-------------------------------------------------------------------------------
- Republished v1.3.0 due to NPM deployment failure
v1.3.0
-------------------------------------------------------------------------------
- Prefix error + warning messages ([#13](https://github.com/Turbo87/webpack-notifier/pull/13))
v1.2.1
-------------------------------------------------------------------------------
- fixed `Cannot read property 'rawRequest' of undefined` error ([#5](https://github.com/Turbo87/webpack-notifier/issues/5))
v1.2.0
-------------------------------------------------------------------------------
- `alwaysNotify` option ([#4](https://github.com/Turbo87/webpack-notifier/pull/4))
v1.1.1
-------------------------------------------------------------------------------
- fixed `error is undefined` exception
v1.1.0
-------------------------------------------------------------------------------
- `title` and `contentImage` options ([#1](https://github.com/Turbo87/webpack-notifier/pull/1))
- `excludeWarnings` option ([#2](https://github.com/Turbo87/webpack-notifier/pull/2))
- fixed warnings display
v1.0.1
-------------------------------------------------------------------------------
- documentation improvements
v1.0.0
-------------------------------------------------------------------------------
- initial release after fork
+6
View File
@@ -0,0 +1,6 @@
Copyright (c) 2014, Vsevolod Solovyov <vsevolod.solovyov@gmail.com>
Copyright (c) 2015, Tobias Bieniek <tobias.bieniek@gmx.de>
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+93
View File
@@ -0,0 +1,93 @@
# webpack-notifier
[![Build Status](https://img.shields.io/travis/Turbo87/webpack-notifier.svg)](https://travis-ci.org/Turbo87/webpack-notifier)
[![npm Version](https://img.shields.io/npm/v/webpack-notifier.svg)](https://www.npmjs.com/package/webpack-notifier)
This is a [webpack](http://webpack.github.io/) plugin that uses the
[node-notifier](https://github.com/mikaelbr/node-notifier) package to
display build status system notifications to the user.
![webpack-notifier screenshot](screenshot.png)
> This is a fork of the
[webpack-error-notification](https://github.com/vsolovyov/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](https://github.com/mikaelbr/node-notifier#requirements)
whether you need to install any additional tools for your OS.
## Usage
In the `webpack.config.js` file:
```js
var WebpackNotifierPlugin = require('webpack-notifier');
var config = module.exports = {
// ...
plugins: [
new WebpackNotifierPlugin(),
]
},
```
## Configuration
### Title
Title shown in the notification.
```js
new WebpackNotifierPlugin({title: 'Webpack'});
```
### Content Image
Image shown in the notification.
```js
var path = require('path');
new WebpackNotifierPlugin({contentImage: path.join(__dirname, 'logo.png')});
```
### Exclude Warnings
If set to `true`, warnings will not cause a notification.
```js
new WebpackNotifierPlugin({excludeWarnings: true});
```
### Always Notify
Trigger a notification every time. Call it "noisy-mode".
```js
new WebpackNotifierPlugin({alwaysNotify: 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.
```js
new WebpackNotifierPlugin({skipFirstNotification: true});
```
+73
View File
@@ -0,0 +1,73 @@
var stripANSI = require('strip-ansi');
var path = require('path');
var objectAssign = require('object-assign');
var os = require('os');
var notifier = require('node-notifier');
var DEFAULT_LOGO = path.join(__dirname, 'logo.png');
var WebpackNotifierPlugin = module.exports = function(options) {
this.options = options || {};
this.lastBuildSucceeded = false;
this.isFirstBuild = true;
};
WebpackNotifierPlugin.prototype.compileMessage = function(stats) {
if (this.isFirstBuild) {
this.isFirstBuild = false;
if (this.options.skipFirstNotification) {
return;
}
}
var error;
if (stats.hasErrors()) {
error = stats.compilation.errors[0];
} else if (stats.hasWarnings() && !this.options.excludeWarnings) {
error = stats.compilation.warnings[0];
} else if (!this.lastBuildSucceeded || this.options.alwaysNotify) {
this.lastBuildSucceeded = true;
return 'Build successful';
} else {
return;
}
this.lastBuildSucceeded = false;
var message;
if (error.module && error.module.rawRequest)
message = error.module.rawRequest + '\n';
if (error.error)
message = 'Error: ' + message + error.error.toString();
else if (error.warning)
message = 'Warning: ' + message + error.warning.toString();
else if (error.message) {
message = 'Warning: ' + message + error.message.toString();
}
return stripANSI(message);
};
WebpackNotifierPlugin.prototype.compilationDone = function(stats) {
var msg = this.compileMessage(stats);
if (msg) {
var contentImage = ('contentImage' in this.options) ?
this.options.contentImage : DEFAULT_LOGO;
notifier.notify(objectAssign({
title: 'Webpack',
message: msg,
contentImage: contentImage,
icon: (os.platform() === 'win32' || os.platform() === 'linux') ? contentImage : undefined
}, this.options));
}
};
WebpackNotifierPlugin.prototype.apply = function(compiler) {
compiler.plugin('done', this.compilationDone.bind(this));
};
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

+102
View File
@@ -0,0 +1,102 @@
{
"_args": [
[
{
"raw": "webpack-notifier@^1.4.1",
"scope": null,
"escapedName": "webpack-notifier",
"name": "webpack-notifier",
"rawSpec": "^1.4.1",
"spec": ">=1.4.1 <2.0.0",
"type": "range"
},
"c:\\xampp\\htdocs\\laravel\\node_modules\\laravel-mix"
]
],
"_from": "webpack-notifier@>=1.4.1 <2.0.0",
"_id": "webpack-notifier@1.5.0",
"_inCache": true,
"_location": "/webpack-notifier",
"_nodeVersion": "6.9.2",
"_npmOperationalInternal": {
"host": "packages-18-east.internal.npmjs.com",
"tmp": "tmp/webpack-notifier-1.5.0.tgz_1481839058444_0.029238794464617968"
},
"_npmUser": {
"name": "turbo87",
"email": "tobias.bieniek@gmx.de"
},
"_npmVersion": "3.10.9",
"_phantomChildren": {},
"_requested": {
"raw": "webpack-notifier@^1.4.1",
"scope": null,
"escapedName": "webpack-notifier",
"name": "webpack-notifier",
"rawSpec": "^1.4.1",
"spec": ">=1.4.1 <2.0.0",
"type": "range"
},
"_requiredBy": [
"/laravel-mix"
],
"_resolved": "https://registry.npmjs.org/webpack-notifier/-/webpack-notifier-1.5.0.tgz",
"_shasum": "c010007d448cebc34defc99ecf288fa5e8c6baf6",
"_shrinkwrap": null,
"_spec": "webpack-notifier@^1.4.1",
"_where": "c:\\xampp\\htdocs\\laravel\\node_modules\\laravel-mix",
"author": {
"name": "Tobias Bieniek",
"email": "tobias.bieniek@gmx.de"
},
"bugs": {
"url": "https://github.com/Turbo87/webpack-notifier/issues"
},
"dependencies": {
"node-notifier": "^4.1.0",
"object-assign": "^4.1.0",
"strip-ansi": "^3.0.1"
},
"description": "webpack + node-notifier = build status system notifications",
"devDependencies": {
"eslint": "^3.3.1"
},
"directories": {},
"dist": {
"shasum": "c010007d448cebc34defc99ecf288fa5e8c6baf6",
"tarball": "https://registry.npmjs.org/webpack-notifier/-/webpack-notifier-1.5.0.tgz"
},
"files": [
"index.js",
"logo.png"
],
"gitHead": "126c795677f4b9524bd547f598252e336a5771d4",
"homepage": "https://github.com/Turbo87/webpack-notifier#readme",
"keywords": [
"webpack",
"notify",
"notification",
"node-notifier",
"notifier",
"build"
],
"license": "ISC",
"main": "index.js",
"maintainers": [
{
"name": "turbo87",
"email": "tobias.bieniek@gmx.de"
}
],
"name": "webpack-notifier",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/Turbo87/webpack-notifier.git"
},
"scripts": {
"test": "eslint index.js"
},
"version": "1.5.0"
}