webpack-build-notifier
Advanced tools
Comparing version 2.0.0-alpha.3 to 2.0.0
# Changelog | ||
#### 2.0.0-alpha.3 | ||
###### _August_ 14, 2019_ | ||
#### 2.0.0 | ||
###### _October 15, 2019_ | ||
- Converted to TypeScript, increased test coverage. | ||
#### 1.2.2 | ||
###### _October 15, 2019_ | ||
- Updated node-notifier to fix [#43](/../../issues/43); added test coverage. | ||
#### 1.2.1 | ||
###### _October 15, 2019_ | ||
- Added *showDuration* config option for [#48](/../../issues/48). | ||
#### 1.1.1 | ||
###### _August 29, 2019_ | ||
- Updated node-notifier dependency to latest version to fix [#45](/../../issues/45). | ||
#### 1.1.0 | ||
###### _August 10, 2019_ | ||
- Added two new config options: onCompileStart, onComplete. | ||
#### 1.0.3 | ||
###### _June_ 4, 2019_ | ||
###### _June 4, 2019_ | ||
@@ -14,5 +34,5 @@ - Updated dependencies to latest versions to fix high-severity js-yaml vulnerability. | ||
#### 1.0.2 | ||
###### _May_ 3, 2019_ | ||
###### _May 3, 2019_ | ||
- Corrected *sound TS types. | ||
- Corrected *sound* TS types. | ||
@@ -19,0 +39,0 @@ #### 1.0.1 |
@@ -18,2 +18,3 @@ import { Config } from './types'; | ||
private activateTerminalOnError; | ||
private showDuration; | ||
private successIcon; | ||
@@ -23,2 +24,4 @@ private warningIcon; | ||
private compileIcon; | ||
private onCompileStart?; | ||
private onComplete?; | ||
private onClick; | ||
@@ -25,0 +28,0 @@ private onTimeout?; |
@@ -17,2 +17,3 @@ "use strict"; | ||
var child_process_1 = require("child_process"); | ||
var types_1 = require("./types"); | ||
var DEFAULT_ICON_PATH = path_1.default.resolve(__dirname, 'icons'); | ||
@@ -36,2 +37,3 @@ var WebpackBuildNotifierPlugin = /** @class */ (function () { | ||
this.activateTerminalOnError = false; | ||
this.showDuration = false; | ||
this.successIcon = path_1.default.join(DEFAULT_ICON_PATH, 'success.png'); | ||
@@ -82,2 +84,3 @@ this.warningIcon = path_1.default.join(DEFAULT_ICON_PATH, 'warning.png'); | ||
var sound = _this.successSound; | ||
var compilationStatus = types_1.CompilationStatus.SUCCESS; | ||
if (results.hasErrors()) { | ||
@@ -87,2 +90,3 @@ var error = results.compilation.errors[0]; | ||
notify = true; | ||
compilationStatus = types_1.CompilationStatus.ERROR; | ||
title += 'Error'; | ||
@@ -98,2 +102,3 @@ msg = _this.formatMessage(error, errorFilePath); | ||
notify = true; | ||
compilationStatus = types_1.CompilationStatus.WARNING; | ||
title += 'Warning'; | ||
@@ -107,2 +112,5 @@ msg = _this.formatMessage(warning, warningFilePath); | ||
title += 'Success'; | ||
if (_this.showDuration) { | ||
msg += " [" + (results.endTime - results.startTime) + " ms]"; | ||
} | ||
/* istanbul ignore else */ | ||
@@ -128,2 +136,6 @@ if (_this.suppressSuccess === 'always' || (_this.suppressSuccess === 'initial' && !_this.hasRun)) { | ||
})); | ||
/* istanbul ignore else */ | ||
if (_this.onComplete) { | ||
_this.onComplete(results.compilation, compilationStatus); | ||
} | ||
} | ||
@@ -145,2 +157,6 @@ /* istanbul ignore else */ | ||
}); | ||
/* istanbul ignore else */ | ||
if (_this.onCompileStart) { | ||
_this.onCompileStart(compiler); | ||
} | ||
callback(); | ||
@@ -160,3 +176,3 @@ }; | ||
// Windows version >= 8 | ||
var snoreToast = path_1.default.join(require.resolve('node-notifier'), '../vendor/snoreToast/SnoreToast.exe'); | ||
var snoreToast = path_1.default.join(require.resolve('node-notifier'), '../vendor/snoreToast', "snoretoast-" + (process_1.default.arch === 'x64' ? 'x64' : 'x86') + ".exe"); | ||
try { | ||
@@ -163,0 +179,0 @@ child_process_1.execFileSync(snoreToast, [ |
import NotificationCenter from 'node-notifier/notifiers/notificationcenter'; | ||
import { NodeNotifier } from 'node-notifier'; | ||
import webpack from 'webpack'; | ||
/** | ||
* Enum representing valid compilation result statuses. | ||
*/ | ||
export declare enum CompilationStatus { | ||
SUCCESS = "success", | ||
WARNING = "warning", | ||
ERROR = "error" | ||
} | ||
export declare type CompilationResult = { | ||
@@ -46,2 +55,18 @@ details?: string; | ||
/** | ||
* A function which is invoked when compilation starts. Optional. The function is passed one parameter: | ||
* 1. {webpack.compiler.Compiler} compiler - The webpack Compiler instance. | ||
* Note that `suppressCompileStart` must be `false`. | ||
*/ | ||
onCompileStart?: (compiler: webpack.compiler.Compiler) => void; | ||
/** | ||
* A function which is invoked when compilation completes. Optional. The function is passed two parameters: | ||
* 1. {webpack.compilation.Compilation} compilation - The webpack Compilation instance. | ||
* 2. {CompilationStatus} status - one of 'success', 'warning', or 'error' | ||
*/ | ||
onComplete?: (compilation: webpack.compilation.Compilation, status: CompilationStatus) => void; | ||
/** | ||
* True to show the duration of a successful compilation, otherwise false (default). | ||
*/ | ||
showDuration?: boolean; | ||
/** | ||
* Defines when success notifications are shown. Can be one of the following values: | ||
@@ -89,3 +114,2 @@ * | ||
/** | ||
* @cfg {Function} onClick | ||
* A function called when clicking on a warning or error notification. By default, it activates the Terminal application. | ||
@@ -92,0 +116,0 @@ * The function is passed two parameters: |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
* Enum representing valid compilation result statuses. | ||
*/ | ||
var CompilationStatus; | ||
(function (CompilationStatus) { | ||
CompilationStatus["SUCCESS"] = "success"; | ||
CompilationStatus["WARNING"] = "warning"; | ||
CompilationStatus["ERROR"] = "error"; | ||
})(CompilationStatus = exports.CompilationStatus || (exports.CompilationStatus = {})); |
{ | ||
"name": "webpack-build-notifier", | ||
"version": "2.0.0-alpha.3", | ||
"version": "2.0.0", | ||
"description": "A Webpack plugin that generates OS notifications for build steps using node-notifier.", | ||
@@ -38,20 +38,20 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"node-notifier": "5.4.0", | ||
"node-notifier": "6.0.0", | ||
"strip-ansi": "^5.2.0" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "^24.0.17", | ||
"@types/jest": "^24.0.19", | ||
"@types/node-notifier": "^5.4.0", | ||
"@types/strip-ansi": "^5.2.1", | ||
"@types/webpack": "^4.4.32", | ||
"babel-jest": "^24.8.0", | ||
"@types/webpack": "^4.39.3", | ||
"babel-jest": "^24.9.0", | ||
"copyfiles": "^2.1.1", | ||
"jest": "^24.8.0", | ||
"jest": "^24.9.0", | ||
"rimraf": "^3.0.0", | ||
"ts-jest": "^24.0.2", | ||
"tslint": "^5.18.0", | ||
"tslint-config-airbnb": "^5.11.1", | ||
"typescript": "^3.5.3", | ||
"webpack": "^4.33.0" | ||
"ts-jest": "^24.1.0", | ||
"tslint": "^5.20.0", | ||
"tslint-config-airbnb": "^5.11.2", | ||
"typescript": "^3.6.4", | ||
"webpack": "^4.41.2" | ||
} | ||
} |
@@ -58,2 +58,12 @@ # webpack-build-notifier | ||
#### onCompileStart | ||
A function which is invoked when compilation starts. Optional. The function is passed one parameter: | ||
* {webpack.compiler.Compiler} compiler - The webpack Compiler instance. | ||
Note that `suppressCompileStart` must be `false`. | ||
#### onComplete | ||
A function which is invoked when compilation completes. Optional. The function is passed two parameters: | ||
* {webpack.compilation.Compilation} compilation - The webpack Compilation instance. | ||
* {CompilationStatus} status - one of 'success', 'warning', or 'error' | ||
#### suppressSuccess | ||
@@ -66,2 +76,5 @@ Defines when success notifications are shown. Can be one of the following values: | ||
#### showDuration | ||
True to show the duration of a successful compilation, otherwise false (default). | ||
#### suppressWarning | ||
@@ -143,3 +156,3 @@ True to suppress the warning notifications, otherwise false (default). | ||
* ~~Port to TypeScript~~ (completed in v2.0.0) | ||
* Increase test coverage | ||
* ~~Increase test coverage~~ (completed in v2.0.0) | ||
@@ -146,0 +159,0 @@ Notes |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
111809
414
1
167
+ Addedis-docker@2.2.1(transitive)
+ Addedis-wsl@2.2.0(transitive)
+ Addednode-notifier@6.0.0(transitive)
+ Addedsemver@6.3.1(transitive)
- Removedis-wsl@1.1.0(transitive)
- Removednode-notifier@5.4.0(transitive)
- Removedsemver@5.7.2(transitive)
Updatednode-notifier@6.0.0