I have several gulp subtasks which will keep monitoring files to update. I need them launched up in sequence.
gulp.task('production', ['update-build-info/production:live', 'build-resources/production:live', 'npm-start', 'simulator'], () => {
  console.log('finished!!!');
});
My questions are:
- I use gulp-watchto track files for live update. This will lead to sequential launching failed, because those subtasks will simply return before it completes launching and becomes idle.
How can I arrange those subtask like this:
[start main task]-->[1. update-build-info]
                          |
                    start watching files
                          |
                    update matched files
                          |
                    idle (keep watching)-->[2. build-resources]
                          |                     |
                    update new changes     start watching files
                                                |
                                           update matched files
                                                |
                                           idle (keep watching)-->[3. run npm start]
                                                |                     |                                                            
                                           update new changes     finish launching, idle --> [4. build and launch iOS app]
                                                                      |
                                                                  update new changes
- Executing shell script npm startwill cause the subtask never ends, and lead to the callback will never be called (printfinished!!!). If I remove this subtask, the callback will be called again. How can I make the subtask send acompletedsignal to trigger the callback?
The npm start is babel-node node_modules/react-native/local-cli/cli.js start.
EDIT:
I've demonstrated why this topic "How to run Gulp tasks sequentially one after the other" doesn't work for me. I use gulp-watch which will cause async tasks, and I have no idea how to sync them when it initial work is done .
Another watching mechanism using node.js is npm start which will block the task and never end.
I think I need to use RxJS to do the job if there is no way to resolve this problem.
 
    