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.6.0 to 0.6.1

19

examples/gulpfile.js

@@ -85,1 +85,20 @@

gulp.task("customError", function () {
var custom = notify.withReporter(function (options, callback) {
console.log("Title:", options.title);
console.log("Message:", options.message);
callback();
});
gulp.src("../test/fixtures/*")
.pipe(through.obj(function (file, enc, callback) {
this.emit("error", new Error("Something happend: Error message!"));
callback();
}))
.on("error", custom.onError('Error: <%= error.message %>'))
.on("error", function (err) {
console.log("Error:", err);
})
});

29

index.js

@@ -55,6 +55,5 @@ var through = require("through2"),

module.exports.onError = function (options) {
var onError = module.exports.onError = function (options) {
options = options || {};
var reporter = options.notifier || notifier.notify;
return function (error) {

@@ -67,3 +66,4 @@ report(reporter, error, options);

if (!reporter) throw new gutil.PluginError("gulp-notify", "No custom reporter defined.");
return function (options) {
var inner = function (options) {
options = options || {};

@@ -80,2 +80,17 @@

};
inner.onError = function (options) {
options = options || {};
if (typeof options !== "object") {
options = {
message: options
};
}
options.notifier = reporter;
return onError(options);
}
return inner;
};

@@ -87,7 +102,9 @@

function logError (options) {
function logError (options, color) {
if (!logger) return;
color = color || 'red';
if (!gutil.colors[color]) return;
logger(gutil.colors.cyan('gulp-notify') + ':',
'[' + gutil.colors.blue(options.title) + ']',
gutil.colors.red(options.message)
gutil.colors[color].call(gutil.colors, options.message)
);

@@ -104,3 +121,3 @@ }

var options = constructOptions(options, message, templateOptions);
logError(options);
logError(options, message instanceof Error ? "red" : "green");
reporter(options, function (err) {

@@ -107,0 +124,0 @@ if (err) return callback(new gutil.PluginError("gulp-notify", err));

{
"name": "gulp-notify",
"version": "0.6.0",
"version": "0.6.1",
"description": "A plugin for Gulp to send messages to Mac Notification Center or Linux' notify-send",

@@ -5,0 +5,0 @@ "keywords": [

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

# `v0.6.2`
1. Added `.onError` method on object created by `withReporter`
# `v0.6.1`
1. Added colored logging on success / error
# `v0.5.0`

@@ -264,0 +270,0 @@

@@ -347,2 +347,8 @@ /*global describe, it*/

it('should have onError event withReporter', function(done) {
var notifier = notify.withReporter(mockGenerator);
should.exist(notifier.onError);
done();
});
it('should be limited by notifying on error if th onError-option is passed', function (done) {

@@ -371,2 +377,24 @@ var

it('should have onError options on withReporter sugar', function (done) {
var custom = notify.withReporter(mockGenerator(function (opts) {
should.exist(opts);
should.exist(opts.title);
should.exist(opts.message);
String(opts.message).should.equal(testMessage);
String(opts.title).should.equal("Error running Gulp");
done();
}));
var
testMessage = "tester",
srcFile = join(__dirname, "./fixtures/*");
gulp.src(srcFile)
.pipe(through.obj(function (file, enc, cb) {
this.emit("error", new gutil.PluginError("testPlugin", testMessage));
cb();
}))
.on("error", custom.onError())
});
it('should handle streamed files', function (done) {

@@ -373,0 +401,0 @@ var expectedFile = new gutil.File({

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