UNPKG

twreporter-react

Version:

React-Redux site for The Reporter Foundation in Taiwan

55 lines (43 loc) 932 B
// outputs webpack stats to console if there are no errors or warnings import colors from 'colors/safe' function error(error) { // BELLs when something goes wrong! console.log("\x07" + error) } function warning(warning) { console.log(warning) } let first_run = true let was_faulty = false export default 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(colors.green('~ Webpack build status: OK ~')) was_faulty = false } if (verbose || first_run) { console.log(stats.toString ({ chunks: false, colors: true })) first_run = false } }