I want to share with you a couple of operators I find really useful when creating npm scripts.
The & and && operators let you define multiple tasks in one npm script. For example,
"scripts": {
"start": "cd theme/cactus && git submodule pull"
}
In the code above, the second command git submodule pull after the first command cd theme/cactus is executed and finished.
Following a similar sample,
"scripts": {
"build": "npm run build:web & npm run build:admin"
"build:web": "...."
"build:admin": "..."
}
When using the operator &, it will run the first command in the background, returning immediately a success signal always, so the second command runs always and, more or less, at the same time as the first one.
In short, use & for parallel executions and && for sequential executions.
UPDATE: Check the new post for a better solution Concurrent Scripts