[NPM] Use a shorthand syntax for running multiple npm scripts with npm-run-all
npm for with use all run multiple running
2023-09-14 09:00:52 时间
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 的简单使用
- window 安装使用npm
- npm常用命令
- 9.Node.js 包管理器npm
- [Typescript] Get a TypeScript package ready for release to NPM
- [NPM] Run a set of similar npm scripts with a wildcard
- [NPM] Run npm scripts in parallel
- npm传参技巧
- 为什么要使用 npm?
- npm淘宝镜像
- node:解决npm安装下载慢的问题(node v14.17.1/npm 7.20.5)
- reactjs npm start运行报错:Error: ENOSPC: System limit for number of file watchers reached
- npm install时报平台不兼容Unsupported platform for xxx的解决办法:npm install -f强制安装(centos7下安装vite2 vue依赖时出现这个问题)
- electron安装npm和cnpm均失败Failed at the electron@5.0.13 postinstall script.
- 忽略npm install安装失败信息
- npm的安装和使用?
- vue+webpack+npm搭建的纯前端项目