numux 2.4.0 → 2.5.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/dist/numux.js +27 -8
- package/package.json +1 -1
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: "2.
|
|
39
|
+
version: "2.5.0",
|
|
40
40
|
description: "Terminal multiplexer with dependency orchestration",
|
|
41
41
|
type: "module",
|
|
42
42
|
license: "MIT",
|
|
@@ -3369,6 +3369,7 @@ class PrefixDisplay {
|
|
|
3369
3369
|
timestampFormat;
|
|
3370
3370
|
stopping = false;
|
|
3371
3371
|
startTime = 0;
|
|
3372
|
+
processTimes = new Map;
|
|
3372
3373
|
constructor(manager, config, options = {}) {
|
|
3373
3374
|
this.manager = manager;
|
|
3374
3375
|
this.logWriter = options.logWriter;
|
|
@@ -3442,7 +3443,17 @@ class PrefixDisplay {
|
|
|
3442
3443
|
this.printLine(name, lastCr === -1 ? line : line.slice(lastCr + 1));
|
|
3443
3444
|
}
|
|
3444
3445
|
}
|
|
3445
|
-
handleStatus(
|
|
3446
|
+
handleStatus(name, status) {
|
|
3447
|
+
if (status === "running" || status === "starting") {
|
|
3448
|
+
if (!this.processTimes.has(name)) {
|
|
3449
|
+
this.processTimes.set(name, { start: Date.now() });
|
|
3450
|
+
}
|
|
3451
|
+
} else if (status === "finished" || status === "failed" || status === "stopped") {
|
|
3452
|
+
const t = this.processTimes.get(name);
|
|
3453
|
+
if (t && !t.end)
|
|
3454
|
+
t.end = Date.now();
|
|
3455
|
+
}
|
|
3456
|
+
}
|
|
3446
3457
|
printLine(name, line) {
|
|
3447
3458
|
const fmt = this.timestampFormat;
|
|
3448
3459
|
const ts = fmt ? `${DIM}[${formatTimestamp(new Date, fmt)}]${RESET} ` : "";
|
|
@@ -3495,8 +3506,7 @@ class PrefixDisplay {
|
|
|
3495
3506
|
process.exit(code === 0 ? 0 : 1);
|
|
3496
3507
|
});
|
|
3497
3508
|
}
|
|
3498
|
-
|
|
3499
|
-
const ms = Date.now() - this.startTime;
|
|
3509
|
+
formatDuration(ms) {
|
|
3500
3510
|
if (ms < 1000)
|
|
3501
3511
|
return `${ms}ms`;
|
|
3502
3512
|
const s = ms / 1000;
|
|
@@ -3506,21 +3516,30 @@ class PrefixDisplay {
|
|
|
3506
3516
|
const rem = s % 60;
|
|
3507
3517
|
return `${m}m ${rem.toFixed(0)}s`;
|
|
3508
3518
|
}
|
|
3519
|
+
formatElapsed() {
|
|
3520
|
+
return this.formatDuration(Date.now() - this.startTime);
|
|
3521
|
+
}
|
|
3509
3522
|
printSummary() {
|
|
3510
3523
|
const states = this.manager.getAllStates();
|
|
3511
3524
|
const namePad = Math.max(...states.map((s) => s.name.length));
|
|
3525
|
+
const statusPad = Math.max(...states.map((s) => s.status.length));
|
|
3512
3526
|
process.stdout.write(`
|
|
3513
3527
|
`);
|
|
3514
3528
|
for (const s of states) {
|
|
3515
3529
|
const name = s.name.padEnd(namePad);
|
|
3516
|
-
const exitStr = s.exitCode !== null ? `exit ${s.exitCode}` : "";
|
|
3530
|
+
const exitStr = s.exitCode !== null ? `(exit ${s.exitCode})` : "";
|
|
3531
|
+
const t = this.processTimes.get(s.name);
|
|
3532
|
+
const duration = t ? this.formatDuration((t.end ?? Date.now()) - t.start) : "";
|
|
3517
3533
|
if (this.noColor) {
|
|
3518
|
-
|
|
3534
|
+
const status = s.status.padEnd(statusPad);
|
|
3535
|
+
process.stdout.write(` ${name} ${status} ${exitStr.padEnd(9)} ${duration}
|
|
3519
3536
|
`);
|
|
3520
3537
|
} else {
|
|
3521
3538
|
const ansi = STATUS_ANSI[s.status] ?? "";
|
|
3522
|
-
const
|
|
3523
|
-
|
|
3539
|
+
const statusPlain = s.status.padEnd(statusPad);
|
|
3540
|
+
const statusText = ansi ? `${ansi}${statusPlain}${RESET}` : statusPlain;
|
|
3541
|
+
const exitPart = exitStr ? `${DIM}${exitStr.padEnd(9)}${RESET}` : " ".repeat(9);
|
|
3542
|
+
process.stdout.write(` ${name} ${statusText} ${exitPart} ${DIM}${duration}${RESET}
|
|
3524
3543
|
`);
|
|
3525
3544
|
}
|
|
3526
3545
|
}
|