在节点包文件中运行多个命令?

例如:

"scripts": { "watch": "coffee --watch --compile .; compass watch public/compass" }, 

我怎样才能使这个工作,所以它编译我的coffescripts和我的指南针项目?

http://substack.net/task_automation_with_npm_run

顺序的子任务

如果你有两个任务需要连续运行,你可以运行npm运行每个由&&分开的任务:

 "build": "npm run build-js && npm run build-css" 

并行子任务

如果你想同时运行一些任务,只需使用&作为分隔符!

 "watch": "npm run watch-js & npm run watch-css" 

安装parallelshell npm pacakge

 npm install parallelshell --save-dev 

在你的npm脚本中使用它而不是&

 "build": "echo TODO: build the project and start watching", "serve": "echo TODO: start a development web server", "start": "parallelshell \"npm start build\" \"npm start serve\"" 

并行运行多个子任务(Mac,Linux,Windows)

 $ npm start 

—或者—

创build一个.js文件,它通过Node.js child_process旋转多个进程。 这里是一个例子:

 "start": "node tools/start.js" 

其中tools/start.js可能如下所示:

https://github.com/kriasoft/aspnet-starter-kit/blob/master/tools/start.js