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

gulp-notify

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-notify - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

25

index.js

@@ -1,2 +0,2 @@

var through = require("through"),
var through = require("through2"),
path = require("path"),

@@ -15,3 +15,3 @@ gutil = require("gulp-util"),

function notify (file) {
function notify (file, enc, callback) {
var stream = this;

@@ -24,5 +24,6 @@ stream.pause();

} else {
stream.emit("data", file);
stream.push(file);
}
stream.resume();
callback();
});

@@ -32,21 +33,25 @@ }

if (!options.onLast) {
return through(notify);
return through.obj(notify);
}
// Only send notification on the last file.
return through(function (file) {
return through.obj(function (file, enc, callback) {
lastFile = file;
this.emit("data", file)
}, function () {
this.push(file);
callback();
}, function (callback) {
var stream = this;
if (!lastFile) {
return stream.emit("end");
return callback();
}
report(reporter, lastFile, options, function (err, file) {
if (err) stream.emit("error", err);
if (err) {
stream.emit("error", err);
return callback();
}
});
lastFile = null; // reset
stream.emit("end");
return callback();
});

@@ -53,0 +58,0 @@ };

4

package.json
{
"name": "gulp-notify",
"version": "0.2.0",
"version": "0.3.0",
"description": "A plugin for Gulp to send messages to Mac Notification Center",

@@ -30,3 +30,3 @@ "keywords": [

"node-notifier": ">=1.0.0-beta2",
"through": ">=2.3.4"
"through2": "~0.4.0"
},

@@ -33,0 +33,0 @@ "devDependencies": {

@@ -79,2 +79,19 @@ # gulp-notify [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][depstat-image]][depstat-url]

### notify.onError()
Same API as using `notify()`, but instead of being passed `vinyl File` an
error object gets sent.
Example:
```javascript
gulp.src("../test/fixtures/*")
.pipe(through(function () {
this.emit("error", "Something happend: Error message!")
}))
.on("error", notify.onError(function (error) {
return "Message to the notifier: " + error.message;
}));
```
## License

@@ -81,0 +98,0 @@

@@ -6,3 +6,3 @@ /*global describe, it*/

should = require('should'),
through = require('through'),
through = require('through2'),
gutil = require('gulp-util'),

@@ -237,16 +237,17 @@ join = require('path').join,

instream
.pipe(through(function (file) {
.pipe(through.obj(function (file, enc, cb) {
numFilesBefore++;
this.emit("data", file);
}, function () {
this.push(file);
cb();
}, function (cb) {
numFilesBefore.should.equal(3);
this.emit("end");
cb();
}))
.pipe(outstream)
.pipe(through(function (file) {
.pipe(through.obj(function (file, enc, cb) {
numFilesAfter++;
this.emit("data", file);
}, function () {
this.push(file);
cb();
}, function (callback) {
numFilesAfter.should.equal(3);
this.emit("end");
done();

@@ -277,4 +278,5 @@ }));

gulp.src(srcFile)
.pipe(through(function (file) {
.pipe(through.obj(function (file, enc, cb) {
this.emit("error", new gutil.PluginError("testPlugin", testMessage));
cb();
}))

@@ -281,0 +283,0 @@ .on("error", onError)

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