npm-run-all
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
ansi-styles | 3.2.1 | 3.72 kB | MIT | prod | |
chalk | 2.4.2 | 9.63 kB | MIT | prod | |
cross-spawn | 6.0.5 | 7.32 kB | MIT | prod | |
memorystream | 0.3.1 | 5.39 kB | MIT | prod | |
minimatch | 3.1.2 | 11.66 kB | ISC | prod | |
pidtree | 0.3.1 | 6.52 kB | MIT | prod | |
read-pkg | 3.0.0 | 1.99 kB | MIT | prod | 1 2 |
shell-quote | 1.8.1 | 15.23 kB | MIT | prod | |
string.prototype.padend | 3.1.6 | 1 B | MIT | prod |
The npm-run-all is a powerful Command Line Interface (CLI) tool that allows running of multiple npm scripts either sequentially or in parallel. This tool does not only simplify the process of running multiple scripts by utilizing the glob-like patterns, but it also enhances cross-platform usability by providing compatibility with both Unix/Linux and Windows operating systems.
To use npm-run-all, it has to be first installed in your project with the command npm install npm-run-all --save-dev
, or if you're using Yarn as package manager, use yarn add npm-run-all --dev
. This command will install npm-run-all as dev-dependency in your project.
Now, you can add the scripts to be run either in parallel or sequentially in your npm scripts section in package.json file. If you want to run the scripts sequentially use -s
and for parallel execution use -p
.
Use it as follows in your package.json:
"scripts": {
"clean": "action for clean",
"build:css": "action for build:css",
"build:js": "action for build:js",
"build:html": "action for build:html",
"build": "npm-run-all -s clean build:*"
}
Now, if you run npm run build
in the terminal, it'll execute the clean script and then all build scripts sequentially.
For parallel execution change -s
to -p
in the build command:
"scripts": {
"script1": "action for script1",
"script2": "action for script2",
"script3": "action for script3",
"start": "npm-run-all -p script*"
}
In this case, executing npm run start
will initiate script1, script2, and script3 in parallel.
The npm-run-all documentation is located within the project's Github repository. The detailed guides for using npm-run-all and its sub-commands (run-s and run-p) are provided in separate markdown files. These guides can be accessed via the following links: