npm and error messages

This commit is contained in:
2018-10-27 03:51:47 -05:00
parent 692ab70565
commit 025a403027
29601 changed files with 2759363 additions and 14 deletions
+96
View File
@@ -0,0 +1,96 @@
Changelog
===============================================================================
v1.7.0
-------------------------------------------------------------------------------
- Handle errors/warnings in child compilations ([#49](https://github.com/Turbo87/webpack-notifier/pull/49)
v1.6.0
-------------------------------------------------------------------------------
- Add support for webpack 4 plugin system ([#39](https://github.com/Turbo87/webpack-notifier/pull/39)
v1.5.1
-------------------------------------------------------------------------------
- Update `node-notifier` dependency ([#23](https://github.com/Turbo87/webpack-notifier/pull/23) and [#36](https://github.com/Turbo87/webpack-notifier/pull/36))
v1.5.0
-------------------------------------------------------------------------------
- Add `skipFirstNotification` option ([#21](https://github.com/Turbo87/webpack-notifier/pull/21))
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});
```
+94
View File
@@ -0,0 +1,94 @@
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) {
function findFirstDFS(compilation, key) {
var match = compilation[key][0];
if (match) {
return match;
}
var children = compilation.children;
for (var i = 0; i < children.length; ++i) {
match = findFirstDFS(children[i], key);
if (match) {
return match;
}
}
}
if (this.isFirstBuild) {
this.isFirstBuild = false;
if (this.options.skipFirstNotification) {
return;
}
}
var error;
if (stats.hasErrors()) {
error = findFirstDFS(stats.compilation, 'errors');
} else if (stats.hasWarnings() && !this.options.excludeWarnings) {
error = findFirstDFS(stats.compilation, 'warnings');
} 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) {
if (compiler.hooks) {
var plugin = { name: 'Notifier' };
compiler.hooks.done.tap(plugin, this.compilationDone.bind(this));
} else {
compiler.plugin('done', this.compilationDone.bind(this));
}
};
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

+67
View File
@@ -0,0 +1,67 @@
{
"_from": "webpack-notifier@^1.5.1",
"_id": "webpack-notifier@1.7.0",
"_inBundle": false,
"_integrity": "sha512-L3UKrl500xk0VDYKkwQxy5/BPhBWsZ2xHsAx2Qe3dVKYUEk9+y690RcNTMIUcVOK2fRgK7KK3PA4ccOq1h+fTg==",
"_location": "/webpack-notifier",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "webpack-notifier@^1.5.1",
"name": "webpack-notifier",
"escapedName": "webpack-notifier",
"rawSpec": "^1.5.1",
"saveSpec": null,
"fetchSpec": "^1.5.1"
},
"_requiredBy": [
"/laravel-mix"
],
"_resolved": "https://registry.npmjs.org/webpack-notifier/-/webpack-notifier-1.7.0.tgz",
"_shasum": "4e03ea3ba1c0588d863935363f145d067815068a",
"_spec": "webpack-notifier@^1.5.1",
"_where": "C:\\xampp\\htdocs\\w4rpservices\\node_modules\\laravel-mix",
"author": {
"name": "Tobias Bieniek",
"email": "tobias.bieniek@gmx.de"
},
"bugs": {
"url": "https://github.com/Turbo87/webpack-notifier/issues"
},
"bundleDependencies": false,
"dependencies": {
"node-notifier": "^5.1.2",
"object-assign": "^4.1.0",
"strip-ansi": "^3.0.1"
},
"deprecated": false,
"description": "webpack + node-notifier = build status system notifications",
"devDependencies": {
"eslint": "^3.3.1"
},
"files": [
"index.js",
"logo.png"
],
"homepage": "https://github.com/Turbo87/webpack-notifier#readme",
"keywords": [
"webpack",
"notify",
"notification",
"node-notifier",
"notifier",
"build"
],
"license": "ISC",
"main": "index.js",
"name": "webpack-notifier",
"repository": {
"type": "git",
"url": "git+https://github.com/Turbo87/webpack-notifier.git"
},
"scripts": {
"test": "eslint index.js"
},
"version": "1.7.0"
}