Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
error(e, message) {
notify.onError({
title: this.title,
message: message + ': <%= error.message %>',
icon: __dirname + '/../icons/fail.png',
onLast: true
})(e);
// We'll spit out the error, just in
// case it is useful for the user.
console.log(e);
}
notifyError(error, watching = false) {
let lineNumber = (error.lineNumber) ? `Line ${error.lineNumber} -- ` : ''
let taskName = error.task || this.taskName()
notify({
title: `Task [${taskName}] Failed in [${error.plugin}]`,
message: `${lineNumber}See console.`,
sound: 'Sosumi' // See: https://github.com/mikaelbr/node-notifier#all-notification-options-with-their-defaults
}).write(error)
let tag = Util.colors.black.bgRed
let report = `
${tag(' Task:')} [${Util.colors.cyan(taskName)}]
${tag(' Plugin:')} [${error.plugin}]
${tag(' Error:')}
${error.message}`
if (error.lineNumber) {
report += `${tag(' Line:')} ${error.lineNumber}\n`
}
let reportError = function(error) {
let lineNumber = error.lineNumber ? 'LINE ' + error.lineNumber + ' -- ' : '';
notify({
title: 'Task Failed [' + error.plugin + ']',
message: lineNumber + 'See console.',
sound: true
// the version below probably works on OSX
//sound: 'Sosumi' // See: https://github.com/mikaelbr/node-notifier#all-notification-options-with-their-defaults
}).write(error);
//gutil.beep(); // Beep 'sosumi' again
// Inspect the error object
//gutil.log(error);
// Easy error reporting
//console.log(error.toString());
var handleError = function (error) {
var lineNumber = (error.lineNumber) ? 'LINE ' + error.lineNumber + ' -- ' : '';
notify({
title: 'Task Failed [' + error.plugin + ']',
message: lineNumber + 'See console.'
}, notify.logLevel(0)).write(error);
// Inspect the error object
//console.log(error);
// Easy error reporting
//console.log(error.toString());
// Pretty error reporting
var report = '';
report += chalk.white.bgRed('TASK:') + ' [' + error.plugin + ']\n';
report += chalk.white.bgRed('ERROR:') + ' ' + error.message + '\n';
if (error.lineNumber) { report += chalk.red('LINE:') + ' ' + error.lineNumber + '\n'; }
if (error.fileName) { report += chalk.red('FILE:') + ' ' + error.fileName + '\n'; }
console.error(report);
'use strict';
/**
* Module dependencies
*/
var fs = require('fs'),
path = require('path'),
notify = require('gulp-notify');
// don't need duplicated error messages
notify.logLevel(0);
// load the tasks
fs.readdirSync('./config/gulp/tasks/')
.filter(function (name) {
return /(\.(js)$)/i.test(path.extname(name));
})
.forEach(function (task) {
require(path.resolve('./config/gulp/tasks/', task));
});
export default function processMarkup() {
return gulp.src(project.markupProcessor.source)
.pipe(plumber({errorHandler: notify.onError('Error: <%= error.message %>')}))
.pipe(changedInPlace({firstPass:true}))
.pipe(htmlmin({
removeComments: true,
collapseWhitespace: true,
minifyCSS: true,
minifyJS: true,
ignoreCustomFragments: [/\${.*?}/g] // ignore interpolation expressions
}))
.pipe(build.bundle());
}
gulp.task('watch-client', function() {
return gulp.watch('client/**/*.js', ['compile-client', 'build-dev-client']);
});
gulp.task('clean', () => {
return del(['dist']);
});
gulp.task('default', ['compile', 'build', 'watch']);
gulp.task('release', ['compile', 'build-release']);
// avoid logging to the console
// that we created a notification
notify_.logLevel(0);
// notification helper
function notify(msg) {
return notify_({
title: 'AFTR',
message: msg,
icon: false,
onLast: true,
});
}
gulp.task('stop-chromedriver', () => {
try {
if (isWindows) {
childProcess.execSync('taskkill /im chromedriver* /t /f', { stdio: 'ignore' })
} else {
childProcess.execSync('pkill chromedriver', { stdio: 'ignore' })
}
} catch(ex) {
// Do nothing
}
})
// avoid logging to the console
// that we created a notification
notify_.logLevel(0)
// notification helper
function notify (msg) {
return notify_({
title: '▲ Next',
message: msg,
icon: false,
onLast: true
})
}
if (typeof appName === 'undefined') {
appName = 'Gulp';
}
applicationOptions = util._extend({
icon: fs.readFileSync(__dirname + '/gulp.png')
}, applicationOptions || {});
var app = new growler.GrowlApplication(appName, applicationOptions);
app.setNotifications({
Gulp: {}
});
var reporter = notify.withReporter(function(notificationOptions, callback) {
app.register(function(success, err) {
if (!success) {
return callback(err);
}
// Rename 'message' property to 'text'
notificationOptions.text = notificationOptions.message;
delete notificationOptions.message;
app.sendNotification('Gulp', notificationOptions, function(success, err) {
return callback(err, success);
});
});
var showError = function (err) {
var file = err.file.replace(dir(config.dirs.css), '');
notifier.notify({
'title': 'SASS error',
'message': err.message + " at " + file
});
con.custom(chalk.red.bold('SASS error: ') + err.message);
/* Don't show the full size of the path in the error */
con.custom(chalk.red.bold('File: ') + file);
con.custom(chalk.red.bold('Position: ') + 'Line:' + err.line + ' Column:' + err.column);
};