runset 0.0.0 → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +224 -19
- package/dist/index.d.mts +50 -5
- package/dist/index.mjs +765 -163
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -22,6 +22,9 @@ npx runset -p "watch:**" # all watch scripts together
|
|
|
22
22
|
Each `-p` or `-s` starts a new group. Groups run in order, so in the mixed
|
|
23
23
|
example above, build waits for both lint and test to finish.
|
|
24
24
|
|
|
25
|
+
Use `-j 2` to limit concurrency. Commands in a group run in batches of at most
|
|
26
|
+
two, with each batch waiting for all its commands before the next starts.
|
|
27
|
+
|
|
25
28
|
By default, a failed command stops the run. Ctrl+C stops all running commands
|
|
26
29
|
and their child processes.
|
|
27
30
|
|
|
@@ -48,26 +51,21 @@ npx runset "serve --port {1}" -- 8080
|
|
|
48
51
|
npx runset "test {@}" -- --watch --verbose
|
|
49
52
|
```
|
|
50
53
|
|
|
51
|
-
`{1}`, `{2}`, etc. insert individual arguments. `{@}` inserts all arguments
|
|
52
|
-
|
|
54
|
+
`{1}`, `{2}`, etc. insert individual arguments. `{@}` inserts all arguments
|
|
55
|
+
separately; `{*}` joins them into one argument. Placeholder values in command
|
|
56
|
+
arguments are quoted automatically for the shell.
|
|
53
57
|
|
|
54
|
-
|
|
58
|
+
Named placeholders read options after `--`: `{port}` takes its value from
|
|
59
|
+
`--port 8080` or `--port=8080`. A bare option supplies `true`, which is useful
|
|
60
|
+
for conditional commands:
|
|
55
61
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
| `-j, --jobs <n>` | Limit how many commands run at once |
|
|
61
|
-
| `--on-failure <action>` | `stop` (default), `continue`, or `restart` |
|
|
62
|
-
| `--on-success <action>` | `continue` (default), `stop`, or `restart` |
|
|
63
|
-
| `-o, --output grouped` | Buffer each command's output until it exits |
|
|
64
|
-
| `--stdout <file>` | Write stdout to a file |
|
|
65
|
-
| `--labels <mode>` | `auto` (default), `all`, `custom`, or `none` |
|
|
66
|
-
| `--cwd <dir>` | Set the working directory |
|
|
67
|
-
| `--dry-run` | Show what would run without starting anything |
|
|
68
|
-
| `-c, --config <path>` | Use a specific config file |
|
|
62
|
+
```sh
|
|
63
|
+
npx runset "serve --port {port}" -- --port=8080
|
|
64
|
+
npx runset lint "test::disabled={noTest}" -- --no-test
|
|
65
|
+
```
|
|
69
66
|
|
|
70
|
-
|
|
67
|
+
Without `--no-test`, the missing value makes `disabled` false. Placeholders work
|
|
68
|
+
in command arguments and `::` option values, not command names.
|
|
71
69
|
|
|
72
70
|
Add `::` to set options for one command:
|
|
73
71
|
|
|
@@ -76,14 +74,83 @@ npx runset -p "api::label=server,color=cyan" web
|
|
|
76
74
|
npx runset "lint::on-failure=continue" build
|
|
77
75
|
```
|
|
78
76
|
|
|
77
|
+
See the [command options](#command-options) and [CLI flags](#cli-flags) at the
|
|
78
|
+
bottom for the full reference.
|
|
79
|
+
|
|
80
|
+
## Workspaces
|
|
81
|
+
|
|
82
|
+
Use `-r, --recursive` to run a script in every workspace package that has it:
|
|
83
|
+
|
|
84
|
+
```sh
|
|
85
|
+
npx runset -r build # packages in sequence
|
|
86
|
+
npx runset -rp "test:*" -j 4 # workspace tests, up to four at once
|
|
87
|
+
npx runset clean "build::recursive" # only build expands across packages
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
runset finds the nearest `pnpm-workspace.yaml` or `package.json` with
|
|
91
|
+
`workspaces`, starting at the working directory. Workspace patterns support `!`
|
|
92
|
+
exclusions. The root package is excluded; packages run in path order, from their
|
|
93
|
+
own directories, with package names used for automatic labels. Packages without
|
|
94
|
+
the script are skipped. If no workspace package matches, the command resolves
|
|
95
|
+
normally as a local script, glob, or shell command.
|
|
96
|
+
|
|
97
|
+
## Exit behavior
|
|
98
|
+
|
|
79
99
|
`stop` ends the whole run. `continue` lets it carry on. `restart` runs the
|
|
80
100
|
command again without a delay or retry limit.
|
|
81
101
|
|
|
102
|
+
`--on-failure continue` runs the remaining commands but still exits non-zero if
|
|
103
|
+
any command fails. `--on-success stop` ends the run when a command succeeds,
|
|
104
|
+
stopping any others still running. Failures produce a summary identifying the
|
|
105
|
+
failed commands.
|
|
106
|
+
|
|
107
|
+
Ctrl+C and SIGTERM stop the command process trees. `--kill-timeout` sets the
|
|
108
|
+
grace period before forceful termination (5000 ms by default); a second Ctrl+C
|
|
109
|
+
forces termination immediately. A run interrupted by SIGINT exits with 130, or
|
|
110
|
+
143 for SIGTERM, unless it was already ending with another result.
|
|
111
|
+
|
|
82
112
|
## Output
|
|
83
113
|
|
|
84
114
|
Commands running together get colored labels automatically, so you can tell
|
|
85
|
-
which command wrote each line.
|
|
86
|
-
|
|
115
|
+
which command wrote each line. Automatic labels use the script, program, or
|
|
116
|
+
workspace package name; repeated names get suffixes such as `#1` and `#2`. Set
|
|
117
|
+
your own with `::label=api,color=cyan`. Use `--color none` for plain text or
|
|
118
|
+
`--labels none` to hide labels.
|
|
119
|
+
|
|
120
|
+
| Label mode | What gets a label |
|
|
121
|
+
| ---------- | ------------------------------------------------------------------------------- |
|
|
122
|
+
| `auto` | Commands sharing a parallel stage, plus any custom labels (default) |
|
|
123
|
+
| `all` | Every command, including sequential commands |
|
|
124
|
+
| `custom` | Only custom labels; other commands in the same stage leave a blank label column |
|
|
125
|
+
| `none` | Nothing, including commands with custom labels |
|
|
126
|
+
|
|
127
|
+
runset has 36 label backgrounds for 256-color terminals: 24 soft, vivid shades
|
|
128
|
+
with charcoal text and 12 deeper shades with off-white text. `--color <mode>`
|
|
129
|
+
(or `color` in a config file) picks how many of them automatic labels use:
|
|
130
|
+
|
|
131
|
+
| Mode | Automatic labels |
|
|
132
|
+
| ------- | ------------------------------------------------------------------------------------------- |
|
|
133
|
+
| `auto` | `soft` on 256-color terminals, `basic` on other color terminals, otherwise `none` (default) |
|
|
134
|
+
| `none` | no color, `[label]` |
|
|
135
|
+
| `basic` | the terminal's 16 theme colors |
|
|
136
|
+
| `soft` | the 24 soft shades |
|
|
137
|
+
| `all` | the soft and the deeper shades |
|
|
138
|
+
|
|
139
|
+
`auto` reads the terminal environment, so `FORCE_COLOR` and `NO_COLOR` apply.
|
|
140
|
+
Without an environment override, both stdout and stderr must be terminals for
|
|
141
|
+
color to be enabled. Explicit modes override detection. Label colors are chosen
|
|
142
|
+
from the label text, with collisions adjusted to distinguish commands.
|
|
143
|
+
|
|
144
|
+
You can also choose a shade: `"api::label=server,color=ink,bg-color=bgCoral"`.
|
|
145
|
+
Available shades are `mint`, `sky`, `rose`, `amber`, `lavender`, `aqua`,
|
|
146
|
+
`coral`, `sage`, `periwinkle`, `peach`, `teal`, `lilac`, `lime`, `steel`,
|
|
147
|
+
`pink`, `seafoam`, `apricot`, `mauve`, `jade`, `sand`, `iris`, `ice`, `salmon`,
|
|
148
|
+
`olive`, `navy`, `plum`, `forest`, `wine`, `ocean`, `indigo`, `copper`, `pine`,
|
|
149
|
+
`violet`, `brick`, `slate`, `cocoa`, `ink`, and `paper`. Pair the deeper shades
|
|
150
|
+
with `paper`, as in `"api::label=server,color=paper,bg-color=bgNavy"`. For
|
|
151
|
+
backgrounds, capitalize the shade and prefix it with `bg`, as in `bgMint`.
|
|
152
|
+
Existing names such as `cyan` and `bgBlue` still use your terminal's theme. From
|
|
153
|
+
a checkout, run `npm run preview:colors` to see all 36 label pairs.
|
|
87
154
|
|
|
88
155
|
To keep each command's output together, use grouped output:
|
|
89
156
|
|
|
@@ -93,6 +160,35 @@ npx runset -p lint test -o grouped
|
|
|
93
160
|
|
|
94
161
|
Each command's output is buffered and printed when it exits.
|
|
95
162
|
|
|
163
|
+
`--stdout` and `--stderr` configure streams separately; `-o, --output` sets
|
|
164
|
+
both. A value can name a timing (`realtime` or `grouped`), a destination
|
|
165
|
+
(`stdout`, `stderr`, `none`, or a file path), or both joined with `+`:
|
|
166
|
+
|
|
167
|
+
```sh
|
|
168
|
+
npx runset -p lint test --stdout grouped+./checks.log
|
|
169
|
+
npx runset build --stderr stdout
|
|
170
|
+
npx runset "lint::output=none" build
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
The default is realtime output to each stream's usual destination. A value that
|
|
174
|
+
sets only timing preserves the destination, and vice versa. Stream-specific
|
|
175
|
+
options override `output` in the same scope, regardless of flag order. File
|
|
176
|
+
paths resolve against the run's working directory. Each file is overwritten once
|
|
177
|
+
per run, and commands writing to the same file share it.
|
|
178
|
+
|
|
179
|
+
In a config, write `output: 'grouped'` or
|
|
180
|
+
`output: { timing: 'grouped', destination: './checks.log' }` — for the whole
|
|
181
|
+
run, in a settings entry, or on a single command.
|
|
182
|
+
|
|
183
|
+
Use `--show-command` to print commands when they start and `--show-exit-code` to
|
|
184
|
+
show their status and duration: `✓ 2.1s`, `✗ code 1 · 2.1s`, or
|
|
185
|
+
`– stopped · 2.1s`. Failure and stop lines also name the command. These lines
|
|
186
|
+
follow the command's stdout settings, including grouping and redirection.
|
|
187
|
+
|
|
188
|
+
`-w, --wrap` wraps long labelled lines and repeats the label on every line. It
|
|
189
|
+
uses the terminal width, or `COLUMNS` when no terminal width is available;
|
|
190
|
+
without either, lines stay whole. Wrapping is off by default.
|
|
191
|
+
|
|
96
192
|
## Config
|
|
97
193
|
|
|
98
194
|
Save a pipeline in `runset.config.ts`, then run `npx runset`:
|
|
@@ -115,6 +211,9 @@ export default {
|
|
|
115
211
|
This runs clean, then lint and test together, then build. Settings entries apply
|
|
116
212
|
to the commands that follow them.
|
|
117
213
|
|
|
214
|
+
The same object may live in a `runset` section of `package.json` instead; a
|
|
215
|
+
`runset.config.*` file in the same directory wins over it.
|
|
216
|
+
|
|
118
217
|
Use `commandDictionary` to give a command or pipeline a reusable name:
|
|
119
218
|
|
|
120
219
|
```ts
|
|
@@ -135,6 +234,24 @@ Config files also support `.js`, `.mjs`, `.cjs`, and `.json`. runset looks in
|
|
|
135
234
|
the working directory and its parents. CLI commands run **after** any `commands`
|
|
136
235
|
listed in the config.
|
|
137
236
|
|
|
237
|
+
Run-wide CLI flags override config values. Per-command options override the
|
|
238
|
+
run-wide defaults. Config keys use camelCase, such as `onFailure`,
|
|
239
|
+
`showExitCode`, and `killTimeout`; see the references below.
|
|
240
|
+
|
|
241
|
+
Set environment variables for every command with a top-level `env` object or
|
|
242
|
+
repeatable `-e NAME=value` flags. CLI values override config values for the same
|
|
243
|
+
variable. A command can add its own `env` object, as `api` does above. These
|
|
244
|
+
settings affect child commands; use `--color` to control runset's own colors.
|
|
245
|
+
|
|
246
|
+
Config modules can also export a synchronous function receiving
|
|
247
|
+
`{ argv, cwd, env }` and returning the config object. Falsy entries in
|
|
248
|
+
`commands` are skipped, so lists can contain conditional commands.
|
|
249
|
+
|
|
250
|
+
Named pipelines can run together: with `api: ['build:api', 'test:api']` and
|
|
251
|
+
`web: ['build:web', 'test:web']` in `commandDictionary`, `npx runset -p api web`
|
|
252
|
+
runs both builds, then both tests. Both builds must finish before either test
|
|
253
|
+
starts.
|
|
254
|
+
|
|
138
255
|
## Library
|
|
139
256
|
|
|
140
257
|
```ts
|
|
@@ -148,6 +265,94 @@ The promise resolves with a `Run`, or rejects with a `RunsetError` if the run
|
|
|
148
265
|
fails. Use `Run.fromConfigJs(config)` to prepare a run, `describe()` to inspect
|
|
149
266
|
it, `start()` to run it, and `terminate()` to stop it.
|
|
150
267
|
|
|
268
|
+
## Command options
|
|
269
|
+
|
|
270
|
+
Use `"command args::option=value,flag"` on the CLI or in config command strings.
|
|
271
|
+
The last `::` starts the option list. Boolean options can be bare (`disabled`)
|
|
272
|
+
or explicit (`disabled=false`). To pass a literal `::` in the command, append an
|
|
273
|
+
empty option list, as in `"perl -MData::Dumper::"`.
|
|
274
|
+
|
|
275
|
+
Config command objects use camelCase: for example,
|
|
276
|
+
`{ command: 'lint', onFailure: 'continue' }`. Settings entries omit `command`
|
|
277
|
+
and supply defaults for the following commands.
|
|
278
|
+
|
|
279
|
+
| Inline option | Config key | Meaning |
|
|
280
|
+
| ------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------- |
|
|
281
|
+
| `label=<text>` | `label` | Set the output label; preserves spaces. Visibility follows `labels`. |
|
|
282
|
+
| `color=<name>` | `color` | Label foreground, such as `cyan`, `ink`, or `paper`; this is a color name, while run-wide `color` is a mode. |
|
|
283
|
+
| `bg-color=<name>` | `bgColor` | Label background, such as `bgBlue` or `bgCoral`. Colors alone do not add a label. |
|
|
284
|
+
| `cwd=<dir>` | `cwd` | Set the command's directory, relative to the inherited directory. Explicitly setting it overrides the npm package-root default. |
|
|
285
|
+
| `disabled[=true\|false]` | `disabled` | Skip the command when true; default: `false`. |
|
|
286
|
+
| `parallel[=true\|false]` | `parallel` | Run alongside adjacent parallel commands. On a named pipeline, run its stages alongside neighboring pipelines. |
|
|
287
|
+
| `recursive[=true\|false]` | `recursive` | Expand npm scripts across workspace packages; inherits the run-wide setting (default: `false`). |
|
|
288
|
+
| `on-success=<action>` | `onSuccess` | `continue`, `stop`, or `restart`; inherits the run-wide setting (default: `continue`). |
|
|
289
|
+
| `on-failure=<action>` | `onFailure` | `continue`, `stop`, or `restart`; inherits the run-wide setting (default: `stop`). |
|
|
290
|
+
| `output=<value>` | `output` | Configure both streams using the output syntax above. |
|
|
291
|
+
| `stdout=<value>` | `stdout` | Configure stdout timing and/or destination. |
|
|
292
|
+
| `stderr=<value>` | `stderr` | Configure stderr timing and/or destination. |
|
|
293
|
+
| — | `env` | Object of environment variables added to this command; config only. |
|
|
294
|
+
|
|
295
|
+
Settings entries also accept `serial: true` as the opposite of `parallel: true`.
|
|
296
|
+
Each settings entry that sets `parallel` or `serial` starts a new group.
|
|
297
|
+
|
|
298
|
+
For a custom label renderer, set the run-wide, config-only `formatLabel`
|
|
299
|
+
function. It receives `{ command, color, defaultPrefix, stream }` and returns
|
|
300
|
+
the prefix string, for example:
|
|
301
|
+
|
|
302
|
+
```ts
|
|
303
|
+
formatLabel: ({ defaultPrefix }) => `${new Date().toISOString()} ${defaultPrefix}`,
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
## CLI flags
|
|
307
|
+
|
|
308
|
+
```text
|
|
309
|
+
runset [options] <command...> [-- <placeholder arguments...>]
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
Except for `-p` and `-s`, flags apply to the whole run wherever they appear.
|
|
313
|
+
Long flags accept `--name value` or `--name=value`; short flags can be combined,
|
|
314
|
+
such as `-rp` or `-j4`. Use `--no-recursive`, `--no-show-command`,
|
|
315
|
+
`--no-show-exit-code`, `--no-wrap`, or `--no-dry-run` to disable a boolean
|
|
316
|
+
setting from the config. `--no-color` is an alias for `--color none`.
|
|
317
|
+
|
|
318
|
+
### Execution
|
|
319
|
+
|
|
320
|
+
| Flag | Meaning and default |
|
|
321
|
+
| ----------------------- | --------------------------------------------------------------------------------------- |
|
|
322
|
+
| `-p, --parallel` | Start a group that runs the following commands together. |
|
|
323
|
+
| `-s, --serial` | Start a group that runs the following commands sequentially (the initial mode). |
|
|
324
|
+
| `-j, --jobs <n>` | Maximum concurrent commands, run in batches; default: unlimited. |
|
|
325
|
+
| `-r, --recursive` | Run npm scripts in every workspace package that has them; default: off. |
|
|
326
|
+
| `--on-success <action>` | Action after a clean exit: `continue` (default), `stop`, or `restart`. |
|
|
327
|
+
| `--on-failure <action>` | Action after a failed exit: `stop` (default), `continue`, or `restart`. |
|
|
328
|
+
| `--kill-timeout <ms>` | Grace period before forceful termination; default: `5000`. Use `0` for no grace period. |
|
|
329
|
+
|
|
330
|
+
### Output
|
|
331
|
+
|
|
332
|
+
| Flag | Meaning and default |
|
|
333
|
+
| ---------------------- | ------------------------------------------------------------------------------------------------------------ |
|
|
334
|
+
| `-o, --output <value>` | Set timing and/or destination for both command streams. |
|
|
335
|
+
| `--stdout <value>` | Set stdout timing and/or destination; default: `realtime+stdout`. |
|
|
336
|
+
| `--stderr <value>` | Set stderr timing and/or destination; default: `realtime+stderr`. |
|
|
337
|
+
| `--labels <mode>` | `auto` (default), `all`, `custom`, or `none`; see the label modes above. |
|
|
338
|
+
| `--color <mode>` | `auto` (default), `none`, `basic`, `soft`, or `all`. |
|
|
339
|
+
| `--show-command` | Print each command when it starts; default: off. |
|
|
340
|
+
| `--show-exit-code` | Print each command's exit status and duration; default: off. |
|
|
341
|
+
| `-w, --wrap` | Wrap long labelled lines, repeating the label; default: off. |
|
|
342
|
+
| `--log-level <level>` | Filter runset's own messages: `error`, `warn`, `info` (default), or `debug`. Does not filter command output. |
|
|
343
|
+
|
|
344
|
+
### Configuration and help
|
|
345
|
+
|
|
346
|
+
| Flag | Meaning and default |
|
|
347
|
+
| ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
348
|
+
| `-c, --config <path>` | Load a specific config file instead of searching for one. |
|
|
349
|
+
| `--cwd <dir>` | Set the run's directory for config/package lookup, shell commands, and relative output paths. Defaults to the current directory; npm scripts run from their package root unless given a per-command `cwd`. |
|
|
350
|
+
| `-e, --env <NAME=value>` | Add an environment variable to every command; repeat for multiple variables. |
|
|
351
|
+
| `--dry-run` | Print resolved commands, stages, and effective options without running commands. |
|
|
352
|
+
| `-h, --help` | Show CLI help. |
|
|
353
|
+
| `-v, --version` | Show the installed version. |
|
|
354
|
+
| `--` | End runset options; remaining arguments supply placeholders. They are not automatically appended to commands. |
|
|
355
|
+
|
|
151
356
|
## License
|
|
152
357
|
|
|
153
358
|
[MIT](LICENSE)
|
package/dist/index.d.mts
CHANGED
|
@@ -9,6 +9,12 @@ export interface Std {
|
|
|
9
9
|
export type ExitAction = 'continue' | 'restart' | 'stop';
|
|
10
10
|
export declare const EXIT_ACTIONS: Set<ExitAction>;
|
|
11
11
|
export type LogLevel = 'debug' | 'error' | 'info' | 'warn';
|
|
12
|
+
/**
|
|
13
|
+
* How much color runset uses: `basic` is the terminal's 16 theme colors,
|
|
14
|
+
* `soft` the light 256-color shades, and `all` those plus the deep ones.
|
|
15
|
+
* `auto` is `basic` or `soft`, whichever the terminal shows, or `none`.
|
|
16
|
+
*/
|
|
17
|
+
export type ColorMode = 'all' | 'auto' | 'basic' | 'none' | 'soft';
|
|
12
18
|
/** Which commands get a label in front of their output: see `--labels`. */
|
|
13
19
|
export type LabelMode = 'all' | 'auto' | 'custom' | 'none';
|
|
14
20
|
/** A resolved command, one per process a run spawns. */
|
|
@@ -24,7 +30,11 @@ export interface Command {
|
|
|
24
30
|
line: string;
|
|
25
31
|
onFailure: ExitAction;
|
|
26
32
|
onSuccess: ExitAction;
|
|
33
|
+
/** The workspace package a `recursive` command was expanded into. */
|
|
34
|
+
packageName?: string;
|
|
27
35
|
parallel: boolean;
|
|
36
|
+
/** Run an npm script in every workspace package that has it. */
|
|
37
|
+
recursive: boolean;
|
|
28
38
|
/** The `package.json` script name, when `type` is `'npm'`. */
|
|
29
39
|
scriptName?: string;
|
|
30
40
|
/** Commands sharing a stage run together; stages run in order. */
|
|
@@ -44,9 +54,11 @@ export type LabelFormatter = (context: {
|
|
|
44
54
|
}) => string;
|
|
45
55
|
/** The parts of a {@link Command} a user may set by hand. */
|
|
46
56
|
export type CommandOptions = {
|
|
57
|
+
/** Both streams at once; `stdout` / `stderr` in the same place outrank it. */
|
|
58
|
+
output?: Partial<Std> | string;
|
|
47
59
|
stderr?: Partial<Std> | string;
|
|
48
60
|
stdout?: Partial<Std> | string;
|
|
49
|
-
} & Partial<Omit<Command, 'line' | 'scriptName' | 'stage' | 'stderr' | 'stdout' | 'type'>>;
|
|
61
|
+
} & Partial<Omit<Command, 'line' | 'packageName' | 'scriptName' | 'stage' | 'stderr' | 'stdout' | 'type'>>;
|
|
50
62
|
/** One command written as an object; `command` is what makes it one. */
|
|
51
63
|
export type CommandEntry = {
|
|
52
64
|
command: string;
|
|
@@ -62,12 +74,14 @@ export type CommandSettings = {
|
|
|
62
74
|
export type CommandDefinition = CommandEntry | CommandSettings | false | null | string | undefined;
|
|
63
75
|
/** What a user writes in `runset.config.*`, or hands to `runset({ … })`. */
|
|
64
76
|
export interface ConfigJs {
|
|
65
|
-
|
|
77
|
+
/** Default: `'auto'`. */
|
|
78
|
+
color?: ColorMode;
|
|
66
79
|
/** Named commands, resolved before `package.json` scripts. An entry may be a list. */
|
|
67
80
|
commandDictionary?: Record<string, CommandDefinition | CommandDefinition[]>;
|
|
68
81
|
commands?: CommandDefinition[];
|
|
69
82
|
cwd?: string;
|
|
70
83
|
dryRun?: boolean;
|
|
84
|
+
env?: Record<string, string>;
|
|
71
85
|
/**
|
|
72
86
|
* Renders the prefix of each labelled output line.
|
|
73
87
|
*
|
|
@@ -87,10 +101,20 @@ export interface ConfigJs {
|
|
|
87
101
|
onFailure?: ExitAction;
|
|
88
102
|
/** What a clean exit does to the run. Default: `'continue'`. */
|
|
89
103
|
onSuccess?: ExitAction;
|
|
104
|
+
/** Both streams at once; `stdout` / `stderr` outrank it. */
|
|
105
|
+
output?: Partial<Std> | string;
|
|
90
106
|
/** The default `parallel` for every command. Default: `false`. */
|
|
91
107
|
parallel?: boolean;
|
|
108
|
+
/** The default `recursive` for every command. Default: `false`. */
|
|
109
|
+
recursive?: boolean;
|
|
110
|
+
/** Print each command before it starts. Default: `false`. */
|
|
111
|
+
showCommand?: boolean;
|
|
112
|
+
/** Print how each command exited, green or red. Default: `false`. */
|
|
113
|
+
showExitCode?: boolean;
|
|
92
114
|
stderr?: Partial<Std> | string;
|
|
93
115
|
stdout?: Partial<Std> | string;
|
|
116
|
+
/** Wrap labelled lines to the terminal, labelling each piece. Default: `false`. */
|
|
117
|
+
wrap?: boolean;
|
|
94
118
|
}
|
|
95
119
|
/** A config module may export the object itself or a sync factory for it. */
|
|
96
120
|
export type ConfigJsExport = ((context: {
|
|
@@ -113,13 +137,18 @@ export interface Destinations {
|
|
|
113
137
|
export declare function isCommandSettings(definition: CommandEntry | CommandSettings): definition is CommandSettings;
|
|
114
138
|
export declare function isStreamDestination(destination: string): destination is 'stderr' | 'stdout';
|
|
115
139
|
//#endregion
|
|
140
|
+
//#region src/utils/colors.d.ts
|
|
141
|
+
/** A `ColorMode` once `auto` has been settled. */
|
|
142
|
+
type ColorLevel = Exclude<ColorMode, 'auto'>;
|
|
143
|
+
//#endregion
|
|
116
144
|
//#region src/config/parseCli.d.ts
|
|
117
145
|
/** Run-wide options a CLI flag can set. */
|
|
118
146
|
interface CliOptions {
|
|
119
|
-
color?:
|
|
147
|
+
color?: string;
|
|
120
148
|
config?: string;
|
|
121
149
|
cwd?: string;
|
|
122
150
|
dryRun?: boolean;
|
|
151
|
+
env?: Record<string, string>;
|
|
123
152
|
jobs?: number;
|
|
124
153
|
killTimeout?: number;
|
|
125
154
|
labels?: string;
|
|
@@ -127,8 +156,12 @@ interface CliOptions {
|
|
|
127
156
|
onFailure?: string;
|
|
128
157
|
onSuccess?: string;
|
|
129
158
|
output?: string;
|
|
159
|
+
recursive?: boolean;
|
|
160
|
+
showCommand?: boolean;
|
|
161
|
+
showExitCode?: boolean;
|
|
130
162
|
stderr?: string;
|
|
131
163
|
stdout?: string;
|
|
164
|
+
wrap?: boolean;
|
|
132
165
|
}
|
|
133
166
|
interface ParsedCli {
|
|
134
167
|
/** The argv this is the parse of. */
|
|
@@ -154,8 +187,14 @@ declare class Config {
|
|
|
154
187
|
readonly killTimeout: number;
|
|
155
188
|
readonly onSuccess: ExitAction;
|
|
156
189
|
readonly onFailure: ExitAction;
|
|
157
|
-
readonly color:
|
|
190
|
+
readonly color: ColorLevel;
|
|
158
191
|
readonly parallel: boolean;
|
|
192
|
+
readonly recursive: boolean;
|
|
193
|
+
readonly showCommand: boolean;
|
|
194
|
+
readonly showExitCode: boolean;
|
|
195
|
+
readonly wrap: boolean;
|
|
196
|
+
/** `COLUMNS` as runset was started with it: the width where no TTY says. */
|
|
197
|
+
readonly envColumns: number | undefined;
|
|
159
198
|
readonly labels: LabelMode;
|
|
160
199
|
readonly logLevel: LogLevel;
|
|
161
200
|
readonly dryRun: boolean;
|
|
@@ -214,6 +253,10 @@ export declare class Run {
|
|
|
214
253
|
/** Rejects with a {@link RunsetError} when the run did not succeed. */
|
|
215
254
|
start(): Promise<Run>;
|
|
216
255
|
terminate(options?: TerminateOptions): void;
|
|
256
|
+
/** `1 of 5 commands failed, 2 stopped, 1 not started`. */
|
|
257
|
+
private tally;
|
|
258
|
+
/** The tally, then a row per failure, labelled as its output was. */
|
|
259
|
+
private failureReport;
|
|
217
260
|
private failed;
|
|
218
261
|
/** Says a signal arrived before any command's parting words, then stops. */
|
|
219
262
|
private onSignal;
|
|
@@ -226,7 +269,9 @@ export declare class Run {
|
|
|
226
269
|
/** Any failure runset reports itself; `exitCode` is what the CLI exits with. */
|
|
227
270
|
export declare class RunsetError extends Error {
|
|
228
271
|
readonly exitCode: number;
|
|
229
|
-
|
|
272
|
+
/** What the CLI prints in place of `message`; empty when it already said so. */
|
|
273
|
+
readonly report: string | undefined;
|
|
274
|
+
constructor(message: string, exitCode?: number, report?: string);
|
|
230
275
|
}
|
|
231
276
|
/** A command line runset cannot read. */
|
|
232
277
|
export declare class CliError extends RunsetError {}
|