npm-run-all
npm-run-all copied to clipboard
Parallel cpx tasks don't work quite right?
"watchimg:a": "cpx ./source/assets/images/** ./publish/assets/images -v -w",
"watchimg:b": "cpx ./source/themes/01/assets/images/** ./publish/themes/01/assets/images -v -w",
"watchimg:c": "cpx ./source/themes/02/assets/images/** ./publish/themes/02/assets/images -v -w",
"watchimg": "run-p watchimg:*",
When I execute npm run watchimg:a or npm run watchimg:b or npm run watchimg:c, it works fine. It watches one directory and copies files across.
However, when I execute npm run watchimg, which uses run-p internally, it doesn't seem to work as expected. The console does print out all three scripts, but cpx prints "Be watching in ..." for only two out of three directories. Basically, it only seems to actually be watching two directories, and the third one is just "dead". File changes in that dead directory do not get picked up. Which of the commands are working properly seems to vary randomly when watchimg is run, but it's always two that work as expected, and one that doesn't.
You might say this is a bug in cpx instead of npm-run-all, but again: the individual tasks work fine. It only gets broken when I use watchimg with run-p.
Any ideas?
Tested this same setup with parallelshell instead of npm-run-all and it works fine. I guess I'll just use that instead for now.
"watchimg:a": "cpx ./source/assets/images/** ./publish/assets/images -v -w",
"watchimg:b": "cpx ./source/themes/01/assets/images/** ./publish/themes/01/assets/images -v -w",
"watchimg:c": "cpx ./source/themes/02/assets/images/** ./publish/themes/02/assets/images -v -w",
"watchimg": "parallelshell \"npm run watchimg:a\" \"npm run watchimg:b\" \"npm run watchimg:c\"",
This prints out "Be watching in ..." for all three directories, and changes to all three directories work properly. npm-run-all just doesn't work right.