Skip to content

Commit

Permalink
Docs: update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mysticatea committed Aug 26, 2017
1 parent 8c6debf commit 8c8bec0
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 97 deletions.
39 changes: 19 additions & 20 deletions README.md
Expand Up @@ -12,15 +12,14 @@

A CLI tool to run multiple npm-scripts in parallel or sequential.

```
$ npm-run-all clean lint build:*
```
## ⤴️ Motivation

```
$ npm-run-all --parallel watch:*
```
- **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>
Before: `npm run clean && npm run build:css && npm run build:js && npm run build:html`<br>
After: `npm-run-all clean build:*`
- **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.

## Installation
## 💿 Installation

```bash
$ npm install npm-run-all --save-dev
Expand All @@ -29,9 +28,10 @@ $ yarn add npm-run-all --dev
```

- It requires `Node@>=4`.
- The `npm-run-all` package introduces 3 CLI commands: `npm-run-all`, `run-s`, and `run-p`.

## CLI Commands
## 📖 Usage

### CLI Commands

This `npm-run-all` package provides 3 CLI commands.

Expand All @@ -46,22 +46,23 @@ Both [run-s] and [run-p] are shorthand commands.
[run-s] is for sequential, [run-p] is for parallel.
We can make simple plans with those commands.

### Yarn Compatibility
#### Yarn Compatibility

If a script is invoked with Yarn, `npm-run-all` will correctly use Yarn to execute the plan's child scripts.

If a script is invoked with Yarn, npm-run-all will correctly use Yarn to execute the plan's child scripts.
## Node API
### Node API

This `npm-run-all` package provides Node API.

- [Node API]

## Changelog
## 📰 Changelog

- https://github.com/mysticatea/npm-run-all/releases

## Contributing
## 🍻 Contributing

Thank you for contributing!
Welcome♡

### Bug Reports or Feature Requests

Expand All @@ -73,18 +74,16 @@ Please use GitHub Pull Requests.

I'm not familiar with English, so I especially thank you for documents' corrections.

### Feature Implementing
### Implementing

Please use GitHub Pull Requests.

There are some npm-scripts to help developments.
Those work on Windows, Mac, or Linux (by the way, I'm developping `npm-run-all` on Windows).

- **npm test** - Run tests and collect coverage.
- **npm run build** - Make `lib` directory from `src` directory.
- **npm run clean** - Delete directories (folders) which are created by other commands.
- **npm run clean** - Delete temporary files.
- **npm run lint** - Run ESLint.
- **npm run watch** - Run tests (not collect coverage) when each file was modified.
- **npm run watch** - Run tests (not collect coverage) on every file change.

[npm-run-all]: docs/npm-run-all.md
[run-s]: docs/run-s.md
Expand Down
2 changes: 1 addition & 1 deletion docs/node-api.md
Expand Up @@ -5,7 +5,7 @@

A Node module to run given npm-scripts in parallel or sequential.

```
```js
const runAll = require("npm-run-all");

runAll(["clean", "lint", "build:*"], {parallel: false})
Expand Down
41 changes: 11 additions & 30 deletions docs/npm-run-all.md
Expand Up @@ -3,25 +3,6 @@

# `npm-run-all` command

A CLI command to run given npm-scripts in parallel or sequential.

```
> npm-run-all clean lint build:*
> npm-run-all --parallel watch:*
```

## Installation

```
> npm install -g npm-run-all
```

- Requires `Node@>=0.10` and `npm@>=2`
- The `npm-run-all` package introduces 3 CLI commands: `npm-run-all`, `run-s`, and `run-p`.

## Usage

```
Usage:
$ npm-run-all [--help | -h | --version | -v]
Expand Down Expand Up @@ -88,7 +69,7 @@ On the other hand, this `npm-run-all` command runs multiple scripts in parallel
### Run scripts sequentially

```
npm-run-all clean lint build
$ npm-run-all clean lint build
```

This is same as `npm run clean && npm run lint && npm run build`.
Expand All @@ -99,7 +80,7 @@ If `--continue-on-error` option is given, this behavior will be disabled.
### Run scripts in parallel

```
npm-run-all --parallel lint build
$ npm-run-all --parallel lint build
```

This is similar to `npm run lint & npm run build`.
Expand All @@ -112,19 +93,19 @@ If `--continue-on-error` option is given, this behavior will be disabled.
### Run a mix of sequential and parallel scripts

```
npm-run-all clean lint --parallel watch:html watch:js
$ npm-run-all clean lint --parallel watch:html watch:js
```

1. First, this runs `clean` and `lint` sequentially / serially.
2. Next, runs `watch:html` and `watch:js` in parallel.

```
npm-run-all a b --parallel c d --sequential e f --parallel g h i
$ npm-run-all a b --parallel c d --sequential e f --parallel g h i
```
or

```
npm-run-all a b --parallel c d --serial e f --parallel g h i
$ npm-run-all a b --parallel c d --serial e f --parallel g h i
```

1. First, runs `a` and `b` sequentially / serially.
Expand All @@ -138,14 +119,14 @@ We can use [glob]-like patterns to specify npm-scripts.
The difference is one -- the separator is `:` instead of `/`.

```
> npm-run-all --parallel watch:*
$ npm-run-all --parallel watch:*
```

In this case, runs sub scripts of `watch`. For example: `watch:html`, `watch:js`.
But, doesn't run sub-sub scripts. For example: `watch:js:index`.

```
> npm-run-all --parallel watch:**
$ npm-run-all --parallel watch:**
```

If we use a globstar `**`, runs both sub scripts and sub-sub scripts.
Expand All @@ -158,8 +139,8 @@ We can enclose a script name or a pattern in quotes to use arguments.
The following 2 commands are similar.

```
> npm-run-all --parallel "build:* -- --watch"
> npm run build:aaa -- --watch & npm run build:bbb -- --watch
$ npm-run-all --parallel "build:* -- --watch"
$ npm run build:aaa -- --watch & npm run build:bbb -- --watch
```

When we use a pattern, arguments are forwarded to every matched script.
Expand All @@ -169,7 +150,7 @@ When we use a pattern, arguments are forwarded to every matched script.
We can use placeholders to give the arguments preceded by `--` to scripts.

```
> npm-run-all build "start-server -- --port {1}" -- 8080
$ npm-run-all build "start-server -- --port {1}" -- 8080
```

This is useful to pass through arguments from `npm run` command.
Expand All @@ -183,7 +164,7 @@ This is useful to pass through arguments from `npm run` command.
```

```
> npm run start 8080
$ npm run start 8080
> example@0.0.0 start /path/to/package.json
> npm-run-all build "start-server -- --port {1}" -- "8080"
Expand Down
31 changes: 8 additions & 23 deletions docs/run-p.md
Expand Up @@ -6,21 +6,6 @@
A CLI command to run given npm-scripts in parallel.
This command is the shorthand of `npm-run-all -p`.

```
> run-p watch:*
```

## Installation

```
> npm install -g npm-run-all
```

- Requires `Node@>=0.10` and `npm@>=2`
- The `npm-run-all` package introduces 3 CLI commands: `npm-run-all`, `run-s`, and `run-p`.

## Usage

```
Usage:
$ run-p [--help | -h | --version | -v]
Expand Down Expand Up @@ -85,8 +70,8 @@ The following 2 commands are similar.
The `run-p` command is shorter and **available on Windows**.

```
> run-p lint build
> npm run lint & npm run build
$ run-p lint build
$ npm run lint & npm run build
```

**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`).
Expand All @@ -100,14 +85,14 @@ We can use [glob]-like patterns to specify npm-scripts.
The difference is one -- the separator is `:` instead of `/`.

```
> run-p watch:*
$ run-p watch:*
```

In this case, runs sub scripts of `watch`. For example: `watch:html`, `watch:js`.
But, doesn't run sub-sub scripts. For example: `watch:js:index`.

```
> run-p watch:**
$ run-p watch:**
```

If we use a globstar `**`, runs both sub scripts and sub-sub scripts.
Expand All @@ -120,8 +105,8 @@ We can enclose a script name or a pattern in quotes to use arguments.
The following 2 commands are similar.

```
> run-p "build:* -- --watch"
> npm run build:aaa -- --watch & npm run build:bbb -- --watch
$ run-p "build:* -- --watch"
$ npm run build:aaa -- --watch & npm run build:bbb -- --watch
```

When we use a pattern, arguments are forwarded to every matched script.
Expand All @@ -131,7 +116,7 @@ When we use a pattern, arguments are forwarded to every matched script.
We can use placeholders to give the arguments preceded by `--` to scripts.

```
> run-p "start-server -- --port {1}" -- 8080
$ run-p "start-server -- --port {1}" -- 8080
```

This is useful to pass through arguments from `npm run` command.
Expand All @@ -145,7 +130,7 @@ This is useful to pass through arguments from `npm run` command.
```

```
> npm run start 8080
$ npm run start 8080
> example@0.0.0 start /path/to/package.json
> run-p "start-server -- --port {1}" -- "8080"
Expand Down
31 changes: 8 additions & 23 deletions docs/run-s.md
Expand Up @@ -6,21 +6,6 @@
A CLI command to run given npm-scripts sequentially.
This command is the shorthand of `npm-run-all -s`.

```
> run-s lint build:* test
```

## Installation

```
> npm install -g npm-run-all
```

- Requires `Node@>=0.10` and `npm@>=2`
- The `npm-run-all` package introduces 3 CLI commands: `npm-run-all`, `run-s`, and `run-p`.

## Usage

```
Usage:
$ run-s [--help | -h | --version | -v]
Expand Down Expand Up @@ -79,8 +64,8 @@ The following 2 commands are the same.
The `run-s` command is shorter.

```
> run-s clean lint build
> npm run clean && npm run lint && npm run build
$ run-s clean lint build
$ npm run clean && npm run lint && npm run build
```

**Note:** If a script exited with a non-zero code, the following scripts are not run.
Expand All @@ -91,14 +76,14 @@ We can use [glob]-like patterns to specify npm-scripts.
The difference is one -- the separator is `:` instead of `/`.

```
> run-s build:*
$ run-s build:*
```

In this case, runs sub scripts of `build`. For example: `build:html`, `build:js`.
But, doesn't run sub-sub scripts. For example: `build:js:index`.

```
> run-s build:**
$ run-s build:**
```

If we use a globstar `**`, runs both sub scripts and sub-sub scripts.
Expand All @@ -111,8 +96,8 @@ We can enclose a script name or a pattern in quotes to use arguments.
The following 2 commands are the same.

```
> run-s start:server "delay 3000" start:client
> npm run start:server && npm run delay 3000 && npm run start:client
$ run-s start:server "delay 3000" start:client
$ npm run start:server && npm run delay 3000 && npm run start:client
```

When we use a pattern, arguments are forwarded to every matched script.
Expand All @@ -122,7 +107,7 @@ When we use a pattern, arguments are forwarded to every matched script.
We can use placeholders to give the arguments preceded by `--` to scripts.

```
> run-s build "start-server -- --port {1}" -- 8080
$ run-s build "start-server -- --port {1}" -- 8080
```

This is useful to pass through arguments from `npm run` command.
Expand All @@ -136,7 +121,7 @@ This is useful to pass through arguments from `npm run` command.
```

```
> npm run start 8080
$ npm run start 8080
> example@0.0.0 start /path/to/package.json
> run-s build "start-server -- --port {1}" -- "8080"
Expand Down

0 comments on commit 8c8bec0

Please sign in to comment.