Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR is upgrading Gulp to the version
4.0
.However, if by any reason you don't want to install a global gulp you can use
npx gulp <command>
.See also the following PRs where Gulp is also being upgraded by following the similar procedure as in this PR:
Technical Details
"gulp.parallel" and "gulp.series"
Gulp 4 requires to pass a function as a second parameter to
gulp.task
, instead of an array. It also only accepts 2 parameters which means you cannot list functions as arguments anymore."gulp-sequence" dependency is not needed anymore
Instead of using "gulp-sequence", we now use built-in
gulp.series
.Spawning extensions
We cannot simply transform this code by applying
gulp.series
because we need to wrap util calls into function so they are not called on file initiation:For this reason a function that builds such promise array was created:
Async functions -> promises
You may not want to use async functions anymore and use promises instead. Example as seen here https://github.com/compucorp/civihr/pull/2804/files:
"gulp.watch"
As per the documentation https://github.com/gulpjs/gulp/blob/4.0/docs/API.md#gulpwatchglobs-opts-fn
The
gulp.watch.on
now returns a file path (string) and not a file object. So we need to change:✅Build tested (deleted dist files and successfully rebuilt without changes)
✅Requirejs tested
✅Sass tested
✅Watch tested
✅Test tested
✅Backstopjs tested