-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Upgrade gulp v4 #6143
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 gulp v4 #6143
Conversation
|
gulp.task('build', () => | ||
build('lib', babelRc.env[majorVer >= 5 ? 'node5' : 'pre-node5']) | ||
); | ||
|
||
gulp.task('watch', ['build'], () => { | ||
watch('src/**/*', () => { | ||
gulp.start('build'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a gulp
expert by any means, but it seems like we're doing gulp.task('build')
a lot in here. Is there a good way to clean that up a bit so it's more terse? (e.g. const buildTask = gulp.task('build')
) Or is this just the standard/canonical/usual/conventional way to do it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at a sample in their README, it says, "You can still use gulp.task
to expose tasks", but I'm not sure if they're implying that one should or shouldn't.
gulp.task('build', build);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it matters whether tasks are exported using gulp.task
or by exporting them from the module, it's just a matter of style.
As for the repeated use of gulp.task('build')
, it looks like the best way to avoid that is to just use the function reference instead. i.e. gulp.task('default', build)
That can't be done as things are currently, because build
is a helper function. The actual build
task is an anonymous function that calls the build
function. I see no reason not to merge those two functions into one. After that, instances of gulp.task('build')
could be replaced with build
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The readability of this script could be improved, but I still think it's pretty decent. It solves the problem.
Gulp v4 integrates a watch mecanism, there is no need for gulp-watch anymore.
34aa031
to
f84824f
Compare
Thanks! 👍 |
Summary
Update to Gulp v4 and drop deprecated
gulp-util
dependency.Also, it drops
gulp-watch
as it is now integrated within the gulp API.Motivation
This PR is motivated by the warnings showing up when performing
yarn install
on this repo. Also, it removeslodash v1.0.2
dependency which is using the deprecatedBuffer
constructor.