bell-on-bundler-error-plugin
Advanced tools
Comparing version 2.0.0 to 3.0.0
28
index.js
@@ -1,2 +0,1 @@ | ||
// Copyright 2015-2016 Stanislav Senotrusov | ||
@@ -16,11 +15,30 @@ // | ||
function BellOnBundlerErrorPlugin () { } | ||
function BellOnBundlerErrorPlugin() {} | ||
BellOnBundlerErrorPlugin.prototype.apply = function(compiler) { | ||
if (typeof(process) !== 'undefined'){ | ||
compiler.plugin('done', function(stats) { if (stats.hasErrors()) process.stderr.write('\x07') }) | ||
compiler.plugin('failed', function(err) { process.stderr.write('\x07') }) | ||
if (typeof process === 'undefined') { | ||
return | ||
} | ||
var doneFunc = function(stats) { | ||
if (stats.hasErrors()) { | ||
process.stderr.write('\x07') | ||
} | ||
} | ||
var failedFunc = function(err) { | ||
process.stderr.write('\x07') | ||
} | ||
if (compiler.hooks) { | ||
var plugin = { name: 'BellOnBundlerErrorPlugin' } | ||
compiler.hooks.done.tap(plugin, doneFunc) | ||
compiler.hooks.failed.tap(plugin, failedFunc) | ||
} else { | ||
compiler.plugin('done', doneFunc) | ||
compiler.plugin('failed', failedFunc) | ||
} | ||
} | ||
module.exports = BellOnBundlerErrorPlugin |
{ | ||
"name": "bell-on-bundler-error-plugin", | ||
"version": "2.0.0", | ||
"version": "3.0.0", | ||
"description": "Get notification on bundler build errors. On that occasion, a bell character will be written to STDERR output.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
15278
36
7