Skip to content

Commit

Permalink
Upgrade to Gulp 4
Browse files Browse the repository at this point in the history
Closes #93.
  • Loading branch information
niksy committed Aug 6, 2018
1 parent 05f6c46 commit adbd6a1
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 30 deletions.
14 changes: 8 additions & 6 deletions generators/app/templates/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,17 @@
"coveralls": "^2.11.11"<% } %><% if ( manualTests || integrationTests ) { %>,
"del": "^2.2.0",
"globby": "^4.1.0",
"gulp": "^3.9.1",
"gulp-debug": "^2.1.2",
"gulp": "^4.0.0",
"gulp-cli": "^2.0.1",
"gulp-debug": "^4.0.0",
"gulp-nunjucks-render": "^2.0.0",
"gulp-plumber": "^1.1.0",
"gulp-sourcemaps": "^1.6.0",
"gulp-util": "^3.0.7",
"gulp-postcss": "^6.4.0",
"postcss-import": "^9.1.0",
"gulp-sourcemaps": "^2.6.4",
"gulp-postcss": "^7.0.1",
"postcss-import": "^11.1.0",
"local-web-server": "^1.2.4",
"ansi-colors": "^2.0.5",
"fancy-log": "^1.3.2",
"suitcss-components-test": "^1.0.0"<% } %><% if ( (manualTests || integrationTests) || (automatedTests && browserModule && !sassModule) ) { %>,
"minimist": "^1.2.0"<% } %><% if ( (manualTests || integrationTests) || ((browserModule && !sassModule) && (transpile || automatedTests)) ) { %>,
"webpack": "^4.12.0"<% } %><% if ( sassModule ) { %>,
Expand Down
41 changes: 25 additions & 16 deletions generators/app/templates/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ const path = require('path');
const gulp = require('gulp');
const sourcemaps = require('gulp-sourcemaps');
const plumber = require('gulp-plumber');
const gutil = require('gulp-util');
const fancyLog = require('fancy-log');
const colors = require('ansi-colors');
const debug = require('gulp-debug');
const nunjucks = require('gulp-nunjucks-render');
const webpack = require('webpack');
Expand All @@ -25,17 +26,17 @@ const watch = args.watch;
const port = 9000;

function handleError ( msg ) {
gutil.log(gutil.colors.red(msg.message));
fancyLog(colors.red(msg.message));
this.emit('end');
}

gulp.task('test:cleanup', () => {
function testCleanup () {
return del([
'./test-dist'
]);
});
}

gulp.task('test:markup', ['test:cleanup'], () => {
function testMarkup () {
function bundle () {
return gulp.src('./test/manual/**/*.html')
.pipe(plumber(handleError))
Expand All @@ -48,9 +49,9 @@ gulp.task('test:markup', ['test:cleanup'], () => {
gulp.watch(['./test/manual/**/*.html'], bundle);
}
return bundle();
});
}

gulp.task('test:style', ['test:cleanup'], () => {
function testStyle () {
function bundle () {
return gulp.src('./test/manual/**/*.css')
.pipe(plumber(handleError))
Expand All @@ -70,9 +71,9 @@ gulp.task('test:style', ['test:cleanup'], () => {
gulp.watch(['./test/manual/**/*.css'], bundle);
}
return bundle();
});
}

gulp.task('test:script', ['test:cleanup'], () => {
function testScript () {

return globby(['./test/manual/**/*.js'])
.then(( files ) => {
Expand Down Expand Up @@ -117,7 +118,7 @@ gulp.task('test:script', ['test:cleanup'], () => {
if ( err ) {
return reject(err);
}
gutil.log(stats.toString({
fancyLog(stats.toString({
colors: true
}));
return resolve();
Expand All @@ -133,9 +134,9 @@ gulp.task('test:script', ['test:cleanup'], () => {

});

});
}

gulp.task('test:assets', ['test:cleanup'], () => {
function testAssets () {
function bundle () {
return gulp.src('./test/manual/assets/**/*')
.pipe(gulp.dest('./test-dist/assets'))
Expand All @@ -145,11 +146,11 @@ gulp.task('test:assets', ['test:cleanup'], () => {
gulp.watch(['./test/manual/assets/**/*'], bundle);
}
return bundle();
});
}

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

gulp.task('test:local:manual', ['test:prepare'], () => {
function testLocalManual () {
if ( watch ) {
ws({
'static': {
Expand All @@ -161,4 +162,12 @@ gulp.task('test:local:manual', ['test:prepare'], () => {
}).listen(port);
opn(`http://localhost:${port}`);
}
});
}

module.exports['test:cleanup'] = testCleanup;
module.exports['test:markup'] = series(testCleanup, testMarkup);
module.exports['test:style'] = series(testCleanup, testStyle);
module.exports['test:script'] = series(testCleanup, testScript);
module.exports['test:assets'] = series(testCleanup, testAssets);
module.exports['test:prepare'] = series(testCleanup, testPrepare);
module.exports['test:local:manual'] = series(testCleanup, testPrepare, testLocalManual);
16 changes: 8 additions & 8 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,12 @@ describe('Manual tests', function () {
'webpack': '^4.12.0',
'del': '^2.2.0',
'globby': '^4.1.0',
'gulp': '^3.9.1',
'gulp-debug': '^2.1.2',
'gulp': '^4.0.0',
'gulp-cli': '^2.0.1',
'gulp-debug': '^4.0.0',
'gulp-nunjucks-render': '^2.0.0',
'gulp-plumber': '^1.1.0',
'gulp-sourcemaps': '^1.6.0',
'gulp-util': '^3.0.7',
'gulp-sourcemaps': '^2.6.4',
'minimist': '^1.2.0',
'local-web-server': '^1.2.4',
'opn': '^4.0.2'
Expand Down Expand Up @@ -320,12 +320,12 @@ describe('Integration tests', function () {
'webpack': '^4.12.0',
'del': '^2.2.0',
'globby': '^4.1.0',
'gulp': '^3.9.1',
'gulp-debug': '^2.1.2',
'gulp': '^4.0.0',
'gulp-cli': '^2.0.1',
'gulp-debug': '^4.0.0',
'gulp-nunjucks-render': '^2.0.0',
'gulp-plumber': '^1.1.0',
'gulp-sourcemaps': '^1.6.0',
'gulp-util': '^3.0.7',
'gulp-sourcemaps': '^2.6.4',
'minimist': '^1.2.0',
'local-web-server': '^1.2.4',
'wdio-browserstack-service': '^0.1.16',
Expand Down

0 comments on commit adbd6a1

Please sign in to comment.