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

update node requires update gulp, breaks gulpfile.babel.js #1

Open
JamesNewton opened this issue Dec 24, 2019 · 0 comments
Open

update node requires update gulp, breaks gulpfile.babel.js #1

JamesNewton opened this issue Dec 24, 2019 · 0 comments

Comments

@JamesNewton
Copy link

Upgrading node breaks gulp 3. 
 gulpjs/gulp#2324
gulp 4 is significantly different from 3 and requires significant changes to the gulpfile.babel.js file.

Sub plot:
For some reason, I had a heck of a time installing gulp 4.0, even npm update gulp -g gets me 3.9.1. And yes, I've completely uninstalled and re-installed. Finally found:
 lemonstand/lscloud-theme-bones#52
which shows npm install gulp@4 to which I added the --save-dev flag. That got the current gulp version 4, but as expected, this triggers a rash of problems.

The first is related to :
 gulpjs/undertaker#54
Because gulp.task(name, deps, func) was replaced by gulp.task(name, gulp.{series|parallel}(deps, func)). This requires updates to any tasks with a dep which must be carefully implemented:
 https://fettblog.eu/gulp-4-parallel-and-series/
There is only once case of a dep in the file, but updating it to:
gulp.task('watch-all', gulp.series('browserify-watch'), () => {
results in an error "Task never defined: browserify-watch" even though it is defined later in the file, because gulp 4 has issues with forward references.

Moving the section:

gulp.task('watch-all', gulp.series('browserify-watch'), () => {
 gulp.watch(paths.server, () => {
 gulp.start('build-server');
 });
});

To the end of the file resolves the issue and gulp -T shows the tree.

However, actually running gulp errors on line 27 with "gulp.hasTask is not a function". This requires all the runSequences to be converted to gulp.series. 
https://stackoverflow.com/questions/48513573/gulp-error-gulp-hastask-is-not-a-function
E.g.

gulp.task('default', function(cb) {
 run('server', 'build', 'restart', 'watch-all', cb);
});

becomes: gulp.task('default', gulp.series('server', 'build', 'restart', 'watch-all'), cb => cb())

But that then causes ALL the forward references to be an issue. 

Gulp 4 is a… bridge too far. Any ideas for a... simpler re-build system? Or can anyone who is used to this upgrade help with the file?

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

No branches or pull requests

1 participant