Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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());
function onError(err) {
notify({
title: 'Gulp Task Error',
subtitle: 'Plugin: <%= error.plugin %>',
message: 'Check the console.'
}).write(err);
console.error(err.toString());
this.emit('end');
}
function rebundle() {
const bundle = bundler.bundle();
if (!dieOnError) {
bundle.on('error', notify.onError({
title : 'Browserify Error',
sound : 'Sosumi',
wait : false
}));
}
return bundle
.pipe(sourceStream(dest))
.pipe(buffer())
.pipe(sourcemaps.init({ loadMaps : true}))
.pipe(notify({
title : 'Finished compiling Javascript',
message : '<%= file.relative %>',
sound : 'Glass',
wait : false
}))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('./build'))
.pipe(filter([ '*', '!*.map' ]))
.pipe(livereload());
}
message(message) {
notify.logLevel(0);
return notify({
title: this.title,
message: message,
icon: __dirname + '/../icons/laravel.png',
onLast: true
});
}
.on('error', handleErrors)
.pipe(plumber({errorHandler: handleErrors}))
.pipe(rollup({
input: `${src}/${input}`,
format: 'es',
globals: {
jquery: 'jQuery'
}
}))
.pipe(header(config.banner))
.pipe(rename({
basename: config.name,
suffix: '.es'
}))
.pipe(gulp.dest(dest))
.pipe(notify({
title: config.notify.title,
message: message,
onLast: true
}));
};
}
.pipe(plumber({errorHandler: handleErrors}))
.pipe(rollup({
input: `${src}/${input}`,
format: 'es',
globals: dependencies,
external: [
'jquery'
]
}))
.pipe(header(config.banner))
.pipe(rename({
basename: config.name,
suffix: '.es'
}))
.pipe(gulp.dest(dest))
.pipe(notify({
title: config.notify.title,
message: message,
onLast: true
}));
};
}
static forPassedTests(framework) {
return notify({
title: 'Green!',
message: `Your ${framework} tests passed!`,
icon: `${__dirname}/../icons/pass.png`,
onLast: true
});
}
.pipe(cssnano({
safe: true,
autoprefixer: false
}))
.pipe(header(config.banner))
.pipe(gulpif(
createSourcemap,
sourcemaps.write(config.deploy ? './' : null))
)
.pipe(gulp.dest(dest))
.pipe(size({
title: 'minified styles',
showFiles: true
}))
.pipe(browser.stream())
.pipe(notify({
title: config.notify.title,
message: message,
onLast: true
}));
};
}
gulp.task('copy', () => {
return gulp
.src(`${config.assets.source}/**/*`)
.pipe(gulp.dest(`${config.assets.build}`))
.pipe(browser.stream())
.pipe(
gulpif(
config.enable.notify,
notify({
title: config.notify.title,
message: 'Copy task complete',
onLast: true,
})
)
);
});