From ed9f45a264a27768987f8c79045b9f66284bf4ca Mon Sep 17 00:00:00 2001 From: Pascal Jufer Date: Fri, 19 Aug 2022 10:29:01 +0200 Subject: [PATCH] Add a simple hint for the shorthand alias --- README.md | 55 ++++++++++++++++++++++++----------------------- package-lock.json | 1 + 2 files changed, 29 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index f33d93c2..e6a94db8 100644 --- a/README.md +++ b/README.md @@ -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: @@ -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 @@ -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: @@ -133,7 +134,7 @@ 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). @@ -141,7 +142,7 @@ Good frontend one-liner example [here](https://github.com/kimmobrunfeldt/dont-co Help: ``` -conc [options] +concurrently [options] General -m, --max-processes How many processes should run at once. @@ -151,8 +152,8 @@ General template. Example names: "main,browser,server" [string] --name-separator The character to split 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: @@ -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 '{}' 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 ``` diff --git a/package-lock.json b/package-lock.json index 696ed5da..ae3c4714 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,6 +20,7 @@ "yargs": "^17.3.1" }, "bin": { + "conc": "dist/bin/concurrently.js", "concurrently": "dist/bin/concurrently.js" }, "devDependencies": {