@nmakarov/cli-toolkit 0.75.0 → 0.77.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/cli-runner.cjs +29 -10
- package/dist/cli-runner.cjs.map +1 -1
- package/dist/cli-runner.js +29 -10
- package/dist/cli-runner.js.map +1 -1
- package/dist/deploy.cjs +16 -2
- package/dist/deploy.cjs.map +1 -1
- package/dist/deploy.js +15 -2
- package/dist/deploy.js.map +1 -1
- package/dist/index.cjs +45 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +44 -12
- package/dist/index.js.map +1 -1
- package/dist/init.cjs +27 -10
- package/dist/init.cjs.map +1 -1
- package/dist/init.js +27 -10
- package/dist/init.js.map +1 -1
- package/dist/logger.cjs +27 -10
- package/dist/logger.cjs.map +1 -1
- package/dist/logger.js +27 -10
- package/dist/logger.js.map +1 -1
- package/dist/tasks.cjs +2 -0
- package/dist/tasks.cjs.map +1 -1
- package/dist/tasks.js +2 -0
- package/dist/tasks.js.map +1 -1
- package/package.json +1 -1
package/dist/init.cjs
CHANGED
|
@@ -2530,7 +2530,8 @@ var LEVEL_COLORS = {
|
|
|
2530
2530
|
silly: import_chalk.default.gray,
|
|
2531
2531
|
request: import_chalk.default.green,
|
|
2532
2532
|
response: import_chalk.default.yellow,
|
|
2533
|
-
|
|
2533
|
+
// Magenta stands out from white info / green request lines.
|
|
2534
|
+
progress: import_chalk.default.magentaBright,
|
|
2534
2535
|
results: import_chalk.default.magenta
|
|
2535
2536
|
};
|
|
2536
2537
|
var Logger = class _Logger {
|
|
@@ -2549,7 +2550,8 @@ var Logger = class _Logger {
|
|
|
2549
2550
|
this.updateTransport();
|
|
2550
2551
|
}
|
|
2551
2552
|
/**
|
|
2552
|
-
* Configure logger options. Accepts both LoggerOptions shape and flat param names
|
|
2553
|
+
* Configure logger options. Accepts both LoggerOptions shape and flat param names
|
|
2554
|
+
* (levels string, progressWithTimes, progressWithRate, progressThrottleMs).
|
|
2553
2555
|
*/
|
|
2554
2556
|
configure(options) {
|
|
2555
2557
|
if (options.mode !== void 0) {
|
|
@@ -2569,10 +2571,12 @@ var Logger = class _Logger {
|
|
|
2569
2571
|
}
|
|
2570
2572
|
if (options.progress !== void 0) {
|
|
2571
2573
|
if (options.progress.withTimes !== void 0) this.options.progressTimes = options.progress.withTimes;
|
|
2574
|
+
if (options.progress.withRate !== void 0) this.options.progressRate = options.progress.withRate;
|
|
2572
2575
|
if (options.progress.throttleMs !== void 0) this.options.progressThrottle = options.progress.throttleMs;
|
|
2573
2576
|
}
|
|
2574
2577
|
const flat = options;
|
|
2575
2578
|
if (flat.progressWithTimes !== void 0) this.options.progressTimes = flat.progressWithTimes;
|
|
2579
|
+
if (flat.progressWithRate !== void 0) this.options.progressRate = flat.progressWithRate;
|
|
2576
2580
|
if (flat.progressThrottleMs !== void 0) this.options.progressThrottle = flat.progressThrottleMs;
|
|
2577
2581
|
}
|
|
2578
2582
|
/**
|
|
@@ -2589,6 +2593,7 @@ var Logger = class _Logger {
|
|
|
2589
2593
|
timestamp: "boolean default false",
|
|
2590
2594
|
levels: "string",
|
|
2591
2595
|
progressWithTimes: "boolean default false",
|
|
2596
|
+
progressWithRate: "boolean default false",
|
|
2592
2597
|
progressThrottleMs: "number"
|
|
2593
2598
|
};
|
|
2594
2599
|
const discovered = context.params.getAllForModule("logger", paramDefs);
|
|
@@ -2607,6 +2612,7 @@ var Logger = class _Logger {
|
|
|
2607
2612
|
timestamp: false,
|
|
2608
2613
|
levels: DEFAULT_LEVELS,
|
|
2609
2614
|
progressTimes: false,
|
|
2615
|
+
progressRate: false,
|
|
2610
2616
|
progressThrottle: void 0
|
|
2611
2617
|
};
|
|
2612
2618
|
}
|
|
@@ -2672,15 +2678,23 @@ var Logger = class _Logger {
|
|
|
2672
2678
|
if (!this.startTimes[prefix ?? ""]) {
|
|
2673
2679
|
this.startTimes[prefix ?? ""] = Date.now();
|
|
2674
2680
|
}
|
|
2675
|
-
|
|
2681
|
+
const wantTimes = this.options.progressTimes;
|
|
2682
|
+
const wantRate = this.options.progressRate;
|
|
2683
|
+
if (wantTimes || wantRate) {
|
|
2676
2684
|
const elapsedSeconds = (Date.now() - this.startTimes[prefix ?? ""]) / 1e3;
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
remaining =
|
|
2685
|
+
const intervals = count > 1 ? count - 1 : 0;
|
|
2686
|
+
const itemsPerSec = intervals > 0 && elapsedSeconds > 0 ? intervals / elapsedSeconds : -1;
|
|
2687
|
+
if (wantTimes) {
|
|
2688
|
+
let remaining = -1;
|
|
2689
|
+
if (itemsPerSec > 0) {
|
|
2690
|
+
remaining = (total - count) / itemsPerSec;
|
|
2691
|
+
}
|
|
2692
|
+
payload.elapsed = this.round(elapsedSeconds, 2);
|
|
2693
|
+
payload.remaining = remaining >= 0 ? this.round(remaining, 2) : remaining;
|
|
2694
|
+
}
|
|
2695
|
+
if (wantRate) {
|
|
2696
|
+
payload.rate = itemsPerSec >= 0 ? this.round(itemsPerSec, 2) : itemsPerSec;
|
|
2681
2697
|
}
|
|
2682
|
-
payload.elapsed = this.round(elapsedSeconds, 2);
|
|
2683
|
-
payload.remaining = remaining >= 0 ? this.round(remaining, 2) : remaining;
|
|
2684
2698
|
}
|
|
2685
2699
|
if (count >= total) {
|
|
2686
2700
|
delete this.startTimes[prefix ?? ""];
|
|
@@ -2745,10 +2759,13 @@ var Logger = class _Logger {
|
|
|
2745
2759
|
parts.push(formatter.bold(struct.message));
|
|
2746
2760
|
}
|
|
2747
2761
|
if (struct.level === "progress") {
|
|
2762
|
+
const formatter = LEVEL_COLORS[struct.level];
|
|
2748
2763
|
if (struct.elapsed !== void 0 && struct.remaining !== void 0) {
|
|
2749
|
-
const formatter = LEVEL_COLORS[struct.level];
|
|
2750
2764
|
parts.push(formatter(`${struct.elapsed}/${struct.remaining}`));
|
|
2751
2765
|
}
|
|
2766
|
+
if (struct.rate !== void 0) {
|
|
2767
|
+
parts.push(formatter(struct.rate >= 0 ? `${struct.rate}/s` : "-/s"));
|
|
2768
|
+
}
|
|
2752
2769
|
}
|
|
2753
2770
|
if (struct.chunks && struct.chunks.length) {
|
|
2754
2771
|
parts.push(this.inspectChunks(struct.chunks));
|