Skip to content

Commit

Permalink
Add a simple hint for the shorthand alias
Browse files Browse the repository at this point in the history
  • Loading branch information
paescuj committed Aug 19, 2022
1 parent 2adc522 commit ed9f45a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 27 deletions.
55 changes: 28 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,13 @@ npm install concurrently --save

## Usage

`concurrently` has an alias `conc`. I use conc throughout the following, but you can always replace `conc` with `concurrently`
> **Note**
> The `concurrently` command is now also available under the shorthand alias `conc`.
Remember to surround separate commands with quotes:

```bash
conc "command1 arg" "command2 arg"
concurrently "command1 arg" "command2 arg"
```

Otherwise **concurrently** would try to run 4 separate commands:
Expand All @@ -71,16 +72,16 @@ Otherwise **concurrently** would try to run 4 separate commands:
In package.json, escape quotes:

```bash
"start": "conc \"command1 arg\" \"command2 arg\""
"start": "concurrently \"command1 arg\" \"command2 arg\""
```

NPM run commands can be shortened:

```bash
conc "npm:watch-js" "npm:watch-css" "npm:watch-node"
concurrently "npm:watch-js" "npm:watch-css" "npm:watch-node"

# Equivalent to:
conc -n watch-js,watch-css,watch-node "npm run watch-js" "npm run watch-css" "npm run watch-node"
concurrently -n watch-js,watch-css,watch-node "npm run watch-js" "npm run watch-css" "npm run watch-node"
```

NPM shortened commands also support wildcards. Given the following scripts in
Expand All @@ -101,17 +102,17 @@ package.json:
```

```bash
conc "npm:watch-*"
concurrently "npm:watch-*"

# Equivalent to:
conc -n js,css,node "npm run watch-js" "npm run watch-css" "npm run watch-node"
concurrently -n js,css,node "npm run watch-js" "npm run watch-css" "npm run watch-node"

# Any name provided for the wildcard command will be used as a prefix to the wildcard
# part of the script name:
conc -n w: npm:watch-*
concurrently -n w: npm:watch-*

# Equivalent to:
conc -n w:js,w:css,w:node "npm run watch-js" "npm run watch-css" "npm run watch-node"
concurrently -n w:js,w:css,w:node "npm run watch-js" "npm run watch-css" "npm run watch-node"
```

Exclusion is also supported. Given the following scripts in package.json:
Expand All @@ -133,15 +134,15 @@ Exclusion is also supported. Given the following scripts in package.json:
```bash
# Running only lint:js and lint:ts
# with lint:fix:js and lint:fix:ts excluded
conc "npm:lint:*(!fix)"
concurrently "npm:lint:*(!fix)"
```

Good frontend one-liner example [here](https://github.com/kimmobrunfeldt/dont-copy-paste-this-frontend-template/blob/5cd2bde719654941bdfc0a42c6f1b8e69ae79980/package.json#L9).

Help:

```
conc [options] <command ...>
concurrently [options] <command ...>
General
-m, --max-processes How many processes should run at once.
Expand All @@ -151,8 +152,8 @@ General
template.
Example names: "main,browser,server" [string]
--name-separator The character to split <names> on. Example usage:
conc -n "styles|scripts|server"
--name-separator "|" [default: ","]
-n "styles|scripts|server" --name-separator "|"
[default: ","]
-s, --success Which command(s) must exit with code 0 in order
for concurrently exit with code 0 too. Options
are:
Expand Down Expand Up @@ -234,65 +235,65 @@ Examples:
- Output nothing more than stdout+stderr of child processes
$ conc --raw "npm run watch-less" "npm run watch-js"
$ concurrently --raw "npm run watch-less" "npm run watch-js"
- Normal output but without colors e.g. when logging to file
$ conc --no-color "grunt watch" "http-server" > log
$ concurrently --no-color "grunt watch" "http-server" > log
- Custom prefix
$ conc --prefix "{time}-{pid}" "npm run watch" "http-server"
$ concurrently --prefix "{time}-{pid}" "npm run watch" "http-server"
- Custom names and colored prefixes
$ conc --names "HTTP,WATCH" -c "bgBlue.bold,bgMagenta.bold"
$ concurrently --names "HTTP,WATCH" -c "bgBlue.bold,bgMagenta.bold"
"http-server" "npm run watch"
- Configuring via environment variables with CONCURRENTLY_ prefix
$ CONCURRENTLY_RAW=true CONCURRENTLY_KILL_OTHERS=true conc "echo
$ CONCURRENTLY_RAW=true CONCURRENTLY_KILL_OTHERS=true concurrently "echo
hello" "echo world"
- Send input to default
$ conc --handle-input "nodemon" "npm run watch-js"
$ concurrently --handle-input "nodemon" "npm run watch-js"
rs # Sends rs command to nodemon process
- Send input to specific child identified by index
$ conc --handle-input "npm run watch-js" nodemon
$ concurrently --handle-input "npm run watch-js" nodemon
1:rs
- Send input to specific child identified by name
$ conc --handle-input -n js,srv "npm run watch-js" nodemon
$ concurrently --handle-input -n js,srv "npm run watch-js" nodemon
srv:rs
- Shortened NPM run commands
$ conc npm:watch-node npm:watch-js npm:watch-css
$ concurrently npm:watch-node npm:watch-js npm:watch-css
- Shortened NPM run command with wildcard (make sure to wrap it in quotes!)
$ conc "npm:watch-*"
$ concurrently "npm:watch-*"
- Exclude patterns so that between "lint:js" and "lint:fix:js", only "lint:js"
is ran
$ conc "npm:*(!fix)"
$ concurrently "npm:*(!fix)"
- Passthrough some additional arguments via '{<number>}' placeholder
$ conc -P "echo {1}" -- foo
$ concurrently -P "echo {1}" -- foo
- Passthrough all additional arguments via '{@}' placeholder
$ conc -P "npm:dev-* -- {@}" -- --watch --noEmit
$ concurrently -P "npm:dev-* -- {@}" -- --watch --noEmit
- Passthrough all additional arguments combined via '{*}' placeholder
$ conc -P "npm:dev-* -- {*}" -- --watch --noEmit
$ concurrently -P "npm:dev-* -- {*}" -- --watch --noEmit
For more details, visit https://github.com/open-cli-tools/concurrently
```
Expand Down
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ed9f45a

Please sign in to comment.