Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade kit to use Gulp 4 #659

Merged
merged 5 commits into from
Jan 2, 2019

Conversation

olliewilliams-CH
Copy link
Contributor

A new version of gulp is available which brings with it improvements in task scheduling and a reduction in dependency vulnerabilities. This work is to make the kit use the latest version of gulp.

  • upgrade gulp to 4.0.0
  • substitute gulp-clean for del
  • remove reliance on run-sequence by using in-built gulp functions

- upgrade gulp to 4.0.0
- substitute gulp-clean for del
- remove reliance on run-sequence by using in-built gulp functions
- add PR alphagov#659 to changelog
Copy link
Contributor

@aliuk2012 aliuk2012 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cheers @olliewilliams-CH, this looks great.

We just need another review from the team and we can get it merged.

gulp/nodemon.js Outdated Show resolved Hide resolved
- group dependencies to GOV.UK standard
gulp/watch.js Outdated
const config = require('./config.json')

gulp.task('watch-sass', function () {
return gulp.watch(config.paths.assets + 'sass/**', {cwd: './'}, ['sass'])
return gulp.watch(config.paths.assets + 'sass/**', { cwd: './' }, gulp.series('sass'))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is series necessary if you only have one item?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looked into this, gulp.task('sass') seems to work too, which reads better to me

gulpjs/gulp#1411 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point, it does seem to work fine so I agree going with that approach makes sense. Changes made and pushed.

- replace gulp.series on watch tasks with gulp.task
gulp/clean.js Outdated
'.port.tmp'], {read: false})
.pipe(clean())
gulp.task('clean', function (done) {
return del([config.paths.public + '*',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we've lost a slash here /* - does it make any difference?

// gulp 4 requires dependency tasks to be defined before they are called.
// We'll keep our top-level tasks in this file so that they are defined at the end of the chain, after their dependencies.
gulp.task('generate-assets', gulp.parallel(
'clean',
Copy link
Contributor

@joelanman joelanman Dec 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we probably want to run clean before the others, not in parallel - or there's a chance clean could clean out files generated by the other tasks. Previously this list was series (runSequence) but maybe clean should be series, then the others as parallel? Similar to line 34

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've re-added the slash to the public path, not quite sure if I did that on purpose in a flurry of activity or if it was just a typo. Either way, Del works fine with the slash to we'll leave it in.

Good spot with the clean task. It's now in series and will run before all other tasks inside generate-assets.

- fix public path for clean task
- run clean task before all others
@aliuk2012
Copy link
Contributor

We should check if #89 is fixed as a result of updating gulp 4

@joelanman joelanman merged commit 1dd4dea into alphagov:master Jan 2, 2019
@joelanman
Copy link
Contributor

Thanks very much @olliewilliams-CH ! Happy new year

@joelanman joelanman mentioned this pull request Jan 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants