frankwallis / gulp-hub

Gulp plugin to run tasks in multiple gulpfiles
MIT License
89 stars 24 forks source link

Document generated task names #16

Closed mrak closed 9 years ago

mrak commented 9 years ago

It appears that gulp-hub adds tasks of the format ../path/to/gulpfile.js-taskname when adding a gulpfile. I don't know if this is intended behavior or is purposely undocumented as it is an implementation detail that could change.

hub('../path/to/gulpfile.js')

gulp.task('build-it', ['../path/to/gulpfile.js-javascripts']);

where javascripts is the name of the "build" task in the ../path/to project

frankwallis commented 9 years ago

Yes gulp-hub prefixes the filename to the tasks to make them unique within gulp. It is an implementation detail because the names only need to be unique and this is how it is achieved.

mrak commented 9 years ago

I noticed a recent update broke some of my gulpfiles where relative paths to the gulpfile are now absolute paths in their generated task name

frankwallis commented 9 years ago

I made some changes recently to support recursive calls to gulp-hub, so that was probably the cause - is it all ok now?

actually I haven't come across your use case before - are there other files with 'javascripts' tasks which you don't want to run? If not, then you can just do:

gulp.task('build-it', ['javascripts']);
mrak commented 9 years ago

We do have other gulpfiles with the same task name that we've included but do not want to run. All of the projects' gulpfiles are maintained by different teams and can't rely on them all following the same naming convention.

Use case

We have an "integration" project that orchestrates the buliding, serving, and watching of a large number of sub-projects. As a result we sometimes have to have very targeted control of a sub-project's tasks.

The relative paths worked nicely, and we worked around the above issue with a combination of process.env["HOME"] + path.resolve(...), but there was a point in time were some of us had an earlier version in our npm cache which worked, or a newer one that didn't.

Unfortunately, gulp simply isn't there yet in terms of multi-project builds and we're left to rely on these types of plugins that regularly get blacklisted (how fascist of gulp).

I'm just suggesting that the hub-included task naming be a documented process, since we were relying on it's behavior :smile:

frankwallis commented 9 years ago

Agreed about the gulp support - although with gulp4 things should be better. I'm currently working on a new version of gulp-hub for gulp4 which uses a custom registry (https://github.com/frankwallis/gulp-hub/issues/15).

I don't plan on making any more changes to this version.