Socket
Socket
Sign inDemoInstall

webpack-build-notifier

Package Overview
Dependencies
10
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.1 to 1.2.2

jest.config.js

5

CHANGELOG.md
# Changelog
#### 1.2.2
###### _October 15, 2019_
- Updated node-notifier to fix [#43](/../../issues/43); added test coverage.
#### 1.2.1

@@ -4,0 +9,0 @@ ###### _October 15, 2019_

81

index.js

@@ -11,36 +11,4 @@ /**

var stripAnsi = require('strip-ansi');
var exec = require('child_process').exec;
var { exec, execFileSync } = require('child_process');
// ensure the SnoreToast appId is registered, which is needed for Windows Toast notifications
// this is necessary in Windows 8 and above, (Windows 10 post build 1709), where all notifications must be generated
// by a valid application.
// see: https://github.com/KDE/snoretoast, https://github.com/RoccoC/webpack-build-notifier/issues/20
var appName;
if (process.platform === 'win32') {
var os = require('os');
var versionParts = os.release().split('.');
var winVer = +(`${versionParts[0]}.${versionParts[1]}`)
if (winVer >= 6.2) {
// Windows version >= 8
var cp = require('child_process');
var snoreToast = path.join(require.resolve('node-notifier'), '../vendor/snoreToast/SnoreToast.exe');
try {
cp.execFileSync(
snoreToast,
[
'-appID',
'Snore.DesktopToasts',
'-install',
'SnoreToast.lnk',
snoreToast,
'Snore.DesktopToasts'
]
);
appName = 'Snore.DesktopToasts';
} catch (e) {
console.error("An error occurred while attempting to install the SnoreToast AppID!", e);
}
}
}
var WebpackBuildNotifierPlugin = function (cfg) {

@@ -198,2 +166,4 @@ cfg = cfg || {};

this.registerSnoreToast();
// add notification click handler to activate terminal window

@@ -214,3 +184,3 @@ notifier.on('click', this.onClick.bind(this));

WebpackBuildNotifierPlugin.prototype.activateTerminalWindow = function () {
if (os.platform() === 'darwin') {
if (process.platform === 'darwin') {
// TODO: is there a way to translate $TERM_PROGRAM into the application name

@@ -222,3 +192,3 @@ // to make this more flexible?

'osascript -e "tell application \\"$TERM\\" to activate"');
} else if (os.platform() === 'win32') {
} else if (process.platform === 'win32') {
// TODO: Windows platform

@@ -230,3 +200,3 @@ }

notifier.notify({
appName: appName,
appName: this.appName,
title: this.title,

@@ -284,3 +254,3 @@ message: 'Compilation started...',

Object.assign(this.notifyOptions, {
appName: appName,
appName: this.appName,
title: title,

@@ -322,2 +292,39 @@ message: stripAnsi(msg),

WebpackBuildNotifierPlugin.prototype.registerSnoreToast = function () {
// ensure the SnoreToast appId is registered, which is needed for Windows Toast notifications
// this is necessary in Windows 8 and above, (Windows 10 post build 1709), where all notifications must be generated
// by a valid application.
// see: https://github.com/KDE/snoretoast, https://github.com/RoccoC/webpack-build-notifier/issues/20
/* istanbul ignore else */
if (process.platform === 'win32') {
const versionParts = os.release().split('.');
const winVer = +(`${versionParts[0]}.${versionParts[1]}`);
/* istanbul ignore else */
if (winVer >= 6.2) {
// Windows version >= 8
const snoreToast = path.join(
require.resolve('node-notifier'),
'../vendor/snoreToast',
process.arch === 'x64' ? 'snoretoast-x64.exe' : 'snoretoast-x86.exe'
);
try {
execFileSync(
snoreToast,
[
'-appID',
'Snore.DesktopToasts',
'-install',
'SnoreToast.lnk',
snoreToast,
'Snore.DesktopToasts'
]
);
this.appName = 'Snore.DesktopToasts';
} catch (e) {
console.error('An error occurred while attempting to install the SnoreToast AppID!', e);
}
}
}
};
module.exports = WebpackBuildNotifierPlugin;
{
"name": "webpack-build-notifier",
"version": "1.2.1",
"version": "1.2.2",
"description": "A Webpack plugin that generates OS notifications for build steps using node-notifier.",

@@ -9,5 +9,5 @@ "main": "index.js",

"lint": "eslint index.js",
"lint:fix": "eslint --fix index.js",
"test": "jest --runInBand --verbose --coverage --collectCoverageFrom=index.js",
"test:ci": "jest --coverage --collectCoverageFrom=index.js --coverageReporters=text-lcov | coveralls",
"lint:fix": "npm run lint -- --fix",
"test": "jest",
"test:ci": "jest --coverageReporters=text-lcov | coveralls",
"test-watch": "jest --runInBand --watch"

@@ -32,16 +32,16 @@ },

"dependencies": {
"ansi-regex": "4.1.0",
"ansi-regex": "5.0.0",
"strip-ansi": "5.2.0",
"node-notifier": "5.4.3"
"node-notifier": "6.0.0"
},
"devDependencies": {
"@babel/core": "^7.4.5",
"@babel/preset-env": "^7.4.5",
"@babel/core": "^7.6.4",
"@babel/preset-env": "^7.6.3",
"@types/node-notifier": "^5.4.0",
"@types/webpack": "^4.4.32",
"babel-eslint": "^10.0.1",
"eslint": "^5.16.0",
"jest": "^24.8.0",
"webpack": "^4.33.0"
"@types/webpack": "^4.39.3",
"babel-eslint": "^10.0.3",
"eslint": "^6.5.1",
"jest": "^24.9.0",
"webpack": "^4.41.2"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc