update
This commit is contained in:
11
node_modules/concurrently/docs/cli/configuration.md
generated
vendored
Normal file
11
node_modules/concurrently/docs/cli/configuration.md
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
# Configuration
|
||||
|
||||
You might want to configure concurrently to always have certain flags on.
|
||||
Any of concurrently's flags can be set via environment variables that are prefixed with `CONCURRENTLY_`.
|
||||
|
||||
```bash
|
||||
$ export CONCURRENTLY_KILL_OTHERS=true
|
||||
$ export CONCURRENTLY_HANDLE_INPUT=true
|
||||
# Equivalent to passing --kill-others and --handle-input
|
||||
$ concurrently nodemon "echo 'hey nodemon, you won't last long'"
|
||||
```
|
40
node_modules/concurrently/docs/cli/input-handling.md
generated
vendored
Normal file
40
node_modules/concurrently/docs/cli/input-handling.md
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
# Input Handling
|
||||
|
||||
By default, concurrently doesn't send input to any commands it spawns.<br/>
|
||||
In the below example, typing `rs` to manually restart [nodemon](https://nodemon.io/) does nothing:
|
||||
|
||||
```bash
|
||||
$ concurrently "nodemon" "npm run watch-js"
|
||||
rs
|
||||
```
|
||||
|
||||
To turn on input handling, it's necessary to set the `--handle-input`/`-i` flag.<br/>
|
||||
This will send `rs` to the first command:
|
||||
|
||||
```bash
|
||||
$ concurrently --handle-input "nodemon" "npm run watch-js"
|
||||
rs
|
||||
```
|
||||
|
||||
To send input to a different command instead, it's possible to prefix the input with the command index, followed by a `:`.<br/>
|
||||
For example, the below sends `rs` to the second command:
|
||||
|
||||
```bash
|
||||
$ concurrently --handle-input "npm run watch-js" "nodemon"
|
||||
1:rs
|
||||
```
|
||||
|
||||
If the command has a name, it's also possible to target it using that command's name:
|
||||
|
||||
```bash
|
||||
$ concurrently --handle-input --names js,server "npm run watch-js" "nodemon"
|
||||
server:rs
|
||||
```
|
||||
|
||||
It's also possible to change the default command that receives input.<br/>
|
||||
To do this, set the `--default-input-target` flag to a command's index or name.
|
||||
|
||||
```bash
|
||||
$ concurrently --handle-input --default-input-target 1 "npm run watch-js" "nodemon"
|
||||
rs
|
||||
```
|
35
node_modules/concurrently/docs/cli/output-control.md
generated
vendored
Normal file
35
node_modules/concurrently/docs/cli/output-control.md
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
# Output Control
|
||||
|
||||
concurrently offers a few ways to control a command's output.
|
||||
|
||||
## Hiding
|
||||
|
||||
A command's outputs (and all its events) can be hidden by using the `--hide` flag.
|
||||
|
||||
```bash
|
||||
$ concurrently --hide 0 "echo Hello there" "echo 'General Kenobi!'"
|
||||
[1] General Kenobi!
|
||||
[1] echo 'General Kenobi!' exited with code 0
|
||||
```
|
||||
|
||||
## Grouping
|
||||
|
||||
It might be useful at times to make sure that the commands outputs are grouped together, while running them in parallel.<br/>
|
||||
This can be done with the `--group` flag.
|
||||
|
||||
```bash
|
||||
$ concurrently --group "echo Hello there && sleep 2 && echo 'General Kenobi!'" "echo hi Star Wars fans"
|
||||
[0] Hello there
|
||||
[0] General Kenobi!
|
||||
[0] echo Hello there && sleep 2 && echo 'General Kenobi!' exited with code 0
|
||||
[1] hi Star Wars fans
|
||||
[1] echo hi Star Wars fans exited with code 0
|
||||
```
|
||||
|
||||
## No Colors
|
||||
|
||||
When piping concurrently's outputs to another command or file, you might want to force it to not use colors, as these can break the other command's parsing, or reduce the legibility of the output in non-terminal environments.
|
||||
|
||||
```bash
|
||||
$ concurrently -c red,blue --no-color "echo Hello there" "echo 'General Kenobi!'"
|
||||
```
|
80
node_modules/concurrently/docs/cli/passthrough-arguments.md
generated
vendored
Normal file
80
node_modules/concurrently/docs/cli/passthrough-arguments.md
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
# Passthrough Arguments
|
||||
|
||||
If you have a shortcut for running a specific combination of commands through concurrently,
|
||||
you might need at some point to pass additional arguments/flags to some of these.
|
||||
|
||||
For example, imagine you have in your `package.json` file scripts like this:
|
||||
|
||||
```jsonc
|
||||
{
|
||||
// ...
|
||||
"scripts": {
|
||||
"build:client": "tsc -p client",
|
||||
"build:server": "tsc -p server",
|
||||
"build": "concurrently npm:build:client npm:build:server"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
If you wanted to run only either `build:server` or `build:client` with an additional `--noEmit` flag,
|
||||
you can do so with `npm run build:server -- --noEmit`, for example.<br/>
|
||||
However, if you want to do that while using concurrently, as `npm run build -- --noEmit` for example,
|
||||
you might find that concurrently actually parses `--noEmit` as its own flag, which does nothing,
|
||||
because it doesn't exist.
|
||||
|
||||
To solve this, you can set the `--passthrough-arguments`/`-P` flag, which instructs concurrently to
|
||||
take everything after a `--` as additional arguments that are passed through to the input commands
|
||||
via a few placeholder styles:
|
||||
|
||||
## Single argument
|
||||
|
||||
We can modify the original `build` script to pass a single additional argument/flag to a script by using
|
||||
a 1-indexed `{number}` placeholder to the command you want it to apply to:
|
||||
|
||||
```jsonc
|
||||
{
|
||||
// ...
|
||||
"scripts": {
|
||||
// ...
|
||||
"build": "concurrently -P 'npm:build:client -- {1}' npm:build:server --",
|
||||
"typecheck": "npm run build -- --noEmit"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
With this, running `npm run typecheck` will pass `--noEmit` only to `npm run build:client`.
|
||||
|
||||
## All arguments
|
||||
|
||||
In the original `build` example script, you're more likely to want to pass every additional argument/flag
|
||||
to your commands. This can be done with the `{@}` placeholder.
|
||||
|
||||
```jsonc
|
||||
{
|
||||
// ...
|
||||
"scripts": {
|
||||
// ...
|
||||
"build": "concurrently -P 'npm:build:client -- {@}' 'npm:build:server -- {@}' --",
|
||||
"typecheck": "npm run build -- --watch --noEmit"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
In the above example, both `--watch` and `--noEmit` are passed to each command.
|
||||
|
||||
## All arguments, combined
|
||||
|
||||
If for some reason you wish to combine all additional arguments into a single one, you can do that with the `{*}` placeholder,
|
||||
which wraps the arguments in quotes.
|
||||
|
||||
```jsonc
|
||||
{
|
||||
// ...
|
||||
"scripts": {
|
||||
// ...
|
||||
"build": "concurrently -P 'npm:build:client -- --outDir {*}/client' 'npm:build:server -- --outDir {*}/server' -- $(date)"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
In the above example, the output of the `date` command, which looks like `Sun 1 Sep 2024 23:50:00 AEST` will be passed as a single string to the `--outDir` parameter of both commands.
|
147
node_modules/concurrently/docs/cli/prefixing.md
generated
vendored
Normal file
147
node_modules/concurrently/docs/cli/prefixing.md
generated
vendored
Normal file
@@ -0,0 +1,147 @@
|
||||
# Prefixing
|
||||
|
||||
## Prefix Styles
|
||||
|
||||
concurrently will by default prefix each command's outputs with a zero-based index, wrapped in square brackets:
|
||||
|
||||
```bash
|
||||
$ concurrently "echo Hello there" "echo 'General Kenobi!'"
|
||||
[0] Hello there
|
||||
[1] General Kenobi!
|
||||
[0] echo Hello there exited with code 0
|
||||
[1] echo 'General Kenobi!' exited with code 0
|
||||
```
|
||||
|
||||
If you've given the commands names, they are used instead:
|
||||
|
||||
```bash
|
||||
$ concurrently --names one,two "echo Hello there" "echo 'General Kenobi!'"
|
||||
[one] Hello there
|
||||
[two] General Kenobi!
|
||||
[one] echo Hello there exited with code 0
|
||||
[two] echo 'General Kenobi!' exited with code 0
|
||||
```
|
||||
|
||||
There are other prefix styles available too:
|
||||
|
||||
| Style | Description |
|
||||
| --------- | --------------------------------- |
|
||||
| `index` | Zero-based command's index |
|
||||
| `name` | The command's name |
|
||||
| `command` | The command's line |
|
||||
| `time` | Time of output |
|
||||
| `pid` | ID of the command's process (PID) |
|
||||
| `none` | No prefix |
|
||||
|
||||
Any of these can be used by setting the `--prefix`/`-p` flag. For example:
|
||||
|
||||
```bash
|
||||
$ concurrently --prefix pid "echo Hello there" "echo 'General Kenobi!'"
|
||||
[2222] Hello there
|
||||
[2223] General Kenobi!
|
||||
[2222] echo Hello there exited with code 0
|
||||
[2223] echo 'General Kenobi!' exited with code 0
|
||||
```
|
||||
|
||||
It's also possible to have a prefix based on a template. Any of the styles listed above can be used by wrapping it in `{}`.
|
||||
Doing so will also remove the square brackets:
|
||||
|
||||
```bash
|
||||
$ concurrently --prefix "{index}-{pid}" "echo Hello there" "echo 'General Kenobi!'"
|
||||
0-2222 Hello there
|
||||
1-2223 General Kenobi!
|
||||
0-2222 echo Hello there exited with code 0
|
||||
1-2223 echo 'General Kenobi!' exited with code 0
|
||||
```
|
||||
|
||||
## Prefix Colors
|
||||
|
||||
By default, there are no colors applied to concurrently prefixes, and they just use whatever the terminal's defaults are.
|
||||
|
||||
This can be changed by using the `--prefix-colors`/`-c` flag, which takes a comma-separated list of colors to use.<br/>
|
||||
The available values are color names (e.g. `green`, `magenta`, `gray`, etc), a hex value (such as `#23de43`), or `auto`, to automatically select a color.
|
||||
|
||||
```bash
|
||||
$ concurrently -c red,blue "echo Hello there" "echo 'General Kenobi!'"
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>List of available color names</summary>
|
||||
|
||||
- `black`
|
||||
- `blue`
|
||||
- `cyan`
|
||||
- `green`
|
||||
- `gray`
|
||||
- `magenta`
|
||||
- `red`
|
||||
- `white`
|
||||
- `yellow`
|
||||
</details>
|
||||
|
||||
Colors can take modifiers too. Several can be applied at once by prepending `.<modifier 1>.<modifier 2>` and so on.
|
||||
|
||||
```bash
|
||||
$ concurrently -c red,bold.blue.dim "echo Hello there" "echo 'General Kenobi!'"
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>List of available modifiers</summary>
|
||||
|
||||
- `reset`
|
||||
- `bold`
|
||||
- `dim`
|
||||
- `hidden`
|
||||
- `inverse`
|
||||
- `italic`
|
||||
- `strikethrough`
|
||||
- `underline`
|
||||
</details>
|
||||
|
||||
A background color can be set in a similary fashion.
|
||||
|
||||
```bash
|
||||
$ concurrently -c bgGray,red.bgBlack "echo Hello there" "echo 'General Kenobi!'"
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>List of available background color names</summary>
|
||||
|
||||
- `bgBlack`
|
||||
- `bgBlue`
|
||||
- `bgCyan`
|
||||
- `bgGreen`
|
||||
- `bgGray`
|
||||
- `bgMagenta`
|
||||
- `bgRed`
|
||||
- `bgWhite`
|
||||
- `bgYellow`
|
||||
</details>
|
||||
|
||||
## Prefix Length
|
||||
|
||||
When using the `command` prefix style, it's possible that it'll be too long.<br/>
|
||||
It can be limited by setting the `--prefix-length`/`-l` flag:
|
||||
|
||||
```bash
|
||||
$ concurrently -p command -l 10 "echo Hello there" "echo 'General Kenobi!'"
|
||||
[echo..here] Hello there
|
||||
[echo..bi!'] General Kenobi!
|
||||
[echo..here] echo Hello there exited with code 0
|
||||
[echo..bi!'] echo 'General Kenobi!' exited with code 0
|
||||
```
|
||||
|
||||
It's also possible that some prefixes are too short, and you want all of them to have the same length.<br/>
|
||||
This can be done by setting the `--pad-prefix` flag:
|
||||
|
||||
```bash
|
||||
$ concurrently -n foo,barbaz --pad-prefix "echo Hello there" "echo 'General Kenobi!'"
|
||||
[foo ] Hello there
|
||||
[foo ] echo Hello there exited with code 0
|
||||
[barbaz] General Kenobi!
|
||||
[barbaz] echo 'General Kenobi!' exited with code 0
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> If using the `pid` prefix style in combination with [`--restart-tries`](./restarting.md), the length of the PID might grow, in which case all subsequent lines will match the new length.<br/>
|
||||
> This might happen, for example, if the PID was 99 and it's now 100.
|
38
node_modules/concurrently/docs/cli/restarting.md
generated
vendored
Normal file
38
node_modules/concurrently/docs/cli/restarting.md
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
# Restarting Commands
|
||||
|
||||
Sometimes it's useful to have commands that exited with a non-zero status to restart automatically.<br/>
|
||||
concurrently lets you configure how many times you wish for such a command to restart through the `--restart-tries` flag:
|
||||
|
||||
```bash
|
||||
$ concurrently --restart-tries 2 "exit 1"
|
||||
[0] exit 1 exited with code 1
|
||||
[0] exit 1 restarted
|
||||
[0] exit 1 exited with code 1
|
||||
[0] exit 1 restarted
|
||||
[0] exit 1 exited with code 1
|
||||
```
|
||||
|
||||
Sometimes, it might be interesting to have commands wait before restarting.<br/>
|
||||
To do this, simply set `--restart-after` to a the number of milliseconds you'd like to delay restarting.
|
||||
|
||||
```bash
|
||||
$ concurrently -p time --restart-tries 1 --restart-after 3000 "exit 1"
|
||||
[2024-09-01 23:43:55.871] exit 1 exited with code 1
|
||||
[2024-09-01 23:43:58.874] exit 1 restarted
|
||||
[2024-09-01 23:43:58.891] exit 1 exited with code 1
|
||||
```
|
||||
|
||||
If a command is not having success spawning, you might want to instead apply an exponential back-off.<br/>
|
||||
Set `--restart-after exponential` to have commands respawn with a `2^N` seconds delay.
|
||||
|
||||
```bash
|
||||
$ concurrently -p time --restart-tries 3 --restart-after exponential "exit 1"
|
||||
|
||||
[2024-09-01 23:49:01.124] exit 1 exited with code 1
|
||||
[2024-09-01 23:49:02.127] exit 1 restarted
|
||||
[2024-09-01 23:49:02.139] exit 1 exited with code 1
|
||||
[2024-09-01 23:49:04.141] exit 1 restarted
|
||||
[2024-09-01 23:49:04.157] exit 1 exited with code 1
|
||||
[2024-09-01 23:49:08.158] exit 1 restarted
|
||||
[2024-09-01 23:49:08.174] exit 1 exited with code 1
|
||||
```
|
73
node_modules/concurrently/docs/cli/shortcuts.md
generated
vendored
Normal file
73
node_modules/concurrently/docs/cli/shortcuts.md
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
# Command Shortcuts
|
||||
|
||||
Package managers that execute scripts from a `package.json` or `deno.(json|jsonc)` file can be shortened when in concurrently.<br/>
|
||||
The following are supported:
|
||||
|
||||
| Syntax | Expands to |
|
||||
| --------------- | --------------------- |
|
||||
| `npm:<script>` | `npm run <script>` |
|
||||
| `pnpm:<script>` | `pnpm run <script>` |
|
||||
| `yarn:<script>` | `yarn run <script>` |
|
||||
| `bun:<script>` | `bun run <script>` |
|
||||
| `node:<script>` | `node --run <script>` |
|
||||
| `deno:<script>` | `deno task <script>` |
|
||||
|
||||
> [!NOTE]
|
||||
>
|
||||
> `node --run` is only available from [Node 22 onwards](https://nodejs.org/en/blog/announcements/v22-release-announce#running-packagejson-scripts).
|
||||
|
||||
For example, given the following `package.json` contents:
|
||||
|
||||
```jsonc
|
||||
{
|
||||
// ...
|
||||
"scripts": {
|
||||
"lint:js": "...",
|
||||
"lint:ts": "...",
|
||||
"lint:fix:js": "...",
|
||||
"lint:fix:ts": "..."
|
||||
// ...
|
||||
}
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
It's possible to run some of these with the following command line:
|
||||
|
||||
```bash
|
||||
$ concurrently "pnpm:lint:js"
|
||||
# Is equivalent to
|
||||
$ concurrently -n lint:js "pnpm run lint:js"
|
||||
```
|
||||
|
||||
Note that the command automatically receives a name equal to the script name.
|
||||
|
||||
If you have several scripts with similar name patterns, you can use the `*` wildcard to run all of them at once.<br/>
|
||||
The spawned commands will receive names set to whatever the `*` wildcard matched.
|
||||
|
||||
```bash
|
||||
$ concurrently "npm:lint:fix:*"
|
||||
# is equivalent to
|
||||
$ concurrently -n js,ts "npm run lint:fix:js" "npm run lint:fix:ts"
|
||||
```
|
||||
|
||||
If you specify a command name when using wildcards, it'll be a prefix of what the `*` wildcard matched:
|
||||
|
||||
```bash
|
||||
$ concurrently -n fix: "npm:lint:fix:*"
|
||||
# is equivalent to
|
||||
$ concurrently -n fix:js,fix:ts "npm run lint:fix:js" "npm run lint:fix:ts"
|
||||
```
|
||||
|
||||
Filtering out commands matched by wildcard is also possible. Do this with by including `(!<some pattern>)` in the command line:
|
||||
|
||||
```bash
|
||||
$ concurrently 'yarn:lint:*(!fix)'
|
||||
# is equivalent to
|
||||
$ concurrently -n js,ts "yarn run lint:js" "yarn run lint:ts"
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> If you use this syntax with double quotes (`"`), bash and other shells might fail
|
||||
> parsing it. You'll need to escape the `!`, or use single quote (`'`) instead.<br/>
|
||||
> See [here](https://serverfault.com/a/208266/160539) for more information.
|
Reference in New Issue
Block a user