11const gulp = require ( "gulp" ) ;
22const eslint = require ( 'gulp-eslint' ) ;
33const tslint = require ( "gulp-tslint" ) ;
4- const gutil = require ( "gulp-util" ) ;
4+ const PluginError = require ( 'plugin-error' ) ;
5+ const log = require ( 'fancy-log' ) ;
56const ts = require ( "gulp-typescript" ) ;
67const sourcemaps = require ( "gulp-sourcemaps" ) ;
78const webpack = require ( "webpack" ) ;
8- const runSequence = require ( 'run-sequence' ) ;
99const del = require ( 'del' ) ;
10-
1110const fs = require ( "fs" ) ;
1211const fsp = require ( 'fs-plus' ) ;
1312const path = require ( "path" ) ;
@@ -16,8 +15,8 @@ const childProcess = require("child_process");
1615//...
1716gulp . task ( "tslint" , ( ) => {
1817 return gulp . src ( [ "**/*.ts" , "**/*.tsx" , "!**/*.d.ts" , "!node_modules/**" , "!./src/views/node_modules/**" ] )
19- . pipe ( tslint ( ) )
20- . pipe ( tslint . report ( ) ) ;
18+ . pipe ( tslint ( ) )
19+ . pipe ( tslint . report ( ) ) ;
2120} ) ;
2221
2322gulp . task ( "eslint" , ( ) => {
@@ -34,12 +33,12 @@ gulp.task("html-webpack", (done) => {
3433 const statsJson = stats . toJson ( ) ;
3534 if ( err || ( statsJson . errors && statsJson . errors . length ) ) {
3635 statsJson . errors . forEach ( webpackError => {
37- gutil . log ( gutil . colors . red ( `Error (webpack): ${ webpackError } ` ) ) ;
36+ log . error ( `Error (webpack): ${ webpackError } ` ) ;
3837 } ) ;
3938
40- throw new gutil . PluginError ( 'webpack' , JSON . stringify ( err || statsJson . errors ) ) ;
39+ throw new PluginError ( 'webpack' , JSON . stringify ( err || statsJson . errors ) ) ;
4140 }
42- gutil . log ( '[webpack]' , stats . toString ( ) ) ;
41+ log ( '[webpack]' , stats . toString ( ) ) ;
4342 done ( ) ;
4443 } ) ;
4544} ) ;
@@ -51,12 +50,12 @@ gulp.task("node_modules-webpack", (done) => {
5150 const statsJson = stats . toJson ( ) ;
5251 if ( err || ( statsJson . errors && statsJson . errors . length ) ) {
5352 statsJson . errors . forEach ( webpackError => {
54- gutil . log ( gutil . colors . red ( `Error (webpack): ${ webpackError } ` ) ) ;
53+ log . error ( `Error (webpack): ${ webpackError } ` ) ;
5554 } ) ;
5655
57- throw new gutil . PluginError ( 'webpack' , JSON . stringify ( err || statsJson . errors ) ) ;
56+ throw new PluginError ( 'webpack' , JSON . stringify ( err || statsJson . errors ) ) ;
5857 }
59- gutil . log ( '[webpack]' , stats . toString ( ) ) ;
58+ log ( '[webpack]' , stats . toString ( ) ) ;
6059 done ( ) ;
6160 } ) ;
6261} ) ;
@@ -92,7 +91,8 @@ gulp.task("genAikey", (done) => {
9291 fs . writeFileSync ( "package.json" , JSON . stringify ( packageJson , null , 2 ) + "\n" ) ;
9392 done ( ) ;
9493 } else {
95- gutil . log ( "Skipping genAiKey" ) ;
94+ log ( "Skipping genAiKey" ) ;
95+ done ( ) ;
9696 }
9797} ) ;
9898
@@ -124,35 +124,31 @@ gulp.task("test", (done) => {
124124 } ) ;
125125
126126 child . stdout . on ( "data" , ( data ) => {
127- gutil . log ( data . toString ( ) . trim ( ) ) ;
127+ log ( data . toString ( ) . trim ( ) ) ;
128128 } ) ;
129129
130130 child . stderr . on ( "data" , ( data ) => {
131- gutil . log ( gutil . colors . red ( data . toString ( ) . trim ( ) ) ) ;
131+ log . error ( data . toString ( ) . trim ( ) ) ;
132132 } ) ;
133133
134134 child . on ( "error" , ( error ) => {
135- gutil . log ( gutil . colors . red ( error ) ) ;
135+ log . error ( error ) ;
136136 } ) ;
137137
138138 child . on ( "exit" , ( code ) => {
139139 restoreExtensionDependencies ( ) ;
140140 if ( code === 0 ) {
141141 done ( ) ;
142142 } else {
143- gutil . log ( "exit code: " + code ) ;
143+ log . error ( "exit code: " + code ) ;
144144 done ( code ) ;
145145 }
146146 } ) ;
147147} ) ;
148148
149- gulp . task ( "build" , ( done ) => {
150- return runSequence ( "clean" , "ts-compile" , "html-webpack" , "node_modules-webpack" , "copyVendor" , done ) ;
151- } ) ;
149+ gulp . task ( "build" , gulp . series ( "clean" , "ts-compile" , "html-webpack" , "node_modules-webpack" , "copyVendor" ) ) ;
152150
153- gulp . task ( "build_without_view" , ( done ) => {
154- return runSequence ( "clean" , "ts-compile" , done ) ;
155- } ) ;
151+ gulp . task ( "build_without_view" , gulp . series ( "clean" , "ts-compile" ) ) ;
156152
157153gulp . task ( "watch" , ( ) => {
158154 gulp . watch ( [ "./src/**/*" , "./test/**/*" , "!./src/views/**/*" ] , [ "ts-compile" ] ) ;
0 commit comments