npm-run-all icon indicating copy to clipboard operation
npm-run-all copied to clipboard

npm-run-all vs ampersand

Open Webbrother opened this issue 8 years ago • 1 comments

I'm not sure if understand of difference between:

  • npm-run-all script-one script-two and
  • script-one & script-two

Can anybody explain? What is the difference? Why I should use npm-run-all?

Webbrother avatar Apr 02 '17 14:04 Webbrother

Thank you for the question.

At first, npm-run-all script-one script-two and script-one & script-two is pretty different. The npm-run-all script-one script-two is equivalence to npm run script-one && npm run script-two. In short, npm-run-all is a tool to run multiple npm-scripts. In addition;

  • You can use glob-like pattern matching. E.g. npm-run-all build:**. This allow you to simplify npm-scripts.
  • You can run multiple npm-scripts in parallel on cross platform. E.g. npm-run-all -p watch:js watch:css. This is almost equivalence to npm run watch:js & npm run watch:css, but works on Windows which doesn't support the & operator, as well.
  • Maybe --race option is useful for tests. E.g. npm-run-all -p -r test-server test runs the test server and test in parallel, then it will kill the test-server automatically after the test completed.

Documents is here: https://github.com/mysticatea/npm-run-all/blob/master/docs/npm-run-all.md

mysticatea avatar Apr 03 '17 04:04 mysticatea