runset 0.0.2 → 0.0.3

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 CHANGED
@@ -1,5 +1,8 @@
1
1
  # runset
2
2
 
3
+ [![Tests](https://github.com/megahertz/runset/actions/workflows/tests.yml/badge.svg)](https://github.com/megahertz/runset/actions/workflows/tests.yml)
4
+ [![NPM version](https://badge.fury.io/js/runset.svg)](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
  ```
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
- /** The parts of a {@link Command} a user may set by hand. */
56
- export type CommandOptions = {
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
- } & Partial<Omit<Command, 'line' | 'packageName' | 'scriptName' | 'stage' | 'stderr' | 'stdout' | 'type'>>;
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
- } & Omit<CommandOptions, 'command'>;
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({ … })`. */
@@ -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?: string;
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?: string;
155
- logLevel?: string;
156
- onFailure?: string;
157
- onSuccess?: string;
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. */