diff --git a/README.md b/README.md index 1f92edd9..00aebf16 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Run multiple commands concurrently. Like `npm run watch-js & npm run watch-less` but better. -![Demo](docs/demo.gif) +![Demo](assets/demo.gif) **Table of Contents** @@ -17,10 +17,13 @@ Like `npm run watch-js & npm run watch-less` but better. - [Why](#why) - [Installation](#installation) - [Usage](#usage) - - [API](#api) - - [`concurrently(commands[, options])`](#concurrentlycommands-options) - - [`Command`](#command) - - [`CloseEvent`](#closeevent) + - [CLI options](#cli-options) + - [General options](#general) + - [Styling](#styling) + - [Input handling](#input-handling) + - [Killing other processes](#killing-other-processes) + - [Restarting](#restarting) + - [API](docs/modules.md) - [FAQ](#faq) ## Why @@ -138,282 +141,165 @@ 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: +### CLI options : -``` +```bash concurrently [options] +``` -General - -m, --max-processes How many processes should run at once. - Exact number or a percent of CPUs available (for example "50%"). - New processes only spawn after all restart tries - of a process. [string] - -n, --names List of custom names to be used in prefix - template. - Example names: "main,browser,server" [string] - --name-separator The character to split on. Example usage: - -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: - - "first" for the first command to exit; - - "last" for the last command to exit; - - "all" for all commands; - - "command-{name}"/"command-{index}" for the - commands with that name or index; - - "!command-{name}"/"!command-{index}" for all - commands but the ones with that name or index. - [default: "all"] - -r, --raw Output only raw output of processes, disables - prettifying and concurrently coloring. [boolean] - --no-color Disables colors from logging [boolean] - --hide Comma-separated list of processes to hide the - output. - The processes can be identified by their name or - index. [string] [default: ""] - -g, --group Order the output as if the commands were run - sequentially. [boolean] - --timings Show timing information for all processes. - [boolean] [default: false] - -P, --passthrough-arguments Passthrough additional arguments to commands - (accessible via placeholders) instead of treating - them as commands. [boolean] [default: false] - -Prefix styling - -p, --prefix Prefix used in logging for each process. - Possible values: index, pid, time, command, name, - none, or a template. Example template: "{time}-{pid}" - [string] [default: index or name (when --names is set)] - -c, --prefix-colors Comma-separated list of chalk colors to use on - prefixes. If there are more commands than colors, the - last color will be repeated. - - Available modifiers: reset, bold, dim, italic, - underline, inverse, hidden, strikethrough - - Available colors: black, red, green, yellow, blue, - magenta, cyan, white, gray, - any hex values for colors (e.g. #23de43) or auto for - an automatically picked color - - Available background colors: bgBlack, bgRed, - bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite - See https://www.npmjs.com/package/chalk for more - information. [string] [default: "reset"] - -l, --prefix-length Limit how many characters of the command is displayed - in prefix. The option can be used to shorten the - prefix when it is set to "command" - [number] [default: 10] - -t, --timestamp-format Specify the timestamp in moment/date-fns format. - [string] [default: "yyyy-MM-dd HH:mm:ss.SSS"] +### General -Input handling - -i, --handle-input Whether input should be forwarded to the child - processes. See examples for more information. - [boolean] - --default-input-target Identifier for child process to which input on - stdin should be sent if not specified at start of - input. - Can be either the index or the name of the - process. [default: 0] +| options | description | +| ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `-h, --help` | Show help | +| `-v, -V, --version` | Show version number | +| `-m, --max-processes` | How many processes should run at once. Exact number or a percent of CPUs available (for example "50%"). New processes only spawn after all restart tries of a process. | +| `-n, --names` | List of custom names to be used in prefix template. | +| `--name-separator` | The character to split on. | +| ` -s, --success` |

Which command(s) must exit with code 0 in order for concurrently exit with code 0 too.
Options are:
 - "first" for the first command to exit;
 - "last" for the last command to exit;
 - "all" for all commands;
 - "command-{name}"/"command-{index}" for the commands with that name or index;
 - "!command-{name}"/"!command-{index}" for all commands but the ones with that name or index.

| +| `-r, --raw` | Output only raw output of processes, disables prettifying and concurrently coloring. | +| `--no-color` | Disables colors from logging | +| `--hide` | Comma-separated list of processes to hide the output. The processes can be identified by their name or index. | +| `-g, --group` | Order the output as if the commands were run sequentially. | +| `--timings` | Show timing information for all processes. | +| `-P, --passthrough-arguments` | Passthrough additional arguments to commands (accessible via placeholders) instead of treating them as commands. | -Killing other processes - -k, --kill-others Kill other processes if one exits or dies.[boolean] - --kill-others-on-fail Kill other processes if one exits with non zero - status code. [boolean] - --kill-signal Signal to send to other processes if one exits or dies. - (SIGTERM/SIGKILL, defaults to SIGTERM) [string] +### Styling -Restarting - --restart-tries How many times a process that died should restart. - Negative numbers will make the process restart forever. - [number] [default: 0] - --restart-after Delay time to respawn the process, in milliseconds. - [number] [default: 0] +| options | description | +| ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `-p, --prefix` | Prefix used in logging for each process
Possible values: index, pid, time, command, name, none, or a template.
Example template: `"{time}-{pid}"` | +| `-c, --prefix-colors` | Comma-separated list of chalk colors to use on prefixes. If there are more commands than colors, the last color will be repeated.
 - Available modifiers: reset, bold, dim, italic,underline, inverse, hidden, strikethrough
 - Available colors: black, red, green, yellow, blue,magenta, cyan, white, gray,any hex values for colors (e.g. #23de43) or auto for an automatically picked color
 - Available background colors: `bgBlack`, `bgRed`,`bgGreen`, `bgYellow`, `bgBlue`, `bgMagenta`, `bgCyan`, `bgWhite`
See https://www.npmjs.com/package/chalk for more information. | +| `-l, --prefix-length` | Limit how many characters of the command is displayed in prefix. The option can be used to shorten the prefix when it is set to "command" | +| `-t, --timestamp-format` | Specify the timestamp in moment/date-fns format. | -Options: - -h, --help Show help [boolean] - -v, -V, --version Show version number [boolean] +### Input handling +| options | description | +| ------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `-i, --handle-input` | Whether input should be forwarded to the child processes. See examples for more information. | +| `--default-input-target` | Identifier for child process to which input on stdin should be sent if not specified at start of input.
Can be either the index or the name of the process. | -Examples: +### Killing other processes - - Output nothing more than stdout+stderr of child processes +| options | description | +| ----------------------- | ---------------------------------------------------------------------------------------------- | +| ` -k, --kill-others` | Kill other processes if one exits or dies. | +| `--kill-others-on-fail` | Kill other processes if one exits with non zero status code. | +| `--kill-signal` | Signal to send to other processes if one exits or dies. (SIGTERM/SIGKILL, defaults to SIGTERM) | - $ concurrently --raw "npm run watch-less" "npm run watch-js" +### Restarting - - Normal output but without colors e.g. when logging to file +| options | description | +| ----------------- | -------------------------------------------------------------------------------------------------------------- | +| `--restart-tries` | How many times a process that died should restart.
Negative numbers will make the process restart forever. | +| `--restart-after` | Delay time to respawn the process, in milliseconds. | - $ concurrently --no-color "grunt watch" "http-server" > log +### Examples: - - Custom prefix +- Output nothing more than stdout+stderr of child processes - $ concurrently --prefix "{time}-{pid}" "npm run watch" "http-server" +```bash + $ concurrently --raw "npm run watch-less" "npm run watch-js" +``` - - Custom names and colored prefixes +- Normal output but without colors e.g. when logging to file - $ concurrently --names "HTTP,WATCH" -c "bgBlue.bold,bgMagenta.bold" - "http-server" "npm run watch" +```bash + $ concurrently --no-color "grunt watch" "http-server" > log +``` - - Auto varying colored prefixes +- Custom prefix - $ concurrently -c "auto" "npm run watch" "http-server" +```bash + $ concurrently --prefix "{time}-{pid}" "npm run watch" "http-server" +``` - - Mixing auto and manual colored prefixes +- Custom names and colored prefixes - $ concurrently -c "red,auto" "npm run watch" "http-server" "echo hello" +```bash + $ concurrently --names "HTTP,WATCH" -c "bgBlue.bold,bgMagenta.bold" + "http-server" "npm run watch" +``` - - Configuring via environment variables with CONCURRENTLY_ prefix +- Auto varying colored prefixes - $ CONCURRENTLY_RAW=true CONCURRENTLY_KILL_OTHERS=true concurrently "echo - hello" "echo world" +```bash + $ concurrently -c "auto" "npm run watch" "http-server" +``` - - Send input to default +- Mixing auto and manual colored prefixes - $ concurrently --handle-input "nodemon" "npm run watch-js" - rs # Sends rs command to nodemon process +```bash + $ concurrently -c "red,auto" "npm run watch" "http-server" "echo hello" +``` - - Send input to specific child identified by index +- Configuring via environment variables with CONCURRENTLY\_ prefix - $ concurrently --handle-input "npm run watch-js" nodemon - 1:rs +```bash + $ CONCURRENTLY_RAW=true CONCURRENTLY_KILL_OTHERS=true concurrently "echo + hello" "echo world" +``` - - Send input to specific child identified by name +- Send input to default - $ concurrently --handle-input -n js,srv "npm run watch-js" nodemon - srv:rs +```bash + $ concurrently --handle-input "nodemon" "npm run watch-js" + rs # Sends rs command to nodemon process +``` - - Shortened NPM run commands +- Send input to specific child identified by index - $ concurrently npm:watch-node npm:watch-js npm:watch-css +```bash + $ concurrently --handle-input "npm run watch-js" nodemon + 1:rs +``` - - Shortened NPM run command with wildcard (make sure to wrap it in quotes!) +- Send input to specific child identified by name - $ concurrently "npm:watch-*" +```bash + $ concurrently --handle-input -n js,srv "npm run watch-js" nodemon + srv:rs +``` - - Exclude patterns so that between "lint:js" and "lint:fix:js", only "lint:js" - is ran +- Shortened NPM run commands - $ concurrently "npm:*(!fix)" +```bash + $ concurrently npm:watch-node npm:watch-js npm:watch-css +``` + +- Shortened NPM run command with wildcard (make sure to wrap it in quotes!) - - Passthrough some additional arguments via '{}' placeholder +```bash + $ concurrently "npm:watch-\*" +``` - $ concurrently -P "echo {1}" -- foo +- Exclude patterns so that between "lint:js" and "lint:fix:js", only "lint:js" + is ran - - Passthrough all additional arguments via '{@}' placeholder +```bash + $ concurrently "npm:*(!fix)" +``` - $ concurrently -P "npm:dev-* -- {@}" -- --watch --noEmit +- Passthrough some additional arguments via '{}' placeholder - - Passthrough all additional arguments combined via '{*}' placeholder +```bash + $ concurrently -P "echo {1}" -- foo +``` - $ concurrently -P "npm:dev-* -- {*}" -- --watch --noEmit +- Passthrough all additional arguments via '{@}' placeholder -For more details, visit https://github.com/open-cli-tools/concurrently +```bash + $ concurrently -P "npm:dev-\* -- {@}" -- --watch --noEmit ``` -## API - -**concurrently** can be used programmatically by using the API documented below: - -### `concurrently(commands[, options])` - -- `commands`: an array of either strings (containing the commands to run) or objects - with the shape `{ command, name, prefixColor, env, cwd }`. - -- `options` (optional): an object containing any of the below: - - `cwd`: the working directory to be used by all commands. Can be overriden per command. - Default: `process.cwd()`. - - `defaultInputTarget`: the default input target when reading from `inputStream`. - Default: `0`. - - `handleInput`: when `true`, reads input from `process.stdin`. - - `inputStream`: a [`Readable` stream](https://nodejs.org/dist/latest-v10.x/docs/api/stream.html#stream_readable_streams) - to read the input from. Should only be used in the rare instance you would like to stream anything other than `process.stdin`. Overrides `handleInput`. - - `pauseInputStreamOnFinish`: by default, pauses the input stream (`process.stdin` when `handleInput` is enabled, or `inputStream` if provided) when all of the processes have finished. If you need to read from the input stream after `concurrently` has finished, set this to `false`. ([#252](https://github.com/kimmobrunfeldt/concurrently/issues/252)). - - `killOthers`: an array of exitting conditions that will cause a process to kill others. - Can contain any of `success` or `failure`. - - `maxProcesses`: how many processes should run at once. - - `outputStream`: a [`Writable` stream](https://nodejs.org/dist/latest-v10.x/docs/api/stream.html#stream_writable_streams) - to write logs to. Default: `process.stdout`. - - `prefix`: the prefix type to use when logging processes output. - Possible values: `index`, `pid`, `time`, `command`, `name`, `none`, or a template (eg `[{time} process: {pid}]`). - Default: the name of the process, or its index if no name is set. - - `prefixColors`: a list of colors or a string as supported by [chalk](https://www.npmjs.com/package/chalk) and additional style `auto` for an automatically picked color. - If concurrently would run more commands than there are colors, the last color is repeated, unless if the last color value is `auto` which means following colors are automatically picked to vary. - Prefix colors specified per-command take precedence over this list. - - `prefixLength`: how many characters to show when prefixing with `command`. Default: `10` - - `raw`: whether raw mode should be used, meaning strictly process output will - be logged, without any prefixes, coloring or extra stuff. Can be overriden per command. - - `successCondition`: the condition to consider the run was successful. - If `first`, only the first process to exit will make up the success of the run; if `last`, the last process that exits will determine whether the run succeeds. - Anything else means all processes should exit successfully. - - `restartTries`: how many attempts to restart a process that dies will be made. Default: `0`. - - `restartDelay`: how many milliseconds to wait between process restarts. Default: `0`. - - `timestampFormat`: a [date-fns format](https://date-fns.org/v2.0.1/docs/format) - to use when prefixing with `time`. Default: `yyyy-MM-dd HH:mm:ss.ZZZ` - - `additionalArguments`: list of additional arguments passed that will get replaced in each command. If not defined, no argument replacing will happen. - -> **Returns:** an object in the shape `{ result, commands }`. -> -> - `result`: a `Promise` that resolves if the run was successful (according to `successCondition` option), -> or rejects, containing an array of [`CloseEvent`](#CloseEvent), in the order that the commands terminated. -> - `commands`: an array of all spawned [`Command`s](#Command). - -Example: - -```js -const concurrently = require('concurrently'); -const { result } = concurrently( - [ - 'npm:watch-*', - { command: 'nodemon', name: 'server' }, - { command: 'deploy', name: 'deploy', env: { PUBLIC_KEY: '...' } }, - { - command: 'watch', - name: 'watch', - cwd: path.resolve(__dirname, 'scripts/watchers'), - }, - ], - { - prefix: 'name', - killOthers: ['failure', 'success'], - restartTries: 3, - cwd: path.resolve(__dirname, 'scripts'), - }, -); -result.then(success, failure); +- Passthrough all additional arguments combined via '{\*}' placeholder + +```bash + $ concurrently -P "npm:dev-_ -- {_}" -- --watch --noEmit ``` -### `Command` - -An object that contains all information about a spawned command, and ways to interact with it.
-It has the following properties: - -- `index`: the index of the command among all commands spawned. -- `command`: the command line of the command. -- `name`: the name of the command; defaults to an empty string. -- `cwd`: the current working directory of the command. -- `env`: an object with all the environment variables that the command will be spawned with. -- `killed`: whether the command has been killed. -- `exited`: whether the command exited yet. -- `pid`: the command's process ID. -- `stdin`: a Writable stream to the command's `stdin`. -- `stdout`: an RxJS observable to the command's `stdout`. -- `stderr`: an RxJS observable to the command's `stderr`. -- `error`: an RxJS observable to the command's error events (e.g. when it fails to spawn). -- `timer`: an RxJS observable to the command's timing events (e.g. starting, stopping). -- `close`: an RxJS observable to the command's close events. - See [`CloseEvent`](#CloseEvent) for more information. -- `start()`: starts the command, setting up all -- `kill([signal])`: kills the command, optionally specifying a signal (e.g. `SIGTERM`, `SIGKILL`, etc). - -### `CloseEvent` - -An object with information about a command's closing event.
-It contains the following properties: - -- `command`: a stripped down version of [`Command`](#command), including only `name`, `command`, `env` and `cwd` properties. -- `index`: the index of the command among all commands spawned. -- `killed`: whether the command exited because it was killed. -- `exitCode`: the exit code of the command's process, or the signal which it was killed with. -- `timings`: an object in the shape `{ startDate, endDate, durationSeconds }`. +For more details, visit https://github.com/open-cli-tools/concurrently ## FAQ diff --git a/docs/demo.gif b/assets/demo.gif similarity index 100% rename from docs/demo.gif rename to assets/demo.gif diff --git a/docs/frontend-demo.gif b/assets/frontend-demo.gif similarity index 100% rename from docs/frontend-demo.gif rename to assets/frontend-demo.gif diff --git a/docs/kill-demo.gif b/assets/kill-demo.gif similarity index 100% rename from docs/kill-demo.gif rename to assets/kill-demo.gif diff --git a/docs/raw-demo.gif b/assets/raw-demo.gif similarity index 100% rename from docs/raw-demo.gif rename to assets/raw-demo.gif diff --git a/docs/.nojekyll b/docs/.nojekyll new file mode 100644 index 00000000..e2ac6616 --- /dev/null +++ b/docs/.nojekyll @@ -0,0 +1 @@ +TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. \ No newline at end of file diff --git a/docs/classes/Command.md b/docs/classes/Command.md new file mode 100644 index 00000000..656bc493 --- /dev/null +++ b/docs/classes/Command.md @@ -0,0 +1,264 @@ +# Class: Command + +## Implements + +- `CommandInfo` + +## Table of contents + +### Constructors + +- [constructor](Command.md#constructor) + +### Properties + +- [close](Command.md#close) +- [command](Command.md#command) +- [cwd](Command.md#cwd) +- [env](Command.md#env) +- [error](Command.md#error) +- [exited](Command.md#exited) +- [index](Command.md#index) +- [killProcess](Command.md#killprocess) +- [killed](Command.md#killed) +- [name](Command.md#name) +- [pid](Command.md#pid) +- [prefixColor](Command.md#prefixcolor) +- [process](Command.md#process) +- [spawn](Command.md#spawn) +- [spawnOpts](Command.md#spawnopts) +- [stderr](Command.md#stderr) +- [stdin](Command.md#stdin) +- [stdout](Command.md#stdout) +- [timer](Command.md#timer) + +### Accessors + +- [killable](Command.md#killable) + +### Methods + +- [kill](Command.md#kill) +- [start](Command.md#start) +- [canKill](Command.md#cankill) + +## Constructors + +### constructor + +• **new Command**(`«destructured»`, `spawnOpts`, `spawn`, `killProcess`) + +#### Parameters + +| Name | Type | +| :--------------- | :------------------------------------ | +| `«destructured»` | `CommandInfo` & { `index`: `number` } | +| `spawnOpts` | `SpawnOptions` | +| `spawn` | `SpawnCommand` | +| `killProcess` | `KillProcess` | + +## Properties + +### close + +• `Readonly` **close**: `Subject`<[`CloseEvent`](../interfaces/CloseEvent.md)\> + +--- + +### command + +• `Readonly` **command**: `string` + +**`Inherit Doc`** + +#### Implementation of + +CommandInfo.command + +--- + +### cwd + +• `Optional` `Readonly` **cwd**: `string` + +**`Inherit Doc`** + +#### Implementation of + +CommandInfo.cwd + +--- + +### env + +• `Readonly` **env**: `Record`<`string`, `unknown`\> + +**`Inherit Doc`** + +#### Implementation of + +CommandInfo.env + +--- + +### error + +• `Readonly` **error**: `Subject`<`unknown`\> + +--- + +### exited + +• **exited**: `boolean` = `false` + +--- + +### index + +• `Readonly` **index**: `number` + +--- + +### killProcess + +• `Private` `Readonly` **killProcess**: `KillProcess` + +--- + +### killed + +• **killed**: `boolean` = `false` + +--- + +### name + +• `Readonly` **name**: `string` + +**`Inherit Doc`** + +#### Implementation of + +CommandInfo.name + +--- + +### pid + +• `Optional` **pid**: `number` + +--- + +### prefixColor + +• `Optional` `Readonly` **prefixColor**: `string` + +**`Inherit Doc`** + +#### Implementation of + +CommandInfo.prefixColor + +--- + +### process + +• `Optional` **process**: `ChildProcess` + +--- + +### spawn + +• `Private` `Readonly` **spawn**: `SpawnCommand` + +--- + +### spawnOpts + +• `Private` `Readonly` **spawnOpts**: `SpawnOptions` + +--- + +### stderr + +• `Readonly` **stderr**: `Subject`<`Buffer`\> + +--- + +### stdin + +• `Optional` **stdin**: `Writable` + +--- + +### stdout + +• `Readonly` **stdout**: `Subject`<`Buffer`\> + +--- + +### timer + +• `Readonly` **timer**: `Subject`<[`TimerEvent`](../interfaces/TimerEvent.md)\> + +## Accessors + +### killable + +• `get` **killable**(): `boolean` + +#### Returns + +`boolean` + +**`Deprecated`** + +## Methods + +### kill + +▸ **kill**(`code?`): `void` + +Kills this command, optionally specifying a signal to send to it. + +#### Parameters + +| Name | Type | +| :------ | :------- | +| `code?` | `string` | + +#### Returns + +`void` + +--- + +### start + +▸ **start**(): `void` + +Starts this command, piping output, error and close events onto the corresponding observables. + +#### Returns + +`void` + +--- + +### canKill + +▸ `Static` **canKill**(`command`): command is Command & Object + +Detects whether a command can be killed. + +Also works as a type guard on the input `command`. + +#### Parameters + +| Name | Type | +| :-------- | :---------------------- | +| `command` | [`Command`](Command.md) | + +#### Returns + +command is Command & Object diff --git a/docs/classes/InputHandler.md b/docs/classes/InputHandler.md new file mode 100644 index 00000000..a80655ee --- /dev/null +++ b/docs/classes/InputHandler.md @@ -0,0 +1,95 @@ +# Class: InputHandler + +Sends input from concurrently through to commands. + +Input can start with a command identifier, in which case it will be sent to that specific command. +For instance, `0:bla` will send `bla` to command at index `0`, and `server:stop` will send `stop` +to command with name `server`. + +If the input doesn't start with a command identifier, it is then always sent to the default target. + +## Implements + +- [`FlowController`](../interfaces/FlowController.md) + +## Table of contents + +### Constructors + +- [constructor](InputHandler.md#constructor) + +### Properties + +- [defaultInputTarget](InputHandler.md#defaultinputtarget) +- [inputStream](InputHandler.md#inputstream) +- [logger](InputHandler.md#logger) +- [pauseInputStreamOnFinish](InputHandler.md#pauseinputstreamonfinish) + +### Methods + +- [handle](InputHandler.md#handle) + +## Constructors + +### constructor + +• **new InputHandler**(`«destructured»`) + +#### Parameters + +| Name | Type | +| :---------------------------- | :----------------------------------------------------- | +| `«destructured»` | `Object` | +| › `defaultInputTarget?` | [`CommandIdentifier`](../modules.md#commandidentifier) | +| › `inputStream?` | `Readable` | +| › `logger` | [`Logger`](Logger.md) | +| › `pauseInputStreamOnFinish?` | `boolean` | + +## Properties + +### defaultInputTarget + +• `Private` `Readonly` **defaultInputTarget**: [`CommandIdentifier`](../modules.md#commandidentifier) + +--- + +### inputStream + +• `Private` `Optional` `Readonly` **inputStream**: `Readable` + +--- + +### logger + +• `Private` `Readonly` **logger**: [`Logger`](Logger.md) + +--- + +### pauseInputStreamOnFinish + +• `Private` `Readonly` **pauseInputStreamOnFinish**: `boolean` + +## Methods + +### handle + +▸ **handle**(`commands`): `Object` + +#### Parameters + +| Name | Type | +| :--------- | :------------------------ | +| `commands` | [`Command`](Command.md)[] | + +#### Returns + +`Object` + +| Name | Type | +| :---------- | :-------------------------- | +| `commands` | [`Command`](Command.md)[] | +| `onFinish?` | () => `undefined` \| `void` | + +#### Implementation of + +[FlowController](../interfaces/FlowController.md).[handle](../interfaces/FlowController.md#handle) diff --git a/docs/classes/KillOnSignal.md b/docs/classes/KillOnSignal.md new file mode 100644 index 00000000..e724e84f --- /dev/null +++ b/docs/classes/KillOnSignal.md @@ -0,0 +1,65 @@ +# Class: KillOnSignal + +Watches the main concurrently process for signals and sends the same signal down to each spawned +command. + +## Implements + +- [`FlowController`](../interfaces/FlowController.md) + +## Table of contents + +### Constructors + +- [constructor](KillOnSignal.md#constructor) + +### Properties + +- [process](KillOnSignal.md#process) + +### Methods + +- [handle](KillOnSignal.md#handle) + +## Constructors + +### constructor + +• **new KillOnSignal**(`«destructured»`) + +#### Parameters + +| Name | Type | +| :--------------- | :------------- | +| `«destructured»` | `Object` | +| › `process` | `EventEmitter` | + +## Properties + +### process + +• `Private` `Readonly` **process**: `EventEmitter` + +## Methods + +### handle + +▸ **handle**(`commands`): `Object` + +#### Parameters + +| Name | Type | +| :--------- | :------------------------ | +| `commands` | [`Command`](Command.md)[] | + +#### Returns + +`Object` + +| Name | Type | +| :--------- | :------------------------ | +| `commands` | [`Command`](Command.md)[] | + +#### Implementation of + +[FlowController](../interfaces/FlowController.md).[handle](../interfaces/FlowController.md#handle) diff --git a/docs/classes/KillOthers.md b/docs/classes/KillOthers.md new file mode 100644 index 00000000..4de3d23a --- /dev/null +++ b/docs/classes/KillOthers.md @@ -0,0 +1,80 @@ +# Class: KillOthers + +Sends a SIGTERM signal to all commands when one of the commands exits with a matching condition. + +## Implements + +- [`FlowController`](../interfaces/FlowController.md) + +## Table of contents + +### Constructors + +- [constructor](KillOthers.md#constructor) + +### Properties + +- [conditions](KillOthers.md#conditions) +- [killSignal](KillOthers.md#killsignal) +- [logger](KillOthers.md#logger) + +### Methods + +- [handle](KillOthers.md#handle) + +## Constructors + +### constructor + +• **new KillOthers**(`«destructured»`) + +#### Parameters + +| Name | Type | +| :--------------- | :--------------------------------------------------- | +| `«destructured»` | `Object` | +| › `conditions` | `ProcessCloseCondition` \| `ProcessCloseCondition`[] | +| › `killSignal` | `undefined` \| `string` | +| › `logger` | [`Logger`](Logger.md) | + +## Properties + +### conditions + +• `Private` `Readonly` **conditions**: `ProcessCloseCondition`[] + +--- + +### killSignal + +• `Private` `Readonly` **killSignal**: `undefined` \| `string` + +--- + +### logger + +• `Private` `Readonly` **logger**: [`Logger`](Logger.md) + +## Methods + +### handle + +▸ **handle**(`commands`): `Object` + +#### Parameters + +| Name | Type | +| :--------- | :------------------------ | +| `commands` | [`Command`](Command.md)[] | + +#### Returns + +`Object` + +| Name | Type | +| :--------- | :------------------------ | +| `commands` | [`Command`](Command.md)[] | + +#### Implementation of + +[FlowController](../interfaces/FlowController.md).[handle](../interfaces/FlowController.md#handle) diff --git a/docs/classes/LogError.md b/docs/classes/LogError.md new file mode 100644 index 00000000..32621989 --- /dev/null +++ b/docs/classes/LogError.md @@ -0,0 +1,64 @@ +# Class: LogError + +Logs when commands failed executing, e.g. due to the executable not existing in the system. + +## Implements + +- [`FlowController`](../interfaces/FlowController.md) + +## Table of contents + +### Constructors + +- [constructor](LogError.md#constructor) + +### Properties + +- [logger](LogError.md#logger) + +### Methods + +- [handle](LogError.md#handle) + +## Constructors + +### constructor + +• **new LogError**(`«destructured»`) + +#### Parameters + +| Name | Type | +| :--------------- | :-------------------- | +| `«destructured»` | `Object` | +| › `logger` | [`Logger`](Logger.md) | + +## Properties + +### logger + +• `Private` `Readonly` **logger**: [`Logger`](Logger.md) + +## Methods + +### handle + +▸ **handle**(`commands`): `Object` + +#### Parameters + +| Name | Type | +| :--------- | :------------------------ | +| `commands` | [`Command`](Command.md)[] | + +#### Returns + +`Object` + +| Name | Type | +| :--------- | :------------------------ | +| `commands` | [`Command`](Command.md)[] | + +#### Implementation of + +[FlowController](../interfaces/FlowController.md).[handle](../interfaces/FlowController.md#handle) diff --git a/docs/classes/LogExit.md b/docs/classes/LogExit.md new file mode 100644 index 00000000..1a604f59 --- /dev/null +++ b/docs/classes/LogExit.md @@ -0,0 +1,64 @@ +# Class: LogExit + +Logs the exit code/signal of commands. + +## Implements + +- [`FlowController`](../interfaces/FlowController.md) + +## Table of contents + +### Constructors + +- [constructor](LogExit.md#constructor) + +### Properties + +- [logger](LogExit.md#logger) + +### Methods + +- [handle](LogExit.md#handle) + +## Constructors + +### constructor + +• **new LogExit**(`«destructured»`) + +#### Parameters + +| Name | Type | +| :--------------- | :-------------------- | +| `«destructured»` | `Object` | +| › `logger` | [`Logger`](Logger.md) | + +## Properties + +### logger + +• `Private` `Readonly` **logger**: [`Logger`](Logger.md) + +## Methods + +### handle + +▸ **handle**(`commands`): `Object` + +#### Parameters + +| Name | Type | +| :--------- | :------------------------ | +| `commands` | [`Command`](Command.md)[] | + +#### Returns + +`Object` + +| Name | Type | +| :--------- | :------------------------ | +| `commands` | [`Command`](Command.md)[] | + +#### Implementation of + +[FlowController](../interfaces/FlowController.md).[handle](../interfaces/FlowController.md#handle) diff --git a/docs/classes/LogOutput.md b/docs/classes/LogOutput.md new file mode 100644 index 00000000..ae4e8cae --- /dev/null +++ b/docs/classes/LogOutput.md @@ -0,0 +1,64 @@ +# Class: LogOutput + +Logs the stdout and stderr output of commands. + +## Implements + +- [`FlowController`](../interfaces/FlowController.md) + +## Table of contents + +### Constructors + +- [constructor](LogOutput.md#constructor) + +### Properties + +- [logger](LogOutput.md#logger) + +### Methods + +- [handle](LogOutput.md#handle) + +## Constructors + +### constructor + +• **new LogOutput**(`«destructured»`) + +#### Parameters + +| Name | Type | +| :--------------- | :-------------------- | +| `«destructured»` | `Object` | +| › `logger` | [`Logger`](Logger.md) | + +## Properties + +### logger + +• `Private` `Readonly` **logger**: [`Logger`](Logger.md) + +## Methods + +### handle + +▸ **handle**(`commands`): `Object` + +#### Parameters + +| Name | Type | +| :--------- | :------------------------ | +| `commands` | [`Command`](Command.md)[] | + +#### Returns + +`Object` + +| Name | Type | +| :--------- | :------------------------ | +| `commands` | [`Command`](Command.md)[] | + +#### Implementation of + +[FlowController](../interfaces/FlowController.md).[handle](../interfaces/FlowController.md#handle) diff --git a/docs/classes/LogTimings.md b/docs/classes/LogTimings.md new file mode 100644 index 00000000..01bcb66d --- /dev/null +++ b/docs/classes/LogTimings.md @@ -0,0 +1,102 @@ +# Class: LogTimings + +Logs timing information about commands as they start/stop and then a summary when all commands finish. + +## Implements + +- [`FlowController`](../interfaces/FlowController.md) + +## Table of contents + +### Constructors + +- [constructor](LogTimings.md#constructor) + +### Properties + +- [logger](LogTimings.md#logger) +- [timestampFormat](LogTimings.md#timestampformat) + +### Methods + +- [handle](LogTimings.md#handle) +- [printExitInfoTimingTable](LogTimings.md#printexitinfotimingtable) +- [mapCloseEventToTimingInfo](LogTimings.md#mapcloseeventtotiminginfo) + +## Constructors + +### constructor + +• **new LogTimings**(`«destructured»`) + +#### Parameters + +| Name | Type | +| :------------------- | :-------------------- | +| `«destructured»` | `Object` | +| › `logger?` | [`Logger`](Logger.md) | +| › `timestampFormat?` | `string` | + +## Properties + +### logger + +• `Private` `Optional` `Readonly` **logger**: [`Logger`](Logger.md) + +--- + +### timestampFormat + +• `Private` `Readonly` **timestampFormat**: `string` + +## Methods + +### handle + +▸ **handle**(`commands`): { `commands`: [`Command`](Command.md)[] ; `onFinish?`: `undefined` } \| { `commands`: [`Command`](Command.md)[] ; `onFinish`: () => `void` } + +#### Parameters + +| Name | Type | +| :--------- | :------------------------ | +| `commands` | [`Command`](Command.md)[] | + +#### Returns + +{ `commands`: [`Command`](Command.md)[] ; `onFinish?`: `undefined` } \| { `commands`: [`Command`](Command.md)[] ; `onFinish`: () => `void` } + +#### Implementation of + +[FlowController](../interfaces/FlowController.md).[handle](../interfaces/FlowController.md#handle) + +--- + +### printExitInfoTimingTable + +▸ `Private` **printExitInfoTimingTable**(`exitInfos`): [`CloseEvent`](../interfaces/CloseEvent.md)[] + +#### Parameters + +| Name | Type | +| :---------- | :-------------------------------------------- | +| `exitInfos` | [`CloseEvent`](../interfaces/CloseEvent.md)[] | + +#### Returns + +[`CloseEvent`](../interfaces/CloseEvent.md)[] + +--- + +### mapCloseEventToTimingInfo + +▸ `Static` **mapCloseEventToTimingInfo**(`«destructured»`): `TimingInfo` + +#### Parameters + +| Name | Type | +| :--------------- | :------------------------------------------ | +| `«destructured»` | [`CloseEvent`](../interfaces/CloseEvent.md) | + +#### Returns + +`TimingInfo` diff --git a/docs/classes/Logger.md b/docs/classes/Logger.md new file mode 100644 index 00000000..45713431 --- /dev/null +++ b/docs/classes/Logger.md @@ -0,0 +1,273 @@ +# Class: Logger + +## Table of contents + +### Constructors + +- [constructor](Logger.md#constructor) + +### Properties + +- [hide](Logger.md#hide) +- [lastChar](Logger.md#lastchar) +- [output](Logger.md#output) +- [prefixFormat](Logger.md#prefixformat) +- [prefixLength](Logger.md#prefixlength) +- [raw](Logger.md#raw) +- [timestampFormat](Logger.md#timestampformat) + +### Methods + +- [colorText](Logger.md#colortext) +- [emit](Logger.md#emit) +- [getPrefix](Logger.md#getprefix) +- [getPrefixesFor](Logger.md#getprefixesfor) +- [log](Logger.md#log) +- [logCommandEvent](Logger.md#logcommandevent) +- [logCommandText](Logger.md#logcommandtext) +- [logGlobalEvent](Logger.md#logglobalevent) +- [logTable](Logger.md#logtable) +- [shortenText](Logger.md#shortentext) + +## Constructors + +### constructor + +• **new Logger**(`«destructured»`) + +#### Parameters + +| Name | Type | Description | +| :------------------- | :----------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------- | +| `«destructured»` | `Object` | - | +| › `hide?` | [`CommandIdentifier`](../modules.md#commandidentifier) \| [`CommandIdentifier`](../modules.md#commandidentifier)[] | Which command(s) should have their output hidden. | +| › `prefixFormat?` | `string` | The prefix format to use when logging a command's output. Defaults to the command's index. | +| › `prefixLength?` | `number` | How many characters should a prefix have at most, used when the prefix format is `command`. | +| › `raw?` | `boolean` | Whether output should be formatted to include prefixes and whether "event" logs will be logged. | +| › `timestampFormat?` | `string` | Date format used when logging date/time. **`See`** https://date-fns.org/v2.0.1/docs/format | + +## Properties + +### hide + +• `Private` `Readonly` **hide**: [`CommandIdentifier`](../modules.md#commandidentifier)[] + +--- + +### lastChar + +• `Private` `Optional` **lastChar**: `string` + +Last character emitted. +If `undefined`, then nothing has been logged yet. + +--- + +### output + +• `Readonly` **output**: `Subject`<{ `command`: `undefined` \| [`Command`](Command.md) ; `text`: `string` }\> + +Observable that emits when there's been output logged. +If `command` is is `undefined`, then the log is for a global event. + +--- + +### prefixFormat + +• `Private` `Optional` `Readonly` **prefixFormat**: `string` + +--- + +### prefixLength + +• `Private` `Readonly` **prefixLength**: `number` + +--- + +### raw + +• `Private` `Readonly` **raw**: `boolean` + +--- + +### timestampFormat + +• `Private` `Readonly` **timestampFormat**: `string` + +## Methods + +### colorText + +▸ **colorText**(`command`, `text`): `string` + +#### Parameters + +| Name | Type | +| :-------- | :---------------------- | +| `command` | [`Command`](Command.md) | +| `text` | `string` | + +#### Returns + +`string` + +--- + +### emit + +▸ **emit**(`command`, `text`): `void` + +#### Parameters + +| Name | Type | +| :-------- | :------------------------------------- | +| `command` | `undefined` \| [`Command`](Command.md) | +| `text` | `string` | + +#### Returns + +`void` + +--- + +### getPrefix + +▸ **getPrefix**(`command`): `string` + +#### Parameters + +| Name | Type | +| :-------- | :---------------------- | +| `command` | [`Command`](Command.md) | + +#### Returns + +`string` + +--- + +### getPrefixesFor + +▸ `Private` **getPrefixesFor**(`command`): `Record`<`string`, `string`\> + +#### Parameters + +| Name | Type | +| :-------- | :---------------------- | +| `command` | [`Command`](Command.md) | + +#### Returns + +`Record`<`string`, `string`\> + +--- + +### log + +▸ **log**(`prefix`, `text`, `command?`): `void` + +#### Parameters + +| Name | Type | +| :--------- | :---------------------- | +| `prefix` | `string` | +| `text` | `string` | +| `command?` | [`Command`](Command.md) | + +#### Returns + +`void` + +--- + +### logCommandEvent + +▸ **logCommandEvent**(`text`, `command`): `void` + +Logs an event for a command (e.g. start, stop). + +If raw mode is on, then nothing is logged. + +#### Parameters + +| Name | Type | +| :-------- | :---------------------- | +| `text` | `string` | +| `command` | [`Command`](Command.md) | + +#### Returns + +`void` + +--- + +### logCommandText + +▸ **logCommandText**(`text`, `command`): `void` + +#### Parameters + +| Name | Type | +| :-------- | :---------------------- | +| `text` | `string` | +| `command` | [`Command`](Command.md) | + +#### Returns + +`void` + +--- + +### logGlobalEvent + +▸ **logGlobalEvent**(`text`): `void` + +Logs a global event (e.g. sending signals to processes). + +If raw mode is on, then nothing is logged. + +#### Parameters + +| Name | Type | +| :----- | :------- | +| `text` | `string` | + +#### Returns + +`void` + +--- + +### logTable + +▸ **logTable**(`tableContents`): `void` + +Logs a table from an input object array, like `console.table`. + +Each row is a single input item, and they are presented in the input order. + +#### Parameters + +| Name | Type | +| :-------------- | :------------------------------- | +| `tableContents` | `Record`<`string`, `unknown`\>[] | + +#### Returns + +`void` + +--- + +### shortenText + +▸ `Private` **shortenText**(`text`): `string` + +#### Parameters + +| Name | Type | +| :----- | :------- | +| `text` | `string` | + +#### Returns + +`string` diff --git a/docs/classes/RestartProcess.md b/docs/classes/RestartProcess.md new file mode 100644 index 00000000..af929091 --- /dev/null +++ b/docs/classes/RestartProcess.md @@ -0,0 +1,88 @@ +# Class: RestartProcess + +Restarts commands that fail up to a defined number of times. + +## Implements + +- [`FlowController`](../interfaces/FlowController.md) + +## Table of contents + +### Constructors + +- [constructor](RestartProcess.md#constructor) + +### Properties + +- [delay](RestartProcess.md#delay) +- [logger](RestartProcess.md#logger) +- [scheduler](RestartProcess.md#scheduler) +- [tries](RestartProcess.md#tries) + +### Methods + +- [handle](RestartProcess.md#handle) + +## Constructors + +### constructor + +• **new RestartProcess**(`«destructured»`) + +#### Parameters + +| Name | Type | +| :--------------- | :-------------------- | +| `«destructured»` | `Object` | +| › `delay?` | `number` | +| › `logger` | [`Logger`](Logger.md) | +| › `scheduler?` | `SchedulerLike` | +| › `tries?` | `number` | + +## Properties + +### delay + +• `Readonly` **delay**: `number` + +--- + +### logger + +• `Private` `Readonly` **logger**: [`Logger`](Logger.md) + +--- + +### scheduler + +• `Private` `Optional` `Readonly` **scheduler**: `SchedulerLike` + +--- + +### tries + +• `Readonly` **tries**: `number` + +## Methods + +### handle + +▸ **handle**(`commands`): `Object` + +#### Parameters + +| Name | Type | +| :--------- | :------------------------ | +| `commands` | [`Command`](Command.md)[] | + +#### Returns + +`Object` + +| Name | Type | +| :--------- | :------------------------ | +| `commands` | [`Command`](Command.md)[] | + +#### Implementation of + +[FlowController](../interfaces/FlowController.md).[handle](../interfaces/FlowController.md#handle) diff --git a/docs/interfaces/CloseEvent.md b/docs/interfaces/CloseEvent.md new file mode 100644 index 00000000..b812a2a4 --- /dev/null +++ b/docs/interfaces/CloseEvent.md @@ -0,0 +1,55 @@ +# Interface: CloseEvent + +## Table of contents + +### Properties + +- [command](CloseEvent.md#command) +- [exitCode](CloseEvent.md#exitcode) +- [index](CloseEvent.md#index) +- [killed](CloseEvent.md#killed) +- [timings](CloseEvent.md#timings) + +## Properties + +### command + +• **command**: `CommandInfo` + +--- + +### exitCode + +• **exitCode**: `string` \| `number` + +The exit code or signal for the command. + +--- + +### index + +• **index**: `number` + +The command's index among all commands ran. + +--- + +### killed + +• **killed**: `boolean` + +Whether the command exited because it was killed. + +--- + +### timings + +• **timings**: `Object` + +#### Type declaration + +| Name | Type | +| :---------------- | :------- | +| `durationSeconds` | `number` | +| `endDate` | `Date` | +| `startDate` | `Date` | diff --git a/docs/interfaces/FlowController.md b/docs/interfaces/FlowController.md new file mode 100644 index 00000000..ad9e225b --- /dev/null +++ b/docs/interfaces/FlowController.md @@ -0,0 +1,44 @@ +# Interface: FlowController + +Interface for a class that controls and/or watches the behavior of commands. + +This may include logging their output, creating interactions between them, or changing when they +actually finish. + +## Implemented by + +- [`InputHandler`](../classes/InputHandler.md) +- [`KillOnSignal`](../classes/KillOnSignal.md) +- [`KillOthers`](../classes/KillOthers.md) +- [`LogError`](../classes/LogError.md) +- [`LogExit`](../classes/LogExit.md) +- [`LogOutput`](../classes/LogOutput.md) +- [`LogTimings`](../classes/LogTimings.md) +- [`RestartProcess`](../classes/RestartProcess.md) + +## Table of contents + +### Methods + +- [handle](FlowController.md#handle) + +## Methods + +### handle + +▸ **handle**(`commands`): `Object` + +#### Parameters + +| Name | Type | +| :--------- | :----------------------------------- | +| `commands` | [`Command`](../classes/Command.md)[] | + +#### Returns + +`Object` + +| Name | Type | +| :---------- | :----------------------------------- | +| `commands` | [`Command`](../classes/Command.md)[] | +| `onFinish?` | () => `void` | diff --git a/docs/interfaces/TimerEvent.md b/docs/interfaces/TimerEvent.md new file mode 100644 index 00000000..4d29aa42 --- /dev/null +++ b/docs/interfaces/TimerEvent.md @@ -0,0 +1,20 @@ +# Interface: TimerEvent + +## Table of contents + +### Properties + +- [endDate](TimerEvent.md#enddate) +- [startDate](TimerEvent.md#startdate) + +## Properties + +### endDate + +• `Optional` **endDate**: `Date` + +--- + +### startDate + +• **startDate**: `Date` diff --git a/docs/modules.md b/docs/modules.md new file mode 100644 index 00000000..f4227e85 --- /dev/null +++ b/docs/modules.md @@ -0,0 +1,114 @@ +# Concurrently API documentation + +## Table of contents + +### Classes + +- [Command](classes/Command.md) +- [InputHandler](classes/InputHandler.md) +- [KillOnSignal](classes/KillOnSignal.md) +- [KillOthers](classes/KillOthers.md) +- [LogError](classes/LogError.md) +- [LogExit](classes/LogExit.md) +- [LogOutput](classes/LogOutput.md) +- [LogTimings](classes/LogTimings.md) +- [Logger](classes/Logger.md) +- [RestartProcess](classes/RestartProcess.md) + +### Interfaces + +- [CloseEvent](interfaces/CloseEvent.md) +- [FlowController](interfaces/FlowController.md) +- [TimerEvent](interfaces/TimerEvent.md) + +### Type Aliases + +- [CommandIdentifier](modules.md#commandidentifier) +- [ConcurrentlyCommandInput](modules.md#concurrentlycommandinput) +- [ConcurrentlyOptions](modules.md#concurrentlyoptions) +- [ConcurrentlyResult](modules.md#concurrentlyresult) + +### Functions + +- [concurrently](modules.md#concurrently) +- [default](modules.md#default) + +## Type Aliases + +### CommandIdentifier + +Ƭ **CommandIdentifier**: `string` \| `number` + +Identifier for a command; if string, it's the command's name, if number, it's the index. + +--- + +### ConcurrentlyCommandInput + +Ƭ **ConcurrentlyCommandInput**: `string` \| { `command`: `string` } & `Partial`<`CommandInfo`\> + +A command that is to be passed into `concurrently()`. +If value is a string, then that's the command's command line. +Fine grained options can be defined by using the object format. + +--- + +### ConcurrentlyOptions + +Ƭ **ConcurrentlyOptions**: `BaseConcurrentlyOptions` & { `additionalArguments?`: `string`[] ; `defaultInputTarget?`: [`CommandIdentifier`](modules.md#commandidentifier) ; `handleInput?`: `boolean` ; `hide?`: [`CommandIdentifier`](modules.md#commandidentifier) \| [`CommandIdentifier`](modules.md#commandidentifier)[] ; `inputStream?`: `Readable` ; `killOthers?`: `ProcessCloseCondition` \| `ProcessCloseCondition`[] ; `pauseInputStreamOnFinish?`: `boolean` ; `prefix?`: `string` ; `prefixLength?`: `number` ; `raw?`: `boolean` ; `restartDelay?`: `number` ; `restartTries?`: `number` ; `timestampFormat?`: `string` ; `timings?`: `boolean` } + +Logger options + +--- + +### ConcurrentlyResult + +Ƭ **ConcurrentlyResult**: `Object` + +#### Type declaration + +| Name | Type | Description | +| :--------- | :----------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `commands` | [`Command`](classes/Command.md)[] | All commands created and ran by concurrently. | +| `result` | `Promise`<[`CloseEvent`](interfaces/CloseEvent.md)[]\> | A promise that resolves when concurrently ran successfully according to the specified success condition, or reject otherwise. Both the resolved and rejected value is the list of all command's close events. | + +## Functions + +### concurrently + +▸ **concurrently**(`baseCommands`, `baseOptions?`): [`ConcurrentlyResult`](modules.md#concurrentlyresult) + +Core concurrently functionality -- spawns the given commands concurrently and +returns the commands themselves + the result according to the specified success condition. + +#### Parameters + +| Name | Type | +| :------------- | :------------------------------------------------------------------ | +| `baseCommands` | [`ConcurrentlyCommandInput`](modules.md#concurrentlycommandinput)[] | +| `baseOptions?` | `Partial`<`ConcurrentlyOptions`\> | + +#### Returns + +[`ConcurrentlyResult`](modules.md#concurrentlyresult) + +**`See`** + +CompletionListener + +--- + +### default + +▸ **default**(`commands`, `options?`): [`ConcurrentlyResult`](modules.md#concurrentlyresult) + +#### Parameters + +| Name | Type | +| :--------- | :------------------------------------------------------------------ | +| `commands` | [`ConcurrentlyCommandInput`](modules.md#concurrentlycommandinput)[] | +| `options` | `Partial`<[`ConcurrentlyOptions`](modules.md#concurrentlyoptions)\> | + +#### Returns + +[`ConcurrentlyResult`](modules.md#concurrentlyresult) diff --git a/package.json b/package.json index 27b35d61..49359b94 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "scripts": { "build": "tsc --build", "postbuild": "chmod +x dist/bin/concurrently.js", + "generate:doc:api": "./scripts/generate-documentation.sh", "clean": "tsc --build --clean", "format": "prettier --check '**/*.{json,y?(a)ml,md}'", "format:fix": "pnpm run format --write", @@ -88,6 +89,8 @@ "prettier": "^3.0.3", "safe-publish-latest": "^2.0.0", "string-argv": "^0.3.2", + "typedoc": "^0.25.2", + "typedoc-plugin-markdown": "^3.16.0", "typescript": "~5.2.2" }, "files": [ diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index af151ac5..d8eeffd7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,4 +1,4 @@ -lockfileVersion: '6.1' +lockfileVersion: '6.0' settings: autoInstallPeers: false @@ -115,6 +115,12 @@ devDependencies: string-argv: specifier: ^0.3.2 version: 0.3.2 + typedoc: + specifier: ^0.25.2 + version: 0.25.2(typescript@5.2.2) + typedoc-plugin-markdown: + specifier: ^3.16.0 + version: 3.16.0(typedoc@0.25.2) typescript: specifier: ~5.2.2 version: 5.2.2 @@ -1554,6 +1560,10 @@ packages: engines: {node: '>=12'} dev: true + /ansi-sequence-parser@1.1.1: + resolution: {integrity: sha512-vJXt3yiaUL4UU546s3rPXlsry/RnM730G1+HkpKE012AN0sx1eOrxSu95oKDIonskeLTijMgqWZ3uDEe3NFvyg==} + dev: true + /ansi-styles@3.2.1: resolution: {integrity: sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==} engines: {node: '>=4'} @@ -1765,6 +1775,12 @@ packages: concat-map: 0.0.1 dev: true + /brace-expansion@2.0.1: + resolution: {integrity: sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==} + dependencies: + balanced-match: 1.0.2 + dev: true + /braces@3.0.2: resolution: {integrity: sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==} engines: {node: '>=8'} @@ -2851,6 +2867,19 @@ packages: resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==} dev: true + /handlebars@4.7.8: + resolution: {integrity: sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==} + engines: {node: '>=0.4.7'} + hasBin: true + dependencies: + minimist: 1.2.7 + neo-async: 2.6.2 + source-map: 0.6.1 + wordwrap: 1.0.0 + optionalDependencies: + uglify-js: 3.17.4 + dev: true + /has-bigints@1.0.2: resolution: {integrity: sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==} dev: true @@ -3847,6 +3876,10 @@ packages: yallist: 4.0.0 dev: true + /lunr@2.3.9: + resolution: {integrity: sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==} + dev: true + /make-dir@3.1.0: resolution: {integrity: sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==} engines: {node: '>=8'} @@ -3860,6 +3893,12 @@ packages: tmpl: 1.0.5 dev: true + /marked@4.3.0: + resolution: {integrity: sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==} + engines: {node: '>= 12'} + hasBin: true + dev: true + /merge-stream@2.0.0: resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==} dev: true @@ -3905,6 +3944,13 @@ packages: brace-expansion: 1.1.11 dev: true + /minimatch@9.0.3: + resolution: {integrity: sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==} + engines: {node: '>=16 || 14 >=14.17'} + dependencies: + brace-expansion: 2.0.1 + dev: true + /minimist@1.2.7: resolution: {integrity: sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==} dev: true @@ -3921,6 +3967,10 @@ packages: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} dev: true + /neo-async@2.6.2: + resolution: {integrity: sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==} + dev: true + /node-int64@0.4.0: resolution: {integrity: sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==} dev: true @@ -4367,6 +4417,15 @@ packages: resolution: {integrity: sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA==} dev: false + /shiki@0.14.5: + resolution: {integrity: sha512-1gCAYOcmCFONmErGTrS1fjzJLA7MGZmKzrBNX7apqSwhyITJg2O102uFzXUeBxNnEkDA9vHIKLyeKq0V083vIw==} + dependencies: + ansi-sequence-parser: 1.1.1 + jsonc-parser: 3.2.0 + vscode-oniguruma: 1.7.0 + vscode-textmate: 8.0.0 + dev: true + /side-channel@1.0.4: resolution: {integrity: sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==} dependencies: @@ -4691,12 +4750,43 @@ packages: is-typed-array: 1.1.12 dev: true + /typedoc-plugin-markdown@3.16.0(typedoc@0.25.2): + resolution: {integrity: sha512-eeiC78fDNGFwemPIHiwRC+mEC7W5jwt3fceUev2gJ2nFnXpVHo8eRrpC9BLWZDee6ehnz/sPmNjizbXwpfaTBw==} + peerDependencies: + typedoc: '>=0.24.0' + dependencies: + handlebars: 4.7.8 + typedoc: 0.25.2(typescript@5.2.2) + dev: true + + /typedoc@0.25.2(typescript@5.2.2): + resolution: {integrity: sha512-286F7BeATBiWe/qC4PCOCKlSTwfnsLbC/4cZ68oGBbvAqb9vV33quEOXx7q176OXotD+JdEerdQ1OZGJ818lnA==} + engines: {node: '>= 16'} + hasBin: true + peerDependencies: + typescript: 4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x + dependencies: + lunr: 2.3.9 + marked: 4.3.0 + minimatch: 9.0.3 + shiki: 0.14.5 + typescript: 5.2.2 + dev: true + /typescript@5.2.2: resolution: {integrity: sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==} engines: {node: '>=14.17'} hasBin: true dev: true + /uglify-js@3.17.4: + resolution: {integrity: sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==} + engines: {node: '>=0.8.0'} + hasBin: true + requiresBuild: true + dev: true + optional: true + /unbox-primitive@1.0.2: resolution: {integrity: sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==} dependencies: @@ -4737,6 +4827,14 @@ packages: convert-source-map: 1.9.0 dev: true + /vscode-oniguruma@1.7.0: + resolution: {integrity: sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA==} + dev: true + + /vscode-textmate@8.0.0: + resolution: {integrity: sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg==} + dev: true + /walker@1.0.8: resolution: {integrity: sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==} dependencies: @@ -4772,6 +4870,10 @@ packages: isexe: 2.0.0 dev: true + /wordwrap@1.0.0: + resolution: {integrity: sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==} + dev: true + /wrap-ansi@7.0.0: resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} engines: {node: '>=10'} diff --git a/scripts/generate-documentation.sh b/scripts/generate-documentation.sh new file mode 100755 index 00000000..d744612b --- /dev/null +++ b/scripts/generate-documentation.sh @@ -0,0 +1,6 @@ +#!/bin/bash +#Generate documentation for the project based on Typescript types +pnpm exec typedoc + +# Typedoc generates a README.md file in the docs folder, which is not needed +rm -rf docs/README.md diff --git a/typedoc.json b/typedoc.json new file mode 100644 index 00000000..e0db2770 --- /dev/null +++ b/typedoc.json @@ -0,0 +1,8 @@ +{ + "$schema": "https://typedoc.org/schema.json", + "name": "Concurrently API documentation", + "entryPoints": ["./src"], + "hideBreadcrumbs": true, + "disableSources": true, + "plugin": "typedoc-plugin-markdown" +}