Socket
Socket
Sign inDemoInstall

node-notifier

Package Overview
Dependencies
38
Maintainers
1
Versions
73
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.2.3 to 4.3.0

48

bin.js

@@ -24,18 +24,42 @@ #!/usr/bin/env node

var options = getOptionsIfExists(Object.keys(aliases), argv);
if (!options.message) {
// Do not show an empty message
process.exit(0);
}
notifier.notify(options, function (err, msg) {
if (err) {
console.error(err.message);
process.exit(1);
var passedOptions = getOptionsIfExists(Object.keys(aliases), argv);
var stdinMessage = '';
process.stdin.on('readable', function(){
var chunk = this.read();
if (!chunk && !stdinMessage) {
doNotification(passedOptions);
this.end();
return;
}
if (!chunk) return;
stdinMessage += chunk.toString();
});
if (!msg) return;
console.log(msg);
process.exit(0);
process.stdin.on('end', function(){
if (stdinMessage) {
passedOptions.message = stdinMessage;
}
doNotification(passedOptions);
});
function doNotification (options) {
if (!options.message) {
// Do not show an empty message
process.exit(0);
}
notifier.notify(options, function (err, msg) {
if (err) {
console.error(err.message);
process.exit(1);
}
if (!msg) return;
console.log(msg);
process.exit(0);
});
}
function getOptionsIfExists(optionTypes, argv) {

@@ -42,0 +66,0 @@ var options = {};

Changelog
===
### `v4.3.0`
1. Adds support for piping messages in to CLI.
```shell
➜ echo "Message" | ./bin.js
➜ echo "Message" | ./bin.js -t "My Title"
➜ echo "Some message" | ./bin.js -t "My Title" -s
```
### `v4.2.3`

@@ -5,0 +14,0 @@ 1. Fixed input arguments to CLI to be strings where they should be strings.

{
"name": "node-notifier",
"version": "4.2.3",
"version": "4.3.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",

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

Notification Center for Mac, notify-osd for Linux, Toasters for
Windows 8, or lovely taskbar Balloons for earlier Windows versions. If none of
Windows 8/10, or lovely taskbar Balloons for earlier Windows versions. If none of
these requirements are met, be it older version of Windows or OS X,

@@ -175,2 +175,7 @@ Growl is used.

**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)
> 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)
[toaster](https://github.com/nels-o/toaster) is used to get native Windows Toasts!

@@ -177,0 +182,0 @@

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