concurrently
- Version 8.2.2
- Published
- 122 kB
- 9 dependencies
- MIT license
Install
npm i concurrently
yarn add concurrently
pnpm add concurrently
Overview
Run commands concurrently
Index
Functions
Classes
Interfaces
Type Aliases
Functions
function _default
_default: ( commands: ConcurrentlyCommandInput[], options?: Partial<ConcurrentlyOptions>) => ConcurrentlyResult;
function concurrently
concurrently: ( baseCommands: ConcurrentlyCommandInput[], baseOptions?: Partial<ConcurrentlyOptions>) => ConcurrentlyResult;
Core concurrently functionality -- spawns the given commands concurrently and returns the commands themselves + the result according to the specified success condition.
See Also
CompletionListener
Classes
class Command
class Command implements CommandInfo {}
constructor
constructor( { index, name, command, prefixColor, env, cwd, }: CommandInfo & { index: number }, spawnOpts: SpawnOptions, spawn: SpawnCommand, killProcess: KillProcess);
property close
readonly close: Rx.Subject<CloseEvent>;
property command
readonly command: string;
property cwd
readonly cwd?: string;
property env
readonly env: Record<string, unknown>;
property error
readonly error: Rx.Subject<unknown>;
property exited
exited: boolean;
property index
readonly index: number;
property killable
readonly killable: boolean;
Deprecated
property killed
killed: boolean;
property name
readonly name: string;
property pid
pid?: number;
property prefixColor
readonly prefixColor?: string;
property process
process?: any;
property stderr
readonly stderr: Rx.Subject<Buffer>;
property stdin
stdin?: Writable;
property stdout
readonly stdout: Rx.Subject<Buffer>;
property timer
readonly timer: Rx.Subject<TimerEvent>;
method canKill
static canKill: ( command: Command) => command is Command & { pid: number; process: ChildProcess };
Detects whether a command can be killed.
Also works as a type guard on the input
command
.
method kill
kill: (code?: string) => void;
Kills this command, optionally specifying a signal to send to it.
method start
start: () => void;
Starts this command, piping output, error and close events onto the corresponding observables.
class InputHandler
class InputHandler implements FlowController {}
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 sendbla
to command at index0
, andserver:stop
will sendstop
to command with nameserver
.If the input doesn't start with a command identifier, it is then always sent to the default target.
constructor
constructor({ defaultInputTarget, inputStream, pauseInputStreamOnFinish, logger,}: { inputStream?: Readable; logger: Logger; defaultInputTarget?: CommandIdentifier; pauseInputStreamOnFinish?: boolean;});
method handle
handle: (commands: Command[]) => { commands: Command[]; onFinish?: () => void | undefined;};
class KillOnSignal
class KillOnSignal implements FlowController {}
Watches the main concurrently process for signals and sends the same signal down to each spawned command.
constructor
constructor({ process }: { process: EventEmitter });
method handle
handle: (commands: Command[]) => { commands: Command[] };
class KillOthers
class KillOthers implements FlowController {}
Sends a SIGTERM signal to all commands when one of the commands exits with a matching condition.
constructor
constructor({ logger, conditions, killSignal,}: { logger: Logger; conditions: ProcessCloseCondition | ProcessCloseCondition[]; killSignal: string | undefined;});
method handle
handle: (commands: Command[]) => { commands: Command[] };
class LogError
class LogError implements FlowController {}
Logs when commands failed executing, e.g. due to the executable not existing in the system.
constructor
constructor({ logger }: { logger: Logger });
method handle
handle: (commands: Command[]) => { commands: Command[] };
class LogExit
class LogExit implements FlowController {}
Logs the exit code/signal of commands.
constructor
constructor({ logger }: { logger: Logger });
method handle
handle: (commands: Command[]) => { commands: Command[] };
class Logger
class Logger {}
constructor
constructor({ hide, prefixFormat, prefixLength, raw, timestampFormat,}: { hide?: CommandIdentifier | CommandIdentifier[]; raw?: boolean; prefixFormat?: string; prefixLength?: number; timestampFormat?: string;});
property output
readonly output: Rx.Subject<{ command: Command | undefined; text: string }>;
Observable that emits when there's been output logged. If
command
is isundefined
, then the log is for a global event.
method colorText
colorText: (command: Command, text: string) => string;
method emit
emit: (command: Command | undefined, text: string) => void;
method getPrefix
getPrefix: (command: Command) => string;
method log
log: (prefix: string, text: string, command?: Command) => void;
method logCommandEvent
logCommandEvent: (text: string, command: Command) => void;
Logs an event for a command (e.g. start, stop).
If raw mode is on, then nothing is logged.
method logCommandText
logCommandText: (text: string, command: Command) => void;
method logGlobalEvent
logGlobalEvent: (text: string) => void;
Logs a global event (e.g. sending signals to processes).
If raw mode is on, then nothing is logged.
method logTable
logTable: (tableContents: Record<string, unknown>[]) => 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.
class LogOutput
class LogOutput implements FlowController {}
Logs the stdout and stderr output of commands.
constructor
constructor({ logger }: { logger: Logger });
method handle
handle: (commands: Command[]) => { commands: Command[] };
class LogTimings
class LogTimings implements FlowController {}
Logs timing information about commands as they start/stop and then a summary when all commands finish.
constructor
constructor({ logger, timestampFormat,}: { logger?: Logger; timestampFormat?: string;});
method handle
handle: ( commands: Command[]) => | { commands: Command[]; onFinish?: undefined } | { commands: Command[]; onFinish: () => void };
method mapCloseEventToTimingInfo
static mapCloseEventToTimingInfo: ({ command, timings, killed, exitCode,}: CloseEvent) => TimingInfo;
class RestartProcess
class RestartProcess implements FlowController {}
Restarts commands that fail up to a defined number of times.
constructor
constructor({ delay, tries, logger, scheduler,}: { delay?: number; tries?: number; logger: Logger; scheduler?: Rx.SchedulerLike;});
property delay
readonly delay: number;
property tries
readonly tries: number;
method handle
handle: (commands: Command[]) => { commands: Command[] };
Interfaces
interface CloseEvent
interface CloseEvent {}
property command
command: CommandInfo;
property exitCode
exitCode: string | number;
The exit code or signal for the command.
property index
index: number;
The command's index among all commands ran.
property killed
killed: boolean;
Whether the command exited because it was killed.
property timings
timings: { startDate: Date; endDate: Date; durationSeconds: number;};
interface FlowController
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.
method handle
handle: (commands: Command[]) => { commands: Command[]; onFinish?: () => void };
interface TimerEvent
interface TimerEvent {}
Type Aliases
type CommandIdentifier
type CommandIdentifier = string | number;
Identifier for a command; if string, it's the command's name, if number, it's the index.
type ConcurrentlyCommandInput
type 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.
type ConcurrentlyOptions
type ConcurrentlyOptions = BaseConcurrentlyOptions & { /** * Which command(s) should have their output hidden. */ hide?: CommandIdentifier | CommandIdentifier[]; /** * The prefix format to use when logging a command's output. * Defaults to the command's index. */ prefix?: string; /** * How many characters should a prefix have at most, used when the prefix format is `command`. */ prefixLength?: number; /** * Whether output should be formatted to include prefixes and whether "event" logs will be logged. */ raw?: boolean; /** * Date format used when logging date/time. * @see https://date-fns.org/v2.0.1/docs/format */ timestampFormat?: string; defaultInputTarget?: CommandIdentifier; inputStream?: Readable; handleInput?: boolean; pauseInputStreamOnFinish?: boolean; /** * How much time in milliseconds to wait before restarting a command. * * @see RestartProcess */ restartDelay?: number; /** * How many times commands should be restarted when they exit with a failure. * * @see RestartProcess */ restartTries?: number; /** * Under which condition(s) should other commands be killed when the first one exits. * * @see KillOthers */ killOthers?: ProcessCloseCondition | ProcessCloseCondition[]; /** * Whether to output timing information for processes. * * @see LogTimings */ timings?: boolean; /** * List of additional arguments passed that will get replaced in each command. * If not defined, no argument replacing will happen. */ additionalArguments?: string[];};
type ConcurrentlyResult
type ConcurrentlyResult = { /** * All commands created and ran by concurrently. */ commands: Command[]; /** * 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. */ result: Promise<CloseEvent[]>;};
Package Files (13)
- dist/src/command.d.ts
- dist/src/concurrently.d.ts
- dist/src/flow-control/flow-controller.d.ts
- dist/src/flow-control/input-handler.d.ts
- dist/src/flow-control/kill-on-signal.d.ts
- dist/src/flow-control/kill-others.d.ts
- dist/src/flow-control/log-error.d.ts
- dist/src/flow-control/log-exit.d.ts
- dist/src/flow-control/log-output.d.ts
- dist/src/flow-control/log-timings.d.ts
- dist/src/flow-control/restart-process.d.ts
- dist/src/index.d.ts
- dist/src/logger.d.ts
Dependencies (9)
Dev Dependencies (28)
- @hirez_io/observer-spy
- @swc/core
- @swc/jest
- @types/jest
- @types/lodash
- @types/node
- @types/shell-quote
- @types/supports-color
- @types/yargs
- @typescript-eslint/eslint-plugin
- @typescript-eslint/parser
- coveralls-next
- ctrlc-wrapper
- esbuild
- eslint
- eslint-config-prettier
- eslint-plugin-import
- eslint-plugin-jest
- eslint-plugin-prettier
- eslint-plugin-simple-import-sort
- husky
- jest
- jest-create-mock-instance
- lint-staged
- prettier
- safe-publish-latest
- string-argv
- typescript
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/concurrently
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/concurrently)
- HTML<a href="https://www.jsdocs.io/package/concurrently"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 4379 ms. - Missing or incorrect documentation? Open an issue for this package.