You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+19-20Lines changed: 19 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,15 +12,14 @@
12
12
13
13
A CLI tool to run multiple npm-scripts in parallel or sequential.
14
14
15
-
```
16
-
$ npm-run-all clean lint build:*
17
-
```
15
+
## ⤴️ Motivation
18
16
19
-
```
20
-
$ npm-run-all --parallel watch:*
21
-
```
17
+
-**Simplify.** The official `npm run-script` command cannot run multiple scripts, so if we want to run multiple scripts, it's redundant a bit. Let's shorten it by glob-like patterns.<br>
18
+
Before: `npm run clean && npm run build:css && npm run build:js && npm run build:html`<br>
19
+
After: `npm-run-all clean build:*`
20
+
-**Cross platform.** We sometimes use `&` to run multiple command in parallel, but `cmd.exe` (`npm run-script` uses it by default) does not support the `&`. Half of Node.js users is using it on Windows, so the use of `&` might block contributions. `npm-run-all --parallel` works well on Windows as well.
22
21
23
-
## Installation
22
+
## 💿 Installation
24
23
25
24
```bash
26
25
$ npm install npm-run-all --save-dev
@@ -29,9 +28,10 @@ $ yarn add npm-run-all --dev
29
28
```
30
29
31
30
- It requires `Node@>=4`.
32
-
- The `npm-run-all` package introduces 3 CLI commands: `npm-run-all`, `run-s`, and `run-p`.
33
31
34
-
## CLI Commands
32
+
## 📖 Usage
33
+
34
+
### CLI Commands
35
35
36
36
This `npm-run-all` package provides 3 CLI commands.
37
37
@@ -46,22 +46,23 @@ Both [run-s] and [run-p] are shorthand commands.
46
46
[run-s] is for sequential, [run-p] is for parallel.
47
47
We can make simple plans with those commands.
48
48
49
-
### Yarn Compatibility
49
+
#### Yarn Compatibility
50
+
51
+
If a script is invoked with Yarn, `npm-run-all` will correctly use Yarn to execute the plan's child scripts.
50
52
51
-
If a script is invoked with Yarn, npm-run-all will correctly use Yarn to execute the plan's child scripts.
Copy file name to clipboardExpand all lines: docs/run-p.md
+8-23Lines changed: 8 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,21 +6,6 @@
6
6
A CLI command to run given npm-scripts in parallel.
7
7
This command is the shorthand of `npm-run-all -p`.
8
8
9
-
```
10
-
> run-p watch:*
11
-
```
12
-
13
-
## Installation
14
-
15
-
```
16
-
> npm install -g npm-run-all
17
-
```
18
-
19
-
- Requires `Node@>=0.10` and `npm@>=2`
20
-
- The `npm-run-all` package introduces 3 CLI commands: `npm-run-all`, `run-s`, and `run-p`.
21
-
22
-
## Usage
23
-
24
9
```
25
10
Usage:
26
11
$ run-p [--help | -h | --version | -v]
@@ -85,8 +70,8 @@ The following 2 commands are similar.
85
70
The `run-p` command is shorter and **available on Windows**.
86
71
87
72
```
88
-
> run-p lint build
89
-
> npm run lint & npm run build
73
+
$ run-p lint build
74
+
$ npm run lint & npm run build
90
75
```
91
76
92
77
**Note1:** If a script exited with a non-zero code, the other scripts and those descendant processes are killed with `SIGTERM` (On Windows, with `taskkill.exe /F /T`).
@@ -100,14 +85,14 @@ We can use [glob]-like patterns to specify npm-scripts.
100
85
The difference is one -- the separator is `:` instead of `/`.
101
86
102
87
```
103
-
> run-p watch:*
88
+
$ run-p watch:*
104
89
```
105
90
106
91
In this case, runs sub scripts of `watch`. For example: `watch:html`, `watch:js`.
107
92
But, doesn't run sub-sub scripts. For example: `watch:js:index`.
108
93
109
94
```
110
-
> run-p watch:**
95
+
$ run-p watch:**
111
96
```
112
97
113
98
If we use a globstar `**`, runs both sub scripts and sub-sub scripts.
@@ -120,8 +105,8 @@ We can enclose a script name or a pattern in quotes to use arguments.
120
105
The following 2 commands are similar.
121
106
122
107
```
123
-
> run-p "build:* -- --watch"
124
-
> npm run build:aaa -- --watch & npm run build:bbb -- --watch
108
+
$ run-p "build:* -- --watch"
109
+
$ npm run build:aaa -- --watch & npm run build:bbb -- --watch
125
110
```
126
111
127
112
When we use a pattern, arguments are forwarded to every matched script.
@@ -131,7 +116,7 @@ When we use a pattern, arguments are forwarded to every matched script.
131
116
We can use placeholders to give the arguments preceded by `--` to scripts.
132
117
133
118
```
134
-
> run-p "start-server -- --port {1}" -- 8080
119
+
$ run-p "start-server -- --port {1}" -- 8080
135
120
```
136
121
137
122
This is useful to pass through arguments from `npm run` command.
@@ -145,7 +130,7 @@ This is useful to pass through arguments from `npm run` command.
0 commit comments