/** * @param {object} config * @return {object} */ function updateConfig(config) { // Set verbose mode from config option or command line switch config.verbose = config.verbose || argv.verbose; // Setup logger *before* config validation (because validations may use logger to print warnings) setupLogger(config.logger, config.verbose); return config; }
/** * @param {string} header * @param {object} errors * @param {object} originalErrors * @param {'success'|'error'|'warning'} type */ function printErrors(header, errors, originalErrors, type) { printStatus(header, type); console.error(); const messages = argv.verbose ? originalErrors : errors; messages.forEach(message => { console.error(message.message || message); }); }
// Bundle gulp.task('bundle', function(cb) { var started = false; var config = require('./webpack.config.js'); var bundler = webpack(config); function bundle(err, stats) { if (err) { throw new $.util.PluginError('webpack', err); } if (argv.verbose) { $.util.log('[webpack]', stats.toString({colors: true})); } if (!started) { started = true; return cb(); } } if (watch) { bundler.watch(200, bundle); } else { bundler.run(bundle); } });
/** * @param {object} errors */ function printNoLoaderError(errors) { if (argv.verbose) { return; } const noLoaderError = errors.find(message => message.includes('You may need an appropriate loader') ); if (!noLoaderError) { return; } printErrorWithLink( noLoaderError, 'Learn how to add webpack loaders to your style guide:', consts.DOCS_WEBPACK ); process.exit(1); }
' %s:%d:%d: %s%s', result.filePath, message.line || 0, message.column || 0, message.message, argv.verbose ? ' (' + message.ruleId + ')' : ''