首页 > 代码库 > [NPM] Use a shorthand syntax for running multiple npm scripts with npm-run-all
[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
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。