@@ -4,7 +4,8 @@ const path = require('path');
4
4
const gulp = require ( 'gulp' ) ;
5
5
const sourcemaps = require ( 'gulp-sourcemaps' ) ;
6
6
const plumber = require ( 'gulp-plumber' ) ;
7
- const gutil = require ( 'gulp-util' ) ;
7
+ const fancyLog = require ( 'fancy-log' ) ;
8
+ const colors = require ( 'ansi-colors' ) ;
8
9
const debug = require ( 'gulp-debug' ) ;
9
10
const nunjucks = require ( 'gulp-nunjucks-render' ) ;
10
11
const webpack = require ( 'webpack' ) ;
@@ -25,17 +26,17 @@ const watch = args.watch;
25
26
const port = 9000 ;
26
27
27
28
function handleError ( msg ) {
28
- gutil . log ( gutil . colors . red ( msg . message ) ) ;
29
+ fancyLog ( colors . red ( msg . message ) ) ;
29
30
this . emit ( 'end' ) ;
30
31
}
31
32
32
- gulp . task ( 'test:cleanup' , ( ) => {
33
+ function testCleanup ( ) {
33
34
return del ( [
34
35
'./test-dist'
35
36
] ) ;
36
- } ) ;
37
+ }
37
38
38
- gulp . task ( 'test:markup' , [ 'test:cleanup' ] , ( ) => {
39
+ function testMarkup ( ) {
39
40
function bundle ( ) {
40
41
return gulp . src ( './test/manual/**/*.html' )
41
42
. pipe ( plumber ( handleError ) )
@@ -48,9 +49,9 @@ gulp.task('test:markup', ['test:cleanup'], () => {
48
49
gulp . watch ( [ './test/manual/**/*.html' ] , bundle ) ;
49
50
}
50
51
return bundle ( ) ;
51
- } ) ;
52
+ }
52
53
53
- gulp . task ( 'test:style' , [ 'test:cleanup' ] , ( ) => {
54
+ function testStyle ( ) {
54
55
function bundle ( ) {
55
56
return gulp . src ( './test/manual/**/*.css' )
56
57
. pipe ( plumber ( handleError ) )
@@ -70,9 +71,9 @@ gulp.task('test:style', ['test:cleanup'], () => {
70
71
gulp . watch ( [ './test/manual/**/*.css' ] , bundle ) ;
71
72
}
72
73
return bundle ( ) ;
73
- } ) ;
74
+ }
74
75
75
- gulp . task ( 'test:script' , [ 'test:cleanup' ] , ( ) => {
76
+ function testScript ( ) {
76
77
77
78
return globby ( [ './test/manual/**/*.js' ] )
78
79
. then ( ( files ) => {
@@ -117,7 +118,7 @@ gulp.task('test:script', ['test:cleanup'], () => {
117
118
if ( err ) {
118
119
return reject ( err ) ;
119
120
}
120
- gutil . log ( stats . toString ( {
121
+ fancyLog ( stats . toString ( {
121
122
colors : true
122
123
} ) ) ;
123
124
return resolve ( ) ;
@@ -133,9 +134,9 @@ gulp.task('test:script', ['test:cleanup'], () => {
133
134
134
135
} ) ;
135
136
136
- } ) ;
137
+ }
137
138
138
- gulp . task ( 'test:assets' , [ 'test:cleanup' ] , ( ) => {
139
+ function testAssets ( ) {
139
140
function bundle ( ) {
140
141
return gulp . src ( './test/manual/assets/**/*' )
141
142
. pipe ( gulp . dest ( './test-dist/assets' ) )
@@ -145,11 +146,11 @@ gulp.task('test:assets', ['test:cleanup'], () => {
145
146
gulp . watch ( [ './test/manual/assets/**/*' ] , bundle ) ;
146
147
}
147
148
return bundle ( ) ;
148
- } ) ;
149
+ }
149
150
150
- gulp . task ( 'test:prepare' , [ 'test:cleanup' , 'test:markup' , 'test:style' , 'test:script' , 'test:assets' ] ) ;
151
+ const testPrepare = parallel ( testMarkup , testStyle , testScript , testAssets ) ;
151
152
152
- gulp . task ( 'test:local:manual' , [ 'test:prepare' ] , ( ) => {
153
+ function testLocalManual ( ) {
153
154
if ( watch ) {
154
155
ws ( {
155
156
'static' : {
@@ -161,4 +162,12 @@ gulp.task('test:local:manual', ['test:prepare'], () => {
161
162
} ) . listen ( port ) ;
162
163
opn ( `http://localhost:${ port } ` ) ;
163
164
}
164
- } ) ;
165
+ }
166
+
167
+ module . exports [ 'test:cleanup' ] = testCleanup ;
168
+ module . exports [ 'test:markup' ] = series ( testCleanup , testMarkup ) ;
169
+ module . exports [ 'test:style' ] = series ( testCleanup , testStyle ) ;
170
+ module . exports [ 'test:script' ] = series ( testCleanup , testScript ) ;
171
+ module . exports [ 'test:assets' ] = series ( testCleanup , testAssets ) ;
172
+ module . exports [ 'test:prepare' ] = series ( testCleanup , testPrepare ) ;
173
+ module . exports [ 'test:local:manual' ] = series ( testCleanup , testPrepare , testLocalManual ) ;
0 commit comments