OverZealous / run-sequence

Run a series of dependent gulp tasks in order
MIT License
961 stars 56 forks source link

does run-sequence can make deps only run one same as gulp? #98

Closed bluelovers closed 7 years ago

bluelovers commented 7 years ago

does run-sequence can make deps only run one same as gulp?

[02:51:46] Starting 'transactions:history:default'...
[02:51:46] Starting 'transactions:client'...
[02:51:46] Finished 'transactions:client' after 332 μs
[02:51:46] Starting 'transactions:history:sells'...
[02:51:51] Finished 'transactions:history:sells' after 5.04 s
[02:51:51] Starting 'transactions:client'...
[02:51:51] Finished 'transactions:client' after 15 μs
[02:51:51] Starting 'transactions:history:buys'...

transactions:client is dep for transactions:history:buys & transactions:history:sells but it shouldn't run > 1 time

any options for this?

OverZealous commented 7 years ago

The way run-sequence works, it cannot do this nor can it support it. run-sequence works by asking gulp to run each item in the sequential list, then listening for the completion event, then starting the next. As far as gulp is concerned, each item in the list is run independently.

You'll need to remove the traditional dependency to support your use case. You could move the :history:buys and :sells tasks into "private" tasks, which are don't have any dependencies, then create new tasks with dependencies and use run-sequence to start the "private" tasks with the dependencies. That's obviously getting a bit convoluted, though.

gulp.task('$transactions:history:sells', () => {
    // existing task here
});
gulp.task('transactions:history:sells', ['transactions:client'], (cb) => {
    runSequence('$transactions:history:sells', cb);
});

gulp.task('full-sequence', (cb) => {
  runSequence('transactions:client',
        '$transactions:history:sells',
        '$transactions:history:buys', cb);
});
bluelovers commented 7 years ago

nvm i make a hack do this now gulp-run-seq-unique

OverZealous commented 7 years ago

Cool, works for me!