首页 > 其他 > 详细

[NPM] Use a shorthand syntax for running multiple npm scripts with npm-run-all

时间:2017-02-03 22:49:51      阅读:274      评论:0      收藏:0      [点我收藏+]

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

原文:http://www.cnblogs.com/Answer1215/p/6363543.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!