一个终端同时运行多条Nodejs命令

concurrently 模块

concurrently是一款npm包,可以让开发者在一个终端里同时运行多条命令

npm install concurrently -D

package.json修改如下

"scripts": {
    
    
    "lint": "npx eslint ./src",
    "changelog": "conventional-changelog -p custom-config -i CHANGELOG.md -s -r 0  -n ./changelog-option.js",
    "start": "concurrently \"npm run lint\" \"npm run changelog\" "
  },

不同的命令以双引号包起来,字符里双引号必须进行转义处理,否则concurrently会按照默认的方式command1 args command2 args来解析命令

npm run start 会同时执行 lintchangelog 两个命令

猜你喜欢

转载自blog.csdn.net/qq_41887214/article/details/124829346
今日推荐