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 4.3.1 to 4.4.0

10

CHANGELOG.md
Changelog
===
### `v4.4.0`
1. Changes to exec terminal-notifier through execFile to allow for asar-packages
2. Adds support for remote growl server
3. Adds support for win7 with electron asar-package
### `v4.3.1`
Obligatory patch fix:
1. Adds new stdin CLI options to docs
### `v4.3.0`

@@ -5,0 +15,0 @@ 1. Adds support for piping messages in to CLI.

11

lib/checkGrowl.js
var net = require('net');
var hasGrowl = false;
var port = 23053;
module.exports = function (cb) {
module.exports = function (growlConfig, cb) {
if (typeof cb == 'undefined') {
cb = growlConfig;
growlConfig = {};
}
if (hasGrowl) return cb(hasGrowl);
var socket = net.connect(port);
var port = growlConfig.port || 23053;
var host = growlConfig.host || 'localhost';
var socket = net.connect(port, host);
socket.setTimeout(100);

@@ -10,0 +15,0 @@

@@ -31,2 +31,3 @@ /**

Growl = require('./growl'),
os = require('os'),
cloneDeep = require('lodash.clonedeep');

@@ -83,3 +84,3 @@

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

@@ -101,7 +102,10 @@

function doNotification (options, notifierOptions, callback) {
var is64Bit = os.arch() === 'x64';
options = options || {};
options = utils.mapToNotifu(options);
options.p = options.p || 'Node Notification:';
var localNotifier = notifierOptions.customPath || notifier;
var fullNotifierPath = notifier + (is64Bit ? '64' : '') + '.exe';
var localNotifier = notifierOptions.customPath || fullNotifierPath;
if (!options.m) {

@@ -108,0 +112,0 @@ callback(new Error('Message is required.'));

@@ -5,3 +5,3 @@ /**

var utils = require('../lib/utils'),
checkGrowl = require('../lib/checkGrowl');
checkGrowl = require('../lib/checkGrowl'),
growly = require('growly'),

@@ -64,3 +64,3 @@ cloneDeep = require('lodash.clonedeep');

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

@@ -67,0 +67,0 @@ if (!didHaveGrowl) return callback(new Error(errorMessageNotFound));

@@ -62,3 +62,3 @@ /**

if(utils.isMountainLion()) {
utils.command(this.options.customPath || notifier, argsList, actionJackedCallback);
utils.fileCommand(this.options.customPath || notifier, argsList, actionJackedCallback);
return this;

@@ -65,0 +65,0 @@ }

{
"name": "node-notifier",
"version": "4.3.1",
"version": "4.4.0",
"description": "A Node.js module for sending notifications on native Mac, Windows (post and pre 8) and Linux (or Growl as fallback)",

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

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

## Electron Packaging
If packaging your Electron app as an asar, you will find that node-notifier will fail to load. Due to the way asar works, you cannot execute a binary from within asar. As a simple solution, when packaging the app into an asar please make sure you --unpack the vendor folder of node-notifier so the module still has access to the notification binaries. To do this, you can do so by using the following command:
```bash
asar pack . app.asar --unpack "./node_modules/node-notifier/vendor/**"
```
## Documentation

@@ -109,0 +116,0 @@

@@ -12,2 +12,3 @@ var Notify = require('../notifiers/balloon')

this.originalType = os.type;
this.originalArch = os.arch;
os.type = function () {

@@ -21,4 +22,47 @@ return "Windows_NT";

os.type = this.originalType;
os.arch = this.originalArch;
});
it('should use 64 bit notifu', function (done) {
os.arch = function () {
return "x64";
};
var expected = 'notifu64.exe';
utils.immediateFileCommand = function (notifier, argsList, callback) {
notifier.should.endWith(expected);
done();
};
var notifier = new Notify();
notifier.notify({
title: "title",
message: "body"
}, function (err) {
should.not.exist(err);
})
});
it('should use 32 bit notifu if 32 arch', function (done) {
os.arch = function () {
return "ia32";
};
var expected = 'notifu.exe';
utils.immediateFileCommand = function (notifier, argsList, callback) {
notifier.should.endWith(expected);
done();
};
var notifier = new Notify();
notifier.notify({
title: "title",
message: "body"
}, function (err) {
should.not.exist(err);
})
});
it('should pass on title and body', function (done) {

@@ -25,0 +69,0 @@ var expected = [ '-m', 'body', '-p', 'title', '-q' ];

@@ -10,3 +10,3 @@ var NotificationCenter = require('../notifiers/notificationcenter')

var notifier = null;
var originalUtils = utils.command;
var originalUtils = utils.fileCommand;
var originalMacVersion = utils.isMountainLion;

@@ -85,3 +85,3 @@ var originalType = os.type;

beforeEach(function () {
utils.command = function (n, o, cb) {
utils.fileCommand = function (n, o, cb) {
cb(null, "");

@@ -92,3 +92,3 @@ }

after(function () {
utils.command = originalUtils;
utils.fileCommand = originalUtils;
});

@@ -122,3 +122,3 @@

it('should be able to list all notifications', function(done){
utils.command = function (n, o, cb) {
utils.fileCommand = function (n, o, cb) {
cb(null, fs.readFileSync(__dirname + '/fixture/listAll.txt').toString());

@@ -137,3 +137,3 @@ };

it('should be able to remove all messages', function(done){
utils.command = function (n, o, cb) {
utils.fileCommand = function (n, o, cb) {
cb(null, fs.readFileSync(__dirname + '/fixture/removeAll.txt').toString());

@@ -147,3 +147,3 @@ }

utils.command = function (n, o, cb) {
utils.fileCommand = function (n, o, cb) {
cb(null, "");

@@ -164,7 +164,7 @@ }

before(function () {
this.original = utils.command;
this.original = utils.fileCommand;
});
after(function () {
utils.command = this.original;
utils.fileCommand = this.original;
});

@@ -175,3 +175,3 @@

utils.command = function (notifier, argsList, callback) {
utils.fileCommand = function (notifier, argsList, callback) {
argsList.should.eql(expected);

@@ -199,3 +199,3 @@ done();

utils.command = function (notifier, argsList, callback) {
utils.fileCommand = function (notifier, argsList, callback) {
argsList.should.eql(expected);

@@ -202,0 +202,0 @@ done();

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