[NPM] Use a shorthand syntax for running multiple npm scripts with npm-run-all
Posted Answer1215
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[NPM] Use a shorthand syntax for running multiple npm scripts with npm-run-all相关的知识,希望对你有一定的参考价值。
Running multiple scripts in series or in parallel can become very verbose. Using a tool such as npm-run-all can help reduce the amount of overhead you have to type in order to get the same behavior.
Install:
npm i -D npm-run-all
"scripts": { "start": "node index.js", "test": "npm-run-all eslint stylelint mocha", "eslint": "eslint --cache --fix ./", "stylelint": "stylelint ‘**/*.scss‘ --syntax scss", "mocha": "mocha spec/ --require babel-register --watch" },
By default:
"test": "npm-run-all eslint stylelint mocha",
This will run in series.
TO make it run in parellel, we can add flag:
"test": "npm-run-all --parallel eslint mocha stylelint",
Here notice that we put ‘mocha‘ on the second, but we still able to stop it by ‘ctrl + c‘
以上是关于[NPM] Use a shorthand syntax for running multiple npm scripts with npm-run-all的主要内容,如果未能解决你的问题,请参考以下文章
npm报错:npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.