Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-notifier

Package Overview
Dependencies
Maintainers
1
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-notifier - npm Package Compare versions

Comparing version 5.1.2 to 5.2.0

.prettierrc

6

lib/checkGrowl.js

@@ -9,3 +9,3 @@ var net = require('net');

}
if (hasGrowl) return cb(hasGrowl);
if (hasGrowl) return cb(null, hasGrowl);
var port = growlConfig.port || 23053;

@@ -18,3 +18,3 @@ var host = growlConfig.host || 'localhost';

socket.end();
cb(true);
cb(null, true);
});

@@ -24,4 +24,4 @@

socket.end();
cb(false);
cb(null, false);
});
};

@@ -31,2 +31,3 @@ var shellwords = require('shellwords');

t: 'expire-time',
time: 'expire-time',
e: 'expire-time',

@@ -46,3 +47,3 @@ expire: 'expire-time',

notifier = shellwords.escape(notifier);
if (process.env.DEBUG) {
if (process.env.DEBUG && process.env.DEBUG.indexOf('notifier') !== -1) {
console.info('node-notifier debug info (command):');

@@ -53,13 +54,14 @@ console.info('[notifier path]', notifier);

return cp.exec(
notifier + ' ' + options.join(' '),
function(error, stdout, stderr) {
if (error) return cb(error);
cb(stderr, stdout);
}
);
return cp.exec(notifier + ' ' + options.join(' '), function(
error,
stdout,
stderr
) {
if (error) return cb(error);
cb(stderr, stdout);
});
};
module.exports.fileCommand = function(notifier, options, cb) {
if (process.env.DEBUG) {
if (process.env.DEBUG && process.env.DEBUG.indexOf('notifier') !== -1) {
console.info('node-notifier debug info (fileCommand):');

@@ -77,3 +79,3 @@ console.info('[notifier path]', notifier);

module.exports.fileCommandJson = function(notifier, options, cb) {
if (process.env.DEBUG) {
if (process.env.DEBUG && process.env.DEBUG.indexOf('notifier') !== -1) {
console.info('node-notifier debug info (fileCommandJson):');

@@ -97,3 +99,3 @@ console.info('[notifier path]', notifier);

module.exports.immediateFileCommand = function(notifier, options, cb) {
if (process.env.DEBUG) {
if (process.env.DEBUG && process.env.DEBUG.indexOf('notifier') !== -1) {
console.info('node-notifier debug info (notifier):');

@@ -103,3 +105,3 @@ console.info('[notifier path]', notifier);

notifierExists(notifier, function(exists) {
notifierExists(notifier, function(_, exists) {
if (!exists) {

@@ -115,3 +117,3 @@ return cb(new Error('Notifier (' + notifier + ') not found on system.'));

return fs.stat(notifier, function(err, stat) {
if (!err) return cb(stat.isFile());
if (!err) return cb(err, stat.isFile());

@@ -121,3 +123,3 @@ // Check if Windows alias

// Has extentioon, no need to check more
return cb(false);
return cb(err, false);
}

@@ -127,4 +129,4 @@

return fs.stat(notifier + '.exe', function(err, stat) {
if (err) return cb(false);
cb(stat.isFile());
if (err) return cb(err, false);
cb(err, stat.isFile());
});

@@ -371,10 +373,4 @@ });

delete options.appName;
} else {
options.appID = ' ';
}
if (typeof options.appID === 'undefined') {
options.appID = ' ';
}
if (typeof options.remove !== 'undefined') {

@@ -421,3 +417,4 @@ options.close = options.remove;

if (
options.hasOwnProperty(key) && allowedToasterFlags.indexOf(key) === -1
options.hasOwnProperty(key) &&
allowedToasterFlags.indexOf(key) === -1
) {

@@ -489,14 +486,20 @@ delete options[key];

module.exports.isMountainLion = function() {
return os.type() === 'Darwin' &&
semver.satisfies(garanteeSemverFormat(os.release()), '>=12.0.0');
return (
os.type() === 'Darwin' &&
semver.satisfies(garanteeSemverFormat(os.release()), '>=12.0.0')
);
};
module.exports.isWin8 = function() {
return os.type() === 'Windows_NT' &&
semver.satisfies(garanteeSemverFormat(os.release()), '>=6.2.9200');
return (
os.type() === 'Windows_NT' &&
semver.satisfies(garanteeSemverFormat(os.release()), '>=6.2.9200')
);
};
module.exports.isLessThanWin8 = function() {
return os.type() === 'Windows_NT' &&
semver.satisfies(garanteeSemverFormat(os.release()), '<6.2.9200');
return (
os.type() === 'Windows_NT' &&
semver.satisfies(garanteeSemverFormat(os.release()), '<6.2.9200')
);
};

@@ -503,0 +506,0 @@

@@ -51,4 +51,3 @@ /**

function noop() {
}
function noop() {}
WindowsBalloon.prototype.notify = function(options, callback) {

@@ -86,3 +85,3 @@ var fallback;

!!this.options.withFallback &&
(!utils.isLessThanWin8() || hasGrowl === true)
(!utils.isLessThanWin8() || hasGrowl === true)
) {

@@ -98,3 +97,3 @@ fallback = fallback || new Growl(notifierOptions);

checkGrowl(notifierOptions, function(hasGrowlResult) {
checkGrowl(notifierOptions, function(_, hasGrowlResult) {
hasGrowl = hasGrowlResult;

@@ -113,3 +112,3 @@

var allowedArguments = [ 't', 'd', 'p', 'm', 'i', 'e', 'q', 'w', 'xp' ];
var allowedArguments = ['t', 'd', 'p', 'm', 'i', 'e', 'q', 'w', 'xp'];

@@ -116,0 +115,0 @@ function doNotification(options, notifierOptions, callback) {

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

var errorMessageNotFound = "Couldn't connect to growl (might be used as a fallback). Make sure it is running";
var errorMessageNotFound =
"Couldn't connect to growl (might be used as a fallback). Make sure it is running";

@@ -67,3 +68,3 @@ module.exports = Growl;

checkGrowl(growly, function(didHaveGrowl) {
checkGrowl(growly, function(_, didHaveGrowl) {
hasGrowl = didHaveGrowl;

@@ -77,3 +78,2 @@ if (!didHaveGrowl) return callback(new Error(errorMessageNotFound));

function noop() {
}
function noop() {}

@@ -15,5 +15,4 @@ /**

var FAILSAFE_TIMEOUT = 30 * 1000;
var errorMessageOsX = 'You need Mac OS X 10.8 or above to use NotificationCenter,' +
var errorMessageOsX =
'You need Mac OS X 10.8 or above to use NotificationCenter,' +
' or use Growl fallback with constructor option {withFallback: true}.';

@@ -45,4 +44,2 @@

}
var timeout;
callback = callback || noop;

@@ -60,6 +57,3 @@

options,
function() {
clearTimeout(timeout);
callback.apply(null, arguments);
},
callback,
function(data) {

@@ -90,3 +84,3 @@ if (activeId !== id) return false;

if (utils.isMountainLion()) {
var cp = utils.fileCommandJson(
utils.fileCommandJson(
this.options.customPath || notifier,

@@ -96,10 +90,2 @@ argsList,

);
// Redundancy fallback to prevent memory leak
timeout = setTimeout(
function() {
cp.kill('SIGTERM');
},
FAILSAFE_TIMEOUT
);
return this;

@@ -106,0 +92,0 @@ }

@@ -28,4 +28,3 @@ /**

function noop() {
}
function noop() {}
NotifySend.prototype.notify = function(options, callback) {

@@ -77,3 +76,3 @@ options = utils.clone(options || {});

var allowedArguments = [ 'urgency', 'expire-time', 'icon', 'category', 'hint' ];
var allowedArguments = ['urgency', 'expire-time', 'icon', 'category', 'hint'];

@@ -86,3 +85,3 @@ function doNotification(options, callback) {

initial = [ options.title, options.message ];
initial = [options.title, options.message];
delete options.title;

@@ -89,0 +88,0 @@ delete options.message;

@@ -28,4 +28,3 @@ /**

function noop() {
}
function noop() {}

@@ -78,3 +77,3 @@ var timeoutMessage = 'the toast has timed out';

typeof options.message === 'undefined' &&
typeof options.close === 'undefined'
typeof options.close === 'undefined'
) {

@@ -81,0 +80,0 @@ callback(new Error('Message or ID to close is required.'));

{
"name": "node-notifier",
"version": "5.1.2",
"description": "A Node.js module for sending notifications on native Mac, Windows (post and pre 8) and Linux (or Growl as fallback)",
"version": "5.2.0",
"description":
"A Node.js module for sending notifications on native Mac, Windows (post and pre 8) and Linux (or Growl as fallback)",
"main": "index.js",
"scripts": {
"precommit": "lint-staged",
"pretest": "npm run lint",

@@ -38,15 +40,23 @@ "test": "jest",

"devDependencies": {
"eslint": "^3.13.1",
"eslint-config-semistandard": "^7.0.0",
"eslint-config-standard": "^6.2.1",
"eslint-plugin-promise": "^3.4.0",
"eslint-plugin-standard": "^2.0.1",
"jest": "^18.1.0"
"eslint": "^4.15.0",
"eslint-config-semistandard": "^12.0.0",
"eslint-config-standard": "^11.0.0-beta.0",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-node": "^5.2.1",
"eslint-plugin-promise": "^3.6.0",
"eslint-plugin-standard": "^3.0.1",
"husky": "^0.14.3",
"jest": "^22.0.6",
"lint-staged": "^6.0.0",
"prettier": "^1.10.2"
},
"dependencies": {
"growly": "^1.3.0",
"semver": "^5.3.0",
"shellwords": "^0.1.0",
"which": "^1.2.12"
"semver": "^5.4.1",
"shellwords": "^0.1.1",
"which": "^1.3.0"
},
"lint-staged": {
"*.{js,json,css,md}": ["prettier --write", "git add"]
},
"bugs": {

@@ -53,0 +63,0 @@ "url": "https://github.com/mikaelbr/node-notifier/issues"

@@ -26,4 +26,4 @@ # node-notifier [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][depstat-image]][depstat-url]

notifier.notify({
'title': 'My notification',
'message': 'Hello, there!'
title: 'My notification',
message: 'Hello, there!'
});

@@ -33,10 +33,12 @@ ```

## Requirements
- **macOS**: >= 10.8 or Growl if earlier.
- **Linux**: `notify-osd` or `libnotify-bin` installed (Ubuntu should have this by default)
- **Windows**: >= 8, task bar balloon for Windows < 8. Growl as fallback. Growl takes precedence over Windows balloons.
- **General Fallback**: Growl
* **macOS**: >= 10.8 or Growl if earlier.
* **Linux**: `notify-osd` or `libnotify-bin` installed (Ubuntu should have this by default)
* **Windows**: >= 8, task bar balloon for Windows < 8. Growl as fallback. Growl takes precedence over Windows balloons.
* **General Fallback**: Growl
See [documentation and flow chart for reporter choice](./DECISION_FLOW.md)
## Install
```shell

@@ -46,2 +48,6 @@ npm install --save node-notifier

## CLI
CLI is moved to separate project: https://github.com/mikaelbr/node-notifier-cli
## Cross-Platform Advanced Usage

@@ -57,17 +63,20 @@

notifier.notify({
title: 'My awesome title',
message: 'Hello from node, Mr. User!',
icon: path.join(__dirname, 'coulson.jpg'), // Absolute path (doesn't work on balloons)
sound: true, // Only Notification Center or Windows Toasters
wait: true // Wait with callback, until user action is taken against notification
}, function (err, response) {
// Response is response from notification
});
notifier.notify(
{
title: 'My awesome title',
message: 'Hello from node, Mr. User!',
icon: path.join(__dirname, 'coulson.jpg'), // Absolute path (doesn't work on balloons)
sound: true, // Only Notification Center or Windows Toasters
wait: true // Wait with callback, until user action is taken against notification
},
function(err, response) {
// Response is response from notification
}
);
notifier.on('click', function (notifierObject, options) {
notifier.on('click', function(notifierObject, options) {
// Triggers if `wait: true` and user clicks notification
});
notifier.on('timeout', function (notifierObject, options) {
notifier.on('timeout', function(notifierObject, options) {
// Triggers if `wait: true` and notification closes

@@ -82,2 +91,3 @@ });

Example:
```javascript

@@ -98,3 +108,2 @@ const NotificationCenter = require('node-notifier/notifiers/notificationcenter');

new WindowsBalloon(options).notify();
```

@@ -123,3 +132,2 @@

### Usage NotificationCenter

@@ -133,3 +141,2 @@

#### Example

@@ -154,21 +161,24 @@

notifier.notify({
'title': void 0,
'subtitle': void 0,
'message': void 0,
'sound': false, // Case Sensitive string for location of sound file, or use one of macOS' native sounds (see below)
'icon': 'Terminal Icon', // Absolute Path to Triggering Icon
'contentImage': void 0, // Absolute Path to Attached Image (Content Image)
'open': void 0, // URL to open on Click
'wait': false, // Wait for User Action against Notification or times out. Same as timeout = 5 seconds
notifier.notify(
{
title: void 0,
subtitle: void 0,
message: void 0,
sound: false, // Case Sensitive string for location of sound file, or use one of macOS' native sounds (see below)
icon: 'Terminal Icon', // Absolute Path to Triggering Icon
contentImage: void 0, // Absolute Path to Attached Image (Content Image)
open: void 0, // URL to open on Click
wait: false, // Wait for User Action against Notification or times out. Same as timeout = 5 seconds
// New in latest version. See `example/macInput.js` for usage
timeout: 5, // Takes precedence over wait if both are defined.
closeLabel: void 0, // String. Label for cancel button
actions: void 0, // String | Array<String>. Action label or list of labels in case of dropdown
dropdownLabel: void 0, // String. Label to be used if multiple actions
reply: false // Boolean. If notification should take input. Value passed as third argument in callback and event emitter.
}, function(error, response, metadata) {
console.log(response, metadata);
});
// New in latest version. See `example/macInput.js` for usage
timeout: 5, // Takes precedence over wait if both are defined.
closeLabel: void 0, // String. Label for cancel button
actions: void 0, // String | Array<String>. Action label or list of labels in case of dropdown
dropdownLabel: void 0, // String. Label to be used if multiple actions
reply: false // Boolean. If notification should take input. Value passed as third argument in callback and event emitter.
},
function(error, response, metadata) {
console.log(response, metadata);
}
);
```

@@ -203,7 +213,14 @@

**Windows 10 Note:** You might have to activate banner notification for the toast to show.
From [mikaelbr/gulp-notify#90 (comment)](https://github.com/mikaelbr/gulp-notify/issues/90#issuecomment-129333034)
From [mikaelbr/gulp-notify#90 (comment)](https://github.com/mikaelbr/gulp-notify/issues/90#issuecomment-129333034)
> You can make it work by going to System > Notifications & Actions. The 'toast' app needs to have Banners enabled. (You can activate banners by clicking on the 'toast' app and setting the 'Show notification banners' to On)
**Windows 10 Fall Creators Update (Version 1709) Note:**
With the Fall Creators Update Notifications on Windows 10 will only work as expected if the correct appID is specified.
Your appID has to be exactly the same as registered with the install of your app.
You can find the ID of your App by searching the registry for the appID you specified at installation of your app. For example if you are using the squirrel framework your appID will be something like com.squirrel.your.app.
Default behaviour is to have the underlying toaster applicaton as appId. This works as expected, but shows `SnoreToast` as text in the notification.
[Snoretoast](https://github.com/KDE/snoretoast) is used to get native Windows Toasts!

@@ -219,15 +236,18 @@

notifier.notify({
title: void 0, // String. Required
message: void 0, // String. Required if remove is not defined
icon: void 0, // String. Absolute path to Icon
sound: false, // Bool | String (as defined by http://msdn.microsoft.com/en-us/library/windows/apps/hh761492.aspx)
wait: false, // Bool. Wait for User Action against Notification or times out
id: void 0, // Number. ID to use for closing notification.
appID: void 0, // String. App.ID and app Name. Defaults to empty string.
remove: void 0, // Number. Refer to previously created notification to close.
install: void 0 // String (path, application, app id). Creates a shortcut <path> in the start menu which point to the executable <application>, appID used for the notifications.
}, function(error, response) {
console.log(response);
});
notifier.notify(
{
title: void 0, // String. Required
message: void 0, // String. Required if remove is not defined
icon: void 0, // String. Absolute path to Icon
sound: false, // Bool | String (as defined by http://msdn.microsoft.com/en-us/library/windows/apps/hh761492.aspx)
wait: false, // Bool. Wait for User Action against Notification or times out
id: void 0, // Number. ID to use for closing notification.
appID: void 0, // String. App.ID and app Name. Defaults to no value, causing SnoreToast text to be visible.
remove: void 0, // Number. Refer to previously created notification to close.
install: void 0 // String (path, application, app id). Creates a shortcut <path> in the start menu which point to the executable <application>, appID used for the notifications.
},
function(error, response) {
console.log(response);
}
);
```

@@ -276,12 +296,15 @@

notifier.notify({
title: void 0,
message: void 0,
sound: false, // true | false.
time: 5000, // How long to show balloon in ms
wait: false, // Wait for User Action against Notification
type: 'info' // The notification type : info | warn | error
}, function(error, response) {
console.log(response);
});
notifier.notify(
{
title: void 0,
message: void 0,
sound: false, // true | false.
time: 5000, // How long to show balloon in ms
wait: false, // Wait for User Action against Notification
type: 'info' // The notification type : info | warn | error
},
function(error, response) {
console.log(response);
}
);
```

@@ -309,3 +332,3 @@

category: void 0,
hint: void 0,
hint: void 0
});

@@ -316,9 +339,6 @@ ```

## CLI
CLI is moved to separate project: https://github.com/mikaelbr/node-notifier-cli
## Thanks to OSS
`node-notifier` is made possible through Open Source Software. A very special thanks to all the modules `node-notifier` uses.
* [terminal-notifier](https://github.com/julienXX/terminal-notifier)

@@ -333,2 +353,6 @@ * [Snoretoast](https://github.com/KDE/snoretoast)

### `SnoreToast` text on Windows
See note on "Windows 10 Fall Creators Update" in Windows section. Short answer, update to your own `appId`.
### Use inside tmux session

@@ -352,3 +376,2 @@

### Using Webpack

@@ -365,3 +388,2 @@

## License

@@ -374,7 +396,5 @@

[npm-downloads]: http://img.shields.io/npm/dm/node-notifier.svg?style=flat
[travis-url]: http://travis-ci.org/mikaelbr/node-notifier
[travis-image]: http://img.shields.io/travis/mikaelbr/node-notifier.svg?style=flat
[depstat-url]: https://gemnasium.com/mikaelbr/node-notifier
[depstat-image]: http://img.shields.io/gemnasium/mikaelbr/node-notifier.svg?style=flat

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc