@norskvideo/ctl-test-harness 0.1.79 → 0.1.80
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/demo/cli.d.ts +3 -1
- package/demo/cli.js +16 -1
- package/demo/harness.js +3 -2
- package/demo/index.d.ts +1 -1
- package/demo/run.d.ts +3 -1
- package/demo/spec.d.ts +3 -0
- package/package.json +1 -1
package/demo/cli.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { type DevLoopOptions, type DevLoopResult } from "./dev-loop.js";
|
|
3
3
|
import { type DemoUi, type PaneLayout } from "./panes.js";
|
|
4
4
|
import { type DemoRunOptions, type DemoRunResult, demoPorts } from "./run.js";
|
|
5
|
-
import type { DemoDaemonPolicy, DemoMode, DemoSpec } from "./spec.js";
|
|
5
|
+
import type { DemoDaemonPolicy, DemoMode, DemoPortPolicy, DemoSpec } from "./spec.js";
|
|
6
6
|
export interface DemoArgs {
|
|
7
7
|
/** `dev-loop <action>`: the standalone tier's verbs. */
|
|
8
8
|
devLoop: boolean;
|
|
@@ -17,6 +17,8 @@ export interface DemoArgs {
|
|
|
17
17
|
ui?: DemoUi;
|
|
18
18
|
/** Default: PUBLIC_HOST in the environment. */
|
|
19
19
|
publicHost?: string;
|
|
20
|
+
/** `up`/`check`: absent is `assigned`. */
|
|
21
|
+
ports?: DemoPortPolicy;
|
|
20
22
|
}
|
|
21
23
|
export declare function parseDemoArgs(argv: string[]): DemoArgs;
|
|
22
24
|
export interface ResolvedSpecView {
|
package/demo/cli.js
CHANGED
|
@@ -30,7 +30,7 @@ import { runDemo } from "./harness.js";
|
|
|
30
30
|
import { demoPaneList, devLoopPaneList, launchLayout, renderLayout, standaloneDirs, } from "./panes.js";
|
|
31
31
|
import { demoDown, demoPorts, demoSlug, runExportCheck } from "./run.js";
|
|
32
32
|
const USAGE = `usage: demo <up|check|down|spec|ui> [--mode dev|image|standalone] [--daemon private|reuse] [--export-only] [--json]
|
|
33
|
-
[--ui zellij|tmux|none] [--public-host <host>] [--spec <path>]
|
|
33
|
+
[--ports assigned|band] [--ui zellij|tmux|none] [--public-host <host>] [--spec <path>]
|
|
34
34
|
demo dev-loop <up|refresh|down|ui> [--ui zellij|tmux|none] [--public-host <host>] [--spec <path>]
|
|
35
35
|
|
|
36
36
|
up launch, print the URLs, hold (Ctrl-C tears down)
|
|
@@ -54,6 +54,10 @@ const USAGE = `usage: demo <up|check|down|spec|ui> [--mode dev|image|standalone]
|
|
|
54
54
|
--daemon reuse your listening daemon and real store; the driver deletes the instance,
|
|
55
55
|
removes the template and product, then adds again (stored templates
|
|
56
56
|
are immutable by name)
|
|
57
|
+
--ports assigned up/check: the daemon and proxy take ports the system assigns, so two runs
|
|
58
|
+
never collide (default)
|
|
59
|
+
--ports band up/check: the product's fixed band instead, so the proxy URL (and a
|
|
60
|
+
browser's secure-origin exception for it) survives a relaunch
|
|
57
61
|
--ui zellij|tmux|none the multiplexer (\`none\` prints the pane commands); zellij unless said
|
|
58
62
|
--public-host <host> the name other machines reach this box by: every URL, the daemon's
|
|
59
63
|
publicHost, Studio's MoQ preview (default: PUBLIC_HOST)
|
|
@@ -127,12 +131,22 @@ export function parseDemoArgs(argv) {
|
|
|
127
131
|
case "--public-host":
|
|
128
132
|
args.publicHost = value();
|
|
129
133
|
break;
|
|
134
|
+
case "--ports": {
|
|
135
|
+
const p = value();
|
|
136
|
+
if (p !== "assigned" && p !== "band")
|
|
137
|
+
throw new Error(`unknown ports '${p}'\n${USAGE}`);
|
|
138
|
+
args.ports = p;
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
130
141
|
default:
|
|
131
142
|
throw new Error(`unknown flag '${flag}'\n${USAGE}`);
|
|
132
143
|
}
|
|
133
144
|
}
|
|
134
145
|
if (args.ui !== undefined && args.action !== "ui")
|
|
135
146
|
throw new Error("--ui belongs to ui (or dev-loop ui)");
|
|
147
|
+
if (args.ports !== undefined && (devLoop || (args.action !== "up" && args.action !== "check"))) {
|
|
148
|
+
throw new Error("--ports belongs to up and check");
|
|
149
|
+
}
|
|
136
150
|
if (devLoop && (args.mode !== undefined || args.daemon !== "private" || args.exportOnly || args.json)) {
|
|
137
151
|
throw new Error("dev-loop takes only --ui, --public-host and --spec (no --mode, --daemon, --export-only or --json): it is always the source tier on a private daemon");
|
|
138
152
|
}
|
|
@@ -290,6 +304,7 @@ export async function demoMain(argv, io) {
|
|
|
290
304
|
daemon: args.daemon,
|
|
291
305
|
cwd: io.cwd,
|
|
292
306
|
...publicHost,
|
|
307
|
+
...(args.ports !== undefined ? { ports: args.ports } : {}),
|
|
293
308
|
...(io.abort ? { abort: io.abort } : {}),
|
|
294
309
|
});
|
|
295
310
|
return 0;
|
package/demo/harness.js
CHANGED
|
@@ -368,8 +368,9 @@ export async function runDemo(spec, opts, deps = defaultDemoDeps(opts.cwd)) {
|
|
|
368
368
|
...(opts.daemonPort !== undefined ? { daemonPort: opts.daemonPort } : {}),
|
|
369
369
|
...(opts.timeouts !== undefined ? { timeouts: opts.timeouts } : {}),
|
|
370
370
|
...(opts.publicHost !== undefined ? { publicHost: opts.publicHost } : {}),
|
|
371
|
-
// The driver owns every port of this run, so none can be left behind
|
|
372
|
-
|
|
371
|
+
// The driver owns every port of this run, so none can be left behind;
|
|
372
|
+
// `band` trades that for URLs that survive a relaunch.
|
|
373
|
+
ephemeralPorts: opts.ports !== "band",
|
|
373
374
|
});
|
|
374
375
|
if (opts.action === "up") {
|
|
375
376
|
await refuseIfUp(spec, h.session, deps);
|
package/demo/index.d.ts
CHANGED
|
@@ -9,5 +9,5 @@ export type { DemoPane, DemoPaneOptions, DemoUi, DevLoopPaneOptions, PaneLayout,
|
|
|
9
9
|
export { DEV_LOOP_SOURCES, DEV_LOOP_STAMP, demoPaneList, devLoopPaneList, launchLayout, paneArgv, paneCommandLine, paneShellLine, renderLayout, shellQuote, standaloneDirs, } from "./panes.js";
|
|
10
10
|
export type { CliResult, CliStep, DemoDeps, DemoPorts, DemoRunOptions, DemoRunResult, DemoState, DemoStateKind, DemoStateStore, DemoTimeouts, ExportCheckOptions, IngestPortRow, PinMismatch, ProcessHandle, TemplateParams, } from "./run.js";
|
|
11
11
|
export { checkTemplatePins, defaultDemoDeps, demoDown, demoPorts, demoSlug, expandHome, exportStandaloneWorkdir, fileStateStore, findBrokenSymlinks, killGroup, resolveIngestPort, runExportCheck, } from "./run.js";
|
|
12
|
-
export type { DemoContext, DemoDaemonPolicy, DemoExtra, DemoIngest, DemoLaunchContext, DemoMode, DemoOpen, DemoReady, DemoSource, DemoSpec, DemoTemplate, DemoUrl, } from "./spec.js";
|
|
12
|
+
export type { DemoContext, DemoDaemonPolicy, DemoExtra, DemoIngest, DemoLaunchContext, DemoMode, DemoOpen, DemoPortPolicy, DemoReady, DemoSource, DemoSpec, DemoTemplate, DemoUrl, } from "./spec.js";
|
|
13
13
|
export { DemoSpecSchema, defineDemo, formatSpecIssues } from "./spec.js";
|
package/demo/run.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { ensureRunnerOnNetwork } from "../container-net.js";
|
|
|
3
3
|
import { type DaemonProcess, type RunningDaemon, type StartDaemonOptions } from "../daemon.js";
|
|
4
4
|
import { type BaseHarnessPorts } from "../harness-config.js";
|
|
5
5
|
import { type SourceHandle, type SrtPumpTarget } from "../source-pump.js";
|
|
6
|
-
import type { DemoDaemonPolicy, DemoIngest, DemoMode, DemoSpec, DemoTemplate } from "./spec.js";
|
|
6
|
+
import type { DemoDaemonPolicy, DemoIngest, DemoMode, DemoPortPolicy, DemoSpec, DemoTemplate } from "./spec.js";
|
|
7
7
|
export interface CliResult {
|
|
8
8
|
stdout: string;
|
|
9
9
|
stderr: string;
|
|
@@ -127,6 +127,8 @@ export interface DemoRunOptions {
|
|
|
127
127
|
/** The hostname other machines reach this box by: every printed URL uses
|
|
128
128
|
* it, and a private daemon is initialised with it as its publicHost. */
|
|
129
129
|
publicHost?: string;
|
|
130
|
+
/** Default assigned. */
|
|
131
|
+
ports?: DemoPortPolicy;
|
|
130
132
|
}
|
|
131
133
|
export interface DemoRunResult {
|
|
132
134
|
instanceId: string;
|
package/demo/spec.d.ts
CHANGED
|
@@ -37,6 +37,9 @@ export type DemoMode = "dev" | "image";
|
|
|
37
37
|
* `check` always uses), or `reuse` the developer's listening daemon and its
|
|
38
38
|
* real store — where `product add` refuses an existing name and stored
|
|
39
39
|
* templates are immutable, so the driver deletes/removes/re-adds first. */
|
|
40
|
+
/** Whether a run's daemon and proxy take system-assigned ports, or the
|
|
41
|
+
* product's fixed band (stable URLs across relaunches, for development). */
|
|
42
|
+
export type DemoPortPolicy = "assigned" | "band";
|
|
40
43
|
export type DemoDaemonPolicy = "private" | "reuse";
|
|
41
44
|
/** What `beforeLaunch` sees: the template is stored, nothing is launched. */
|
|
42
45
|
export interface DemoLaunchContext {
|