twreporter-react
Version:
React-Redux site for The Reporter Foundation in Taiwan
58 lines (42 loc) • 1.21 kB
JavaScript
// outputs webpack stats to console if there are no errors or warnings
;
exports.__esModule = true;
exports['default'] = notify_stats;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _colorsSafe = require('colors/safe');
var _colorsSafe2 = _interopRequireDefault(_colorsSafe);
function error(error) {
// BELLs when something goes wrong!
console.log('\u0007' + error);
}
function warning(warning) {
console.log(warning);
}
var first_run = true;
var was_faulty = false;
function notify_stats(stats, json, verbose) {
// if there were any errors
if (json.errors.length > 0) {
was_faulty = true;
return json.errors.forEach(error);
}
// if there were any warnings
if (json.warnings.length > 0) {
json.warnings.forEach(warning);
}
// if it's ok
if (!verbose && !first_run && was_faulty) {
// green colour
console.log(_colorsSafe2['default'].green('~ Webpack build status: OK ~'));
was_faulty = false;
}
if (verbose || first_run) {
console.log(stats.toString({
chunks: false,
colors: true
}));
first_run = false;
}
}
module.exports = exports['default'];
//# sourceMappingURL=notify stats.js.map