File tree Expand file tree Collapse file tree 3 files changed +21
-3
lines changed
Expand file tree Collapse file tree 3 files changed +21
-3
lines changed Original file line number Diff line number Diff line change 1+ {
2+ "dependencies" : {
3+ "npm" : " 3.10.8"
4+ },
5+ "description" : " Temporary file generated by the NPMX tool" ,
6+ "name" : " local-npm-install" ,
7+ "private" : true ,
8+ "version" : " 0.0.0"
9+ }
Original file line number Diff line number Diff line change @@ -49,6 +49,9 @@ export interface IBuildConfig {
4949 /** Build a full production build. */
5050 production ?: boolean ;
5151
52+ /** Show warnings as errors (write them in red vs yellow to stderr, and fail the build) */
53+ showWarningsAsErrors ?: boolean ;
54+
5255 /** Arguments passed in. */
5356 args ?: { [ name : string ] : string | boolean } ;
5457
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ const prettyTime = require('pretty-hrtime');
88/* tslint:enable:typedef */
99import * as state from './State' ;
1010import { getFlagValue } from './config' ;
11+ import { getConfig } from './index' ;
1112
1213const WROTE_ERROR_KEY : string = '__gulpCoreBuildWroteError' ;
1314
@@ -54,7 +55,7 @@ let globalInstance: any = global as any;
5455const localCache : ILocalCache = globalInstance . __loggingCache = globalInstance . __loggingCache || {
5556 warnings : [ ] ,
5657 errors : [ ] ,
57- testsRun : 0 ,
58+ testsRun : 0 , ;
5859 subTasksRun : 0 ,
5960 testsPassed : 0 ,
6061 testsFailed : 0 ,
@@ -442,8 +443,13 @@ export function warn(...args: Array<string | Chalk.ChalkChain>): void {
442443 const stringMessage : string = args . join ( ' ' ) ;
443444
444445 if ( ! localCache . errorAndWarningSupressions [ stringMessage ] ) {
445- localCache . warnings . push ( stringMessage ) ;
446- log ( gutil . colors . yellow . apply ( undefined , args ) ) ;
446+ if ( getConfig ( ) . showWarningsAsErrors ) {
447+ localCache . errors . push ( stringMessage ) ;
448+ log ( gutil . colors . red . apply ( undefined , args ) ) ;
449+ } else {
450+ localCache . warnings . push ( stringMessage ) ;
451+ log ( gutil . colors . yellow . apply ( undefined , args ) ) ;
452+ }
447453 }
448454}
449455
You can’t perform that action at this time.
0 commit comments