1 | /// <reference types="node" />
|
2 | /// <reference types="node" />
|
3 | import { Writable } from 'stream';
|
4 | import { CloseEvent, Command, CommandIdentifier, CommandInfo, KillProcess, SpawnCommand } from './command';
|
5 | import { SuccessCondition } from './completion-listener';
|
6 | import { FlowController } from './flow-control/flow-controller';
|
7 | import { Logger } from './logger';
|
8 | /**
|
9 | * A command that is to be passed into `concurrently()`.
|
10 | * If value is a string, then that's the command's command line.
|
11 | * Fine grained options can be defined by using the object format.
|
12 | */
|
13 | export type ConcurrentlyCommandInput = string | ({
|
14 | command: string;
|
15 | } & Partial<CommandInfo>);
|
16 | export type ConcurrentlyResult = {
|
17 | /**
|
18 | * All commands created and ran by concurrently.
|
19 | */
|
20 | commands: Command[];
|
21 | /**
|
22 | * A promise that resolves when concurrently ran successfully according to the specified
|
23 | * success condition, or reject otherwise.
|
24 | *
|
25 | * Both the resolved and rejected value is a list of all the close events for commands that
|
26 | * spawned; commands that didn't spawn are filtered out.
|
27 | */
|
28 | result: Promise<CloseEvent[]>;
|
29 | };
|
30 | export type ConcurrentlyOptions = {
|
31 | logger?: Logger;
|
32 | /**
|
33 | * Which stream should the commands output be written to.
|
34 | */
|
35 | outputStream?: Writable;
|
36 | /**
|
37 | * Whether the output should be ordered as if the commands were run sequentially.
|
38 | */
|
39 | group?: boolean;
|
40 | /**
|
41 | * A comma-separated list of chalk colors or a string for available styles listed below to use on prefixes.
|
42 | * If there are more commands than colors, the last color will be repeated.
|
43 | *
|
44 | * Available modifiers:
|
45 | * - `reset`, `bold`, `dim`, `italic`, `underline`, `inverse`, `hidden`, `strikethrough`
|
46 | *
|
47 | * Available colors:
|
48 | * - `black`, `red`, `green`, `yellow`, `blue`, `magenta`, `cyan`, `white`, `gray`,
|
49 | * any hex values for colors (e.g. `#23de43`) or `auto` for an automatically picked color
|
50 | *
|
51 | * Available background colors:
|
52 | * - `bgBlack`, `bgRed`, `bgGreen`, `bgYellow`, `bgBlue`, `bgMagenta`, `bgCyan`, `bgWhite`
|
53 | *
|
54 | * Set to `false` to disable colors.
|
55 | *
|
56 | * @see {@link https://www.npmjs.com/package/chalk} for more information.
|
57 | */
|
58 | prefixColors?: string | string[] | false;
|
59 | /**
|
60 | * Maximum number of commands to run at once.
|
61 | * Exact number or a percent of CPUs available (for example "50%").
|
62 | *
|
63 | * If undefined, then all processes will start in parallel.
|
64 | * Setting this value to 1 will achieve sequential running.
|
65 | */
|
66 | maxProcesses?: number | string;
|
67 | /**
|
68 | * Whether commands should be spawned in raw mode.
|
69 | * Defaults to false.
|
70 | */
|
71 | raw?: boolean;
|
72 | /**
|
73 | * Which commands should have their output hidden.
|
74 | */
|
75 | hide?: CommandIdentifier[];
|
76 | /**
|
77 | * The current working directory of commands which didn't specify one.
|
78 | * Defaults to `process.cwd()`.
|
79 | */
|
80 | cwd?: string;
|
81 | /**
|
82 | * @see CompletionListener
|
83 | */
|
84 | successCondition?: SuccessCondition;
|
85 | /**
|
86 | * A signal to stop spawning further processes.
|
87 | */
|
88 | abortSignal?: AbortSignal;
|
89 | /**
|
90 | * Which flow controllers should be applied on commands spawned by concurrently.
|
91 | * Defaults to an empty array.
|
92 | */
|
93 | controllers: FlowController[];
|
94 | /**
|
95 | * A function that will spawn commands.
|
96 | * Defaults to a function that spawns using either `cmd.exe` or `/bin/sh`.
|
97 | */
|
98 | spawn: SpawnCommand;
|
99 | /**
|
100 | * A function that will kill processes.
|
101 | * Defaults to the `tree-kill` module.
|
102 | */
|
103 | kill: KillProcess;
|
104 | /**
|
105 | * Signal to send to killed processes.
|
106 | */
|
107 | killSignal?: string;
|
108 | /**
|
109 | * List of additional arguments passed that will get replaced in each command.
|
110 | * If not defined, no argument replacing will happen.
|
111 | *
|
112 | * @see ExpandArguments
|
113 | */
|
114 | additionalArguments?: string[];
|
115 | };
|
116 | /**
|
117 | * Core concurrently functionality -- spawns the given commands concurrently and
|
118 | * returns the commands themselves + the result according to the specified success condition.
|
119 | *
|
120 | * @see CompletionListener
|
121 | */
|
122 | export declare function concurrently(baseCommands: ConcurrentlyCommandInput[], baseOptions?: Partial<ConcurrentlyOptions>): ConcurrentlyResult;
|