numux 1.18.0 → 1.19.0
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 +6 -4
- package/dist/config.d.ts +1 -1
- package/dist/numux.js +4 -2
- package/dist/types.d.ts +54 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -191,7 +191,8 @@ Top-level options apply to all processes (process-level settings override):
|
|
|
191
191
|
|-------|------|-------------|
|
|
192
192
|
| `cwd` | `string` | Working directory for all processes (process `cwd` overrides) |
|
|
193
193
|
| `env` | `Record<string, string>` | Environment variables merged into all processes (process `env` overrides per key) |
|
|
194
|
-
| `envFile` | `string \| string[]` | `.env` file(s) for all processes (process `envFile` replaces if set) |
|
|
194
|
+
| `envFile` | `string \| string[] \| false` | `.env` file(s) for all processes (process `envFile` replaces if set; `false` disables) |
|
|
195
|
+
| `showCommand` | `boolean` | Print the command being run as the first line of output (default: `true`) |
|
|
195
196
|
|
|
196
197
|
```ts
|
|
197
198
|
export default defineConfig({
|
|
@@ -211,10 +212,10 @@ Each process accepts:
|
|
|
211
212
|
|
|
212
213
|
| Field | Type | Default | Description |
|
|
213
214
|
|-------|------|---------|-------------|
|
|
214
|
-
| `command` | `string` | *required* | Shell command to run |
|
|
215
|
+
| `command` | `string` | *required* | Shell command to run. Supports `$dep.group` references from dependency capture groups |
|
|
215
216
|
| `cwd` | `string` | `process.cwd()` | Working directory |
|
|
216
|
-
| `env` | `Record<string, string>` | — | Extra environment variables |
|
|
217
|
-
| `envFile` | `string \| string[]` | — | `.env` file path(s) to load (relative to `cwd`) |
|
|
217
|
+
| `env` | `Record<string, string>` | — | Extra environment variables. Values support `$dep.group` references from dependency capture groups |
|
|
218
|
+
| `envFile` | `string \| string[] \| false` | — | `.env` file path(s) to load (relative to `cwd`); `false` disables inherited envFile |
|
|
218
219
|
| `dependsOn` | `string[]` | — | Processes that must be ready first |
|
|
219
220
|
| `readyPattern` | `string \| RegExp` | — | Regex matched against stdout to signal readiness. Use `RegExp` to capture groups (see below) |
|
|
220
221
|
| `readyTimeout` | `number` | — | Milliseconds to wait for `readyPattern` before failing |
|
|
@@ -227,6 +228,7 @@ Each process accepts:
|
|
|
227
228
|
| `watch` | `string \| string[]` | — | Glob patterns — restart process when matching files change |
|
|
228
229
|
| `interactive` | `boolean` | `false` | When `true`, keyboard input is forwarded to the process |
|
|
229
230
|
| `errorMatcher` | `boolean \| string` | — | `true` detects ANSI red output, string = regex pattern — shows error indicator on tab |
|
|
231
|
+
| `showCommand` | `boolean` | `true` | Print the command being run as the first line of output |
|
|
230
232
|
|
|
231
233
|
### File watching
|
|
232
234
|
|
package/dist/config.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { NumuxConfig } from './types';
|
|
2
2
|
export type { NumuxConfig, NumuxProcessConfig } from './types';
|
|
3
3
|
/** Type-safe helper for numux.config.ts files. */
|
|
4
|
-
export declare function defineConfig(config: NumuxConfig): NumuxConfig
|
|
4
|
+
export declare function defineConfig<K extends string>(config: NumuxConfig<K>): NumuxConfig<K>;
|
package/dist/numux.js
CHANGED
|
@@ -36,7 +36,7 @@ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports,
|
|
|
36
36
|
var require_package = __commonJS((exports, module) => {
|
|
37
37
|
module.exports = {
|
|
38
38
|
name: "numux",
|
|
39
|
-
version: "1.
|
|
39
|
+
version: "1.19.0",
|
|
40
40
|
description: "Terminal multiplexer with dependency orchestration",
|
|
41
41
|
type: "module",
|
|
42
42
|
license: "MIT",
|
|
@@ -1030,8 +1030,10 @@ function validateConfig(raw, warnings) {
|
|
|
1030
1030
|
throw new Error(`Process "${name}" must have a non-empty "command" string`);
|
|
1031
1031
|
}
|
|
1032
1032
|
if (p.dependsOn !== undefined) {
|
|
1033
|
+
if (typeof p.dependsOn === "string")
|
|
1034
|
+
p.dependsOn = [p.dependsOn];
|
|
1033
1035
|
if (!Array.isArray(p.dependsOn)) {
|
|
1034
|
-
throw new Error(`Process "${name}".dependsOn must be
|
|
1036
|
+
throw new Error(`Process "${name}".dependsOn must be a string or array`);
|
|
1035
1037
|
}
|
|
1036
1038
|
for (const dep of p.dependsOn) {
|
|
1037
1039
|
if (typeof dep !== "string") {
|
package/dist/types.d.ts
CHANGED
|
@@ -1,42 +1,89 @@
|
|
|
1
|
-
export interface NumuxProcessConfig {
|
|
1
|
+
export interface NumuxProcessConfig<K extends string = string> {
|
|
2
|
+
/** Shell command to run. Supports `$dep.group` references from dependency capture groups */
|
|
2
3
|
command: string;
|
|
4
|
+
/** Working directory for the process */
|
|
3
5
|
cwd?: string;
|
|
6
|
+
/**
|
|
7
|
+
* Extra environment variables. Values support `$dep.group` references
|
|
8
|
+
* from dependency capture groups.
|
|
9
|
+
* @example { DB_PORT: '$db.port' }
|
|
10
|
+
*/
|
|
4
11
|
env?: Record<string, string>;
|
|
12
|
+
/** .env file path(s) to load, or `false` to disable */
|
|
5
13
|
envFile?: string | string[] | false;
|
|
6
|
-
|
|
14
|
+
/** Processes that must be ready before this one starts */
|
|
15
|
+
dependsOn?: NoInfer<K> | NoInfer<K>[];
|
|
16
|
+
/** Regex matched against stdout to signal readiness. Use `RegExp` to capture groups for `$dep.group` expansion */
|
|
7
17
|
readyPattern?: string | RegExp;
|
|
18
|
+
/**
|
|
19
|
+
* Set to `false` for one-shot processes
|
|
20
|
+
* @default true
|
|
21
|
+
*/
|
|
8
22
|
persistent?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Limit auto-restart attempts
|
|
25
|
+
* @default Infinity
|
|
26
|
+
*/
|
|
9
27
|
maxRestarts?: number;
|
|
28
|
+
/** Milliseconds to wait for readyPattern before failing */
|
|
10
29
|
readyTimeout?: number;
|
|
30
|
+
/** Milliseconds to wait before starting the process */
|
|
11
31
|
delay?: number;
|
|
32
|
+
/** Env var name (prefix with `!` to negate); process skipped if condition is falsy */
|
|
12
33
|
condition?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Signal for graceful stop
|
|
36
|
+
* @default 'SIGTERM'
|
|
37
|
+
*/
|
|
13
38
|
stopSignal?: 'SIGTERM' | 'SIGINT' | 'SIGHUP';
|
|
39
|
+
/** Hex color (e.g. `"#ff6600"`) or color name. Array for round-robin in script patterns */
|
|
14
40
|
color?: string | string[];
|
|
41
|
+
/** Glob patterns — restart process when matching files change */
|
|
15
42
|
watch?: string | string[];
|
|
43
|
+
/**
|
|
44
|
+
* When true, keyboard input is forwarded to the process
|
|
45
|
+
* @default false
|
|
46
|
+
*/
|
|
16
47
|
interactive?: boolean;
|
|
48
|
+
/** `true` = detect ANSI red output, string = regex pattern */
|
|
17
49
|
errorMatcher?: boolean | string;
|
|
50
|
+
/**
|
|
51
|
+
* Print the command being run as the first line of output
|
|
52
|
+
* @default true
|
|
53
|
+
*/
|
|
18
54
|
showCommand?: boolean;
|
|
19
55
|
}
|
|
20
56
|
/** Config for npm: wildcard entries — command is derived from package.json scripts */
|
|
21
|
-
export type NumuxScriptPattern = Omit<NumuxProcessConfig
|
|
57
|
+
export type NumuxScriptPattern<K extends string = string> = Omit<NumuxProcessConfig<K>, 'command'> & {
|
|
22
58
|
command?: never;
|
|
23
59
|
};
|
|
24
60
|
/** Raw config as authored — processes can be string shorthand, full objects, or wildcard patterns */
|
|
25
|
-
export interface NumuxConfig {
|
|
61
|
+
export interface NumuxConfig<K extends string = string> {
|
|
62
|
+
/** Global working directory, inherited by all processes */
|
|
26
63
|
cwd?: string;
|
|
64
|
+
/** Global env vars, merged into each process (process-level overrides) */
|
|
27
65
|
env?: Record<string, string>;
|
|
66
|
+
/** Global .env file(s), inherited by processes without their own envFile; `false` disables */
|
|
28
67
|
envFile?: string | string[] | false;
|
|
68
|
+
/**
|
|
69
|
+
* Global showCommand flag, inherited by all processes
|
|
70
|
+
* @default true
|
|
71
|
+
*/
|
|
29
72
|
showCommand?: boolean;
|
|
30
|
-
processes: Record<
|
|
73
|
+
processes: Record<K, NumuxProcessConfig<K> | NumuxScriptPattern<K> | string>;
|
|
74
|
+
}
|
|
75
|
+
/** Process config after validation — dependsOn is always normalized to an array */
|
|
76
|
+
export interface ResolvedProcessConfig extends Omit<NumuxProcessConfig, 'dependsOn'> {
|
|
77
|
+
dependsOn?: string[];
|
|
31
78
|
}
|
|
32
79
|
/** Validated config with all shorthand expanded to full objects */
|
|
33
80
|
export interface ResolvedNumuxConfig {
|
|
34
|
-
processes: Record<string,
|
|
81
|
+
processes: Record<string, ResolvedProcessConfig>;
|
|
35
82
|
}
|
|
36
83
|
export type ProcessStatus = 'pending' | 'starting' | 'ready' | 'running' | 'stopping' | 'stopped' | 'finished' | 'failed' | 'skipped';
|
|
37
84
|
export interface ProcessState {
|
|
38
85
|
name: string;
|
|
39
|
-
config:
|
|
86
|
+
config: ResolvedProcessConfig;
|
|
40
87
|
status: ProcessStatus;
|
|
41
88
|
exitCode: number | null;
|
|
42
89
|
restartCount: number;
|