runset 0.0.2 → 0.0.4
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 +12 -3
- package/dist/index.d.mts +28 -26
- package/dist/index.mjs +1450 -1414
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# runset
|
|
2
2
|
|
|
3
|
+
[](https://github.com/megahertz/runset/actions/workflows/tests.yml)
|
|
4
|
+
[](https://badge.fury.io/js/runset)
|
|
5
|
+
|
|
3
6
|
Run npm scripts and shell commands in parallel or sequence, with glob matching,
|
|
4
7
|
reusable pipelines, colored labels, and grouped output. Inspired by
|
|
5
8
|
`npm-run-all`, with more control over execution and output.
|
|
@@ -12,6 +15,12 @@ reusable pipelines, colored labels, and grouped output. Inspired by
|
|
|
12
15
|
- **Workspace support**
|
|
13
16
|
- **Zero dependencies**
|
|
14
17
|
|
|
18
|
+
<p align="center">
|
|
19
|
+
<img src="docs/screenshot.png" alt="runset output: realtime on the left, grouped on the right">
|
|
20
|
+
<br>
|
|
21
|
+
<sub>Realtime output (default) on the left, grouped (<code>-o grouped</code>) on the right</sub>
|
|
22
|
+
</p>
|
|
23
|
+
|
|
15
24
|
```sh
|
|
16
25
|
npm install --save-dev runset
|
|
17
26
|
```
|
|
@@ -191,9 +200,9 @@ show their status and duration: `✓ 2.1s`, `✗ code 1 · 2.1s`, or
|
|
|
191
200
|
`– stopped · 2.1s`. Failure and stop lines also name the command. These lines
|
|
192
201
|
follow the command's stdout settings, including grouping and redirection.
|
|
193
202
|
|
|
194
|
-
|
|
203
|
+
Long labelled lines are wrapped, with the label repeated on every line. Wrapping
|
|
195
204
|
uses the terminal width, or `COLUMNS` when no terminal width is available;
|
|
196
|
-
without either, lines stay whole.
|
|
205
|
+
without either, lines stay whole. `--no-wrap` or `wrap: false` turns it off.
|
|
197
206
|
|
|
198
207
|
## Config
|
|
199
208
|
|
|
@@ -343,7 +352,7 @@ setting from the config. `--no-color` is an alias for `--color none`.
|
|
|
343
352
|
| `--color <mode>` | `auto` (default), `none`, `basic`, `soft`, or `all`. |
|
|
344
353
|
| `--show-command` | Print each command when it starts; default: off. |
|
|
345
354
|
| `--show-exit-code` | Print each command's exit status and duration; default: off. |
|
|
346
|
-
|
|
|
355
|
+
| `--no-wrap` | Leave long labelled lines whole instead of wrapping them with the label repeated. |
|
|
347
356
|
| `--log-level <level>` | Filter runset's own messages: `error`, `warn`, `info` (default), or `debug`. Does not filter command output. |
|
|
348
357
|
|
|
349
358
|
### Configuration and help
|
package/dist/index.d.mts
CHANGED
|
@@ -7,7 +7,6 @@ export interface Std {
|
|
|
7
7
|
timing: StdTiming;
|
|
8
8
|
}
|
|
9
9
|
export type ExitAction = 'continue' | 'restart' | 'stop';
|
|
10
|
-
export declare const EXIT_ACTIONS: Set<ExitAction>;
|
|
11
10
|
export type LogLevel = 'debug' | 'error' | 'info' | 'warn';
|
|
12
11
|
/**
|
|
13
12
|
* How much color runset uses: `basic` is the terminal's 16 theme colors,
|
|
@@ -23,7 +22,6 @@ export interface Command {
|
|
|
23
22
|
color: string;
|
|
24
23
|
command: string;
|
|
25
24
|
cwd: string;
|
|
26
|
-
disabled: boolean;
|
|
27
25
|
env: NodeJS.ProcessEnv;
|
|
28
26
|
label: string;
|
|
29
27
|
/** What is handed to the shell: for an npm command, the script's body. */
|
|
@@ -32,9 +30,6 @@ export interface Command {
|
|
|
32
30
|
onSuccess: ExitAction;
|
|
33
31
|
/** The workspace package a `recursive` command was expanded into. */
|
|
34
32
|
packageName?: string;
|
|
35
|
-
parallel: boolean;
|
|
36
|
-
/** Run an npm script in every workspace package that has it. */
|
|
37
|
-
recursive: boolean;
|
|
38
33
|
/** The `package.json` script name, when `type` is `'npm'`. */
|
|
39
34
|
scriptName?: string;
|
|
40
35
|
/** Commands sharing a stage run together; stages run in order. */
|
|
@@ -52,13 +47,26 @@ export type LabelFormatter = (context: {
|
|
|
52
47
|
defaultPrefix: string;
|
|
53
48
|
stream: 'stderr' | 'stdout';
|
|
54
49
|
}) => string;
|
|
55
|
-
/**
|
|
56
|
-
export
|
|
50
|
+
/** What a user may set about a command, by hand. */
|
|
51
|
+
export interface CommandOptions {
|
|
52
|
+
bgColor?: string;
|
|
53
|
+
color?: string;
|
|
54
|
+
cwd?: string;
|
|
55
|
+
/** Leave the command out of the run. */
|
|
56
|
+
disabled?: boolean;
|
|
57
|
+
env?: NodeJS.ProcessEnv;
|
|
58
|
+
label?: string;
|
|
59
|
+
onFailure?: ExitAction;
|
|
60
|
+
onSuccess?: ExitAction;
|
|
57
61
|
/** Both streams at once; `stdout` / `stderr` in the same place outrank it. */
|
|
58
62
|
output?: Partial<Std> | string;
|
|
63
|
+
/** Join the group of commands beside it rather than open a stage of its own. */
|
|
64
|
+
parallel?: boolean;
|
|
65
|
+
/** Run an npm script in every workspace package that has it. */
|
|
66
|
+
recursive?: boolean;
|
|
59
67
|
stderr?: Partial<Std> | string;
|
|
60
68
|
stdout?: Partial<Std> | string;
|
|
61
|
-
}
|
|
69
|
+
}
|
|
62
70
|
/** One command written as an object; `command` is what makes it one. */
|
|
63
71
|
export type CommandEntry = {
|
|
64
72
|
command: string;
|
|
@@ -69,7 +77,7 @@ export type CommandEntry = {
|
|
|
69
77
|
*/
|
|
70
78
|
export type CommandSettings = {
|
|
71
79
|
serial?: boolean;
|
|
72
|
-
} &
|
|
80
|
+
} & CommandOptions;
|
|
73
81
|
/** A command before normalization; falsy entries are skipped. */
|
|
74
82
|
export type CommandDefinition = CommandEntry | CommandSettings | false | null | string | undefined;
|
|
75
83
|
/** What a user writes in `runset.config.*`, or hands to `runset({ … })`. */
|
|
@@ -113,7 +121,7 @@ export interface ConfigJs {
|
|
|
113
121
|
showExitCode?: boolean;
|
|
114
122
|
stderr?: Partial<Std> | string;
|
|
115
123
|
stdout?: Partial<Std> | string;
|
|
116
|
-
/** Wrap labelled lines to the terminal, labelling each piece. Default: `
|
|
124
|
+
/** Wrap labelled lines to the terminal, labelling each piece. Default: `true`. */
|
|
117
125
|
wrap?: boolean;
|
|
118
126
|
}
|
|
119
127
|
/** A config module may export the object itself or a sync factory for it. */
|
|
@@ -128,14 +136,6 @@ export interface TerminateOptions {
|
|
|
128
136
|
/** Default: SIGTERM. Ignored under `force`. */
|
|
129
137
|
signal?: NodeJS.Signals;
|
|
130
138
|
}
|
|
131
|
-
/** Where a run writes. */
|
|
132
|
-
export interface Destinations {
|
|
133
|
-
stderr: NodeJS.WritableStream;
|
|
134
|
-
stdout: NodeJS.WritableStream;
|
|
135
|
-
}
|
|
136
|
-
/** True for an object written without a `command` — a settings entry. */
|
|
137
|
-
export declare function isCommandSettings(definition: CommandEntry | CommandSettings): definition is CommandSettings;
|
|
138
|
-
export declare function isStreamDestination(destination: string): destination is 'stderr' | 'stdout';
|
|
139
139
|
//#endregion
|
|
140
140
|
//#region src/utils/colors.d.ts
|
|
141
141
|
/** A `ColorMode` once `auto` has been settled. */
|
|
@@ -144,17 +144,17 @@ type ColorLevel = Exclude<ColorMode, 'auto'>;
|
|
|
144
144
|
//#region src/config/parseCli.d.ts
|
|
145
145
|
/** Run-wide options a CLI flag can set. */
|
|
146
146
|
interface CliOptions {
|
|
147
|
-
color?:
|
|
147
|
+
color?: ColorMode;
|
|
148
148
|
config?: string;
|
|
149
149
|
cwd?: string;
|
|
150
150
|
dryRun?: boolean;
|
|
151
151
|
env?: Record<string, string>;
|
|
152
152
|
jobs?: number;
|
|
153
153
|
killTimeout?: number;
|
|
154
|
-
labels?:
|
|
155
|
-
logLevel?:
|
|
156
|
-
onFailure?:
|
|
157
|
-
onSuccess?:
|
|
154
|
+
labels?: LabelMode;
|
|
155
|
+
logLevel?: LogLevel;
|
|
156
|
+
onFailure?: ExitAction;
|
|
157
|
+
onSuccess?: ExitAction;
|
|
158
158
|
output?: string;
|
|
159
159
|
recursive?: boolean;
|
|
160
160
|
showCommand?: boolean;
|
|
@@ -210,6 +210,11 @@ declare class Config {
|
|
|
210
210
|
/** True when `commands` holds something to run, not just settings entries. */
|
|
211
211
|
hasCommands(): boolean;
|
|
212
212
|
}
|
|
213
|
+
/** Where a run writes. */
|
|
214
|
+
interface Destinations {
|
|
215
|
+
stderr: NodeJS.WritableStream;
|
|
216
|
+
stdout: NodeJS.WritableStream;
|
|
217
|
+
}
|
|
213
218
|
interface ResolvedConfigOptions {
|
|
214
219
|
/** Defaults to the process's own argv; a library caller passes `parseCli([])`. */
|
|
215
220
|
cli: ParsedCli;
|
|
@@ -239,7 +244,6 @@ interface Plan {
|
|
|
239
244
|
//#region src/run/Run.d.ts
|
|
240
245
|
/** One run: the processes built from a plan, and what stops them. */
|
|
241
246
|
export declare class Run {
|
|
242
|
-
readonly config: Config;
|
|
243
247
|
private readonly logger;
|
|
244
248
|
private readonly files;
|
|
245
249
|
private stopping;
|
|
@@ -269,8 +273,6 @@ export declare class Run {
|
|
|
269
273
|
/** Any failure runset reports itself; `exitCode` is what the CLI exits with. */
|
|
270
274
|
export declare class RunsetError extends Error {
|
|
271
275
|
readonly exitCode: number;
|
|
272
|
-
/** What the CLI prints in place of `message`; empty when it already said so. */
|
|
273
|
-
readonly report: string | undefined;
|
|
274
276
|
constructor(message: string, exitCode?: number, report?: string);
|
|
275
277
|
}
|
|
276
278
|
/** A command line runset cannot read. */
|