Skip to content

Commit 6bdda80

Browse files
committed
Upgrade to Gulp 4
Closes #93.
1 parent 2175bca commit 6bdda80

File tree

3 files changed

+41
-30
lines changed

3 files changed

+41
-30
lines changed

generators/app/templates/_package.json

+8-6
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,17 @@
7373
"coveralls": "^2.11.11"<% } %><% if ( manualTests || integrationTests ) { %>,
7474
"del": "^2.2.0",
7575
"globby": "^4.1.0",
76-
"gulp": "^3.9.1",
77-
"gulp-debug": "^2.1.2",
76+
"gulp": "^4.0.0",
77+
"gulp-cli": "^2.0.1",
78+
"gulp-debug": "^4.0.0",
7879
"gulp-nunjucks-render": "^2.0.0",
7980
"gulp-plumber": "^1.1.0",
80-
"gulp-sourcemaps": "^1.6.0",
81-
"gulp-util": "^3.0.7",
82-
"gulp-postcss": "^6.4.0",
83-
"postcss-import": "^9.1.0",
81+
"gulp-sourcemaps": "^2.6.4",
82+
"gulp-postcss": "^7.0.1",
83+
"postcss-import": "^11.1.0",
8484
"local-web-server": "^1.2.4",
85+
"ansi-colors": "^2.0.5",
86+
"fancy-log": "^1.3.2",
8587
"suitcss-components-test": "^1.0.0"<% } %><% if ( (manualTests || integrationTests) || (automatedTests && browserModule && !sassModule) ) { %>,
8688
"minimist": "^1.2.0"<% } %><% if ( (manualTests || integrationTests) || ((browserModule && !sassModule) && (transpile || automatedTests)) ) { %>,
8789
"webpack": "^4.12.0"<% } %><% if ( sassModule ) { %>,

generators/app/templates/gulpfile.js

+25-16
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ const path = require('path');
44
const gulp = require('gulp');
55
const sourcemaps = require('gulp-sourcemaps');
66
const plumber = require('gulp-plumber');
7-
const gutil = require('gulp-util');
7+
const fancyLog = require('fancy-log');
8+
const colors = require('ansi-colors');
89
const debug = require('gulp-debug');
910
const nunjucks = require('gulp-nunjucks-render');
1011
const webpack = require('webpack');
@@ -25,17 +26,17 @@ const watch = args.watch;
2526
const port = 9000;
2627

2728
function handleError ( msg ) {
28-
gutil.log(gutil.colors.red(msg.message));
29+
fancyLog(colors.red(msg.message));
2930
this.emit('end');
3031
}
3132

32-
gulp.task('test:cleanup', () => {
33+
function testCleanup () {
3334
return del([
3435
'./test-dist'
3536
]);
36-
});
37+
}
3738

38-
gulp.task('test:markup', ['test:cleanup'], () => {
39+
function testMarkup () {
3940
function bundle () {
4041
return gulp.src('./test/manual/**/*.html')
4142
.pipe(plumber(handleError))
@@ -48,9 +49,9 @@ gulp.task('test:markup', ['test:cleanup'], () => {
4849
gulp.watch(['./test/manual/**/*.html'], bundle);
4950
}
5051
return bundle();
51-
});
52+
}
5253

53-
gulp.task('test:style', ['test:cleanup'], () => {
54+
function testStyle () {
5455
function bundle () {
5556
return gulp.src('./test/manual/**/*.css')
5657
.pipe(plumber(handleError))
@@ -70,9 +71,9 @@ gulp.task('test:style', ['test:cleanup'], () => {
7071
gulp.watch(['./test/manual/**/*.css'], bundle);
7172
}
7273
return bundle();
73-
});
74+
}
7475

75-
gulp.task('test:script', ['test:cleanup'], () => {
76+
function testScript () {
7677

7778
return globby(['./test/manual/**/*.js'])
7879
.then(( files ) => {
@@ -117,7 +118,7 @@ gulp.task('test:script', ['test:cleanup'], () => {
117118
if ( err ) {
118119
return reject(err);
119120
}
120-
gutil.log(stats.toString({
121+
fancyLog(stats.toString({
121122
colors: true
122123
}));
123124
return resolve();
@@ -133,9 +134,9 @@ gulp.task('test:script', ['test:cleanup'], () => {
133134

134135
});
135136

136-
});
137+
}
137138

138-
gulp.task('test:assets', ['test:cleanup'], () => {
139+
function testAssets () {
139140
function bundle () {
140141
return gulp.src('./test/manual/assets/**/*')
141142
.pipe(gulp.dest('./test-dist/assets'))
@@ -145,11 +146,11 @@ gulp.task('test:assets', ['test:cleanup'], () => {
145146
gulp.watch(['./test/manual/assets/**/*'], bundle);
146147
}
147148
return bundle();
148-
});
149+
}
149150

150-
gulp.task('test:prepare', ['test:cleanup', 'test:markup', 'test:style', 'test:script', 'test:assets']);
151+
const testPrepare = parallel(testMarkup, testStyle, testScript, testAssets);
151152

152-
gulp.task('test:local:manual', ['test:prepare'], () => {
153+
function testLocalManual () {
153154
if ( watch ) {
154155
ws({
155156
'static': {
@@ -161,4 +162,12 @@ gulp.task('test:local:manual', ['test:prepare'], () => {
161162
}).listen(port);
162163
opn(`http://localhost:${port}`);
163164
}
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);

test/index.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,12 @@ describe('Manual tests', function () {
160160
'webpack': '^4.12.0',
161161
'del': '^2.2.0',
162162
'globby': '^4.1.0',
163-
'gulp': '^3.9.1',
164-
'gulp-debug': '^2.1.2',
163+
'gulp': '^4.0.0',
164+
'gulp-cli': '^2.0.1',
165+
'gulp-debug': '^4.0.0',
165166
'gulp-nunjucks-render': '^2.0.0',
166167
'gulp-plumber': '^1.1.0',
167-
'gulp-sourcemaps': '^1.6.0',
168-
'gulp-util': '^3.0.7',
168+
'gulp-sourcemaps': '^2.6.4',
169169
'minimist': '^1.2.0',
170170
'local-web-server': '^1.2.4',
171171
'opn': '^4.0.2'
@@ -320,12 +320,12 @@ describe('Integration tests', function () {
320320
'webpack': '^4.12.0',
321321
'del': '^2.2.0',
322322
'globby': '^4.1.0',
323-
'gulp': '^3.9.1',
324-
'gulp-debug': '^2.1.2',
323+
'gulp': '^4.0.0',
324+
'gulp-cli': '^2.0.1',
325+
'gulp-debug': '^4.0.0',
325326
'gulp-nunjucks-render': '^2.0.0',
326327
'gulp-plumber': '^1.1.0',
327-
'gulp-sourcemaps': '^1.6.0',
328-
'gulp-util': '^3.0.7',
328+
'gulp-sourcemaps': '^2.6.4',
329329
'minimist': '^1.2.0',
330330
'local-web-server': '^1.2.4',
331331
'wdio-browserstack-service': '^0.1.16',

0 commit comments

Comments
 (0)