[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‘

时间: 2024-10-19 11:14:40

[NPM] Use a shorthand syntax for running multiple npm scripts with npm-run-all的相关文章

node 中 npm报错 Error: ENOENT, stat 'C:\Users\Administrator\AppData\Roaming\npm'

今天在看node书本时,安装express,看看里面的包.没想到出现这样一种情况. 报错了.后来思考了一下,可能是修改了node的默认安装路径.于是准备在出错的路径下建一个npm文件夹. 注意,有个时候会出现找不到AppData文件夹.看图: 看到这张图时大家应该明白了.因为这张图是隐藏起来的.大家要把他显示出来.至于如何在win7下显示文件夹,就不在这罗嗦了. 完成npm文件夹的创建后: 安装express试试: 看到下面那么一大坨东西,相信大家已经知道express暗转成功了. 在看看有没有

tunneling socket could not be established, cause=connect ECONNREFUSED 127.0.0.1:56281 npm ERR! network This is most likely not a problem with npm itself npm ERR! network and is related to network

tunneling socket could not be established, cause=connect ECONNREFUSED 127.0.0.1:56281npm ERR! network This is most likely not a problem with npm itselfnpm ERR! network and is related to network connectivity.npm ERR! network In most cases you are behi

解决最近windows版本Node.js中npm出现的“Error: ENOENT, stat 'C:\Users\UserName\AppData\Roaming\npm”的问题

(转载请注明出处,from www.cnblogs.com/xdxer) 问题可能如下所示 解决方案: 在 'C:\Users\UserName\AppData\Roaming\‘ 下手动的增加一个文件夹npm . 然后问题就解决了. 解决最近windows版本Node.js中npm出现的"Error: ENOENT, stat 'C:\Users\UserName\AppData\Roaming\npm"的问题

[Tool] Open Multiple Terminal Tabs on npm Start with ttab and npm-run-all

Often times when developing web applications, you need to open multiple tabs to run different scripts to start the application. This can all be done with one command In this lesson, you will learn how to start a project and open multiple terminal tab

Running multiple instances of Xamarin Studio on a Mac

I love developing software on my MacBook Air! I got the latest version with the maximum possible specifications (i7, 8GB internal mem, 512GB SSD disk) so it works better than anything I ever had! One of the things i was missing (a  lot) while develop

Grokking PyTorch

原文地址:https://github.com/Kaixhin/grokking-pytorch PyTorch is a flexible deep learning framework that allows automatic differentiation(自动求导) through dynamic neural networks (i.e., networks that utilise dynamic control flow like if statements and while

Failed at the [email protected] preinstall script './scripts/download' 设置linux proxy (代理)的方式

此问题发生的条件是: 用bitcore官方提供的方式在linux进行npm安装,报错: Downloading bitcoin: https://github.com/bitpay/bitcoin/releases/download/v0.12.1-bitcore-4/npm ERR! Linux 3.16.0-4-686-paenpm ERR! argv "/home/user/.nvm/versions/node/v4.6.0/bin/node" "/home/user/

Uniform synchronization between multiple kernels running on single computer systems

The present invention allocates resources in a multi-operating system computing system, thereby avoiding bottlenecks and other degradations that result from competition for limited resources. In one embodiment, a computer system includes resources an

npm i命令报错“Please try running this command again as root/Administrator”

相对npm install命令不够正规,虽然使用npm -help命令查看npm i和npm install的内容是一样的,但是我使用的intellij 2017.2.4版本会经常对"npm i"这个命令报这个错.所以建议使用npm install命令.然而,还会出现这个错误的话就可以忽视了,毕竟我用angular-cli工具创建的项目初始安装包npm install即便报错也不必理会,继续npm start测试编译通过,浏览器可以正常打开页面.