@nmakarov/cli-toolkit 0.77.0 → 0.79.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 +12 -7
- package/dist/cli-runner.cjs.map +1 -1
- package/dist/cli-runner.js +12 -7
- package/dist/cli-runner.js.map +1 -1
- package/dist/deploy.cjs +10 -0
- package/dist/deploy.cjs.map +1 -1
- package/dist/deploy.js +10 -0
- package/dist/deploy.js.map +1 -1
- package/dist/index.cjs +22 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +22 -7
- package/dist/index.js.map +1 -1
- package/dist/init.cjs +12 -7
- package/dist/init.cjs.map +1 -1
- package/dist/init.js +12 -7
- package/dist/init.js.map +1 -1
- package/dist/logger.cjs +12 -7
- package/dist/logger.cjs.map +1 -1
- package/dist/logger.js +12 -7
- package/dist/logger.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5181,6 +5181,8 @@ var Logger = class _Logger {
|
|
|
5181
5181
|
options;
|
|
5182
5182
|
transport;
|
|
5183
5183
|
startTimes = {};
|
|
5184
|
+
/** Count at the first progress sample for each prefix (rate baseline). */
|
|
5185
|
+
startCounts = {};
|
|
5184
5186
|
lastProgressTimes = {};
|
|
5185
5187
|
constructor(context, options = {}) {
|
|
5186
5188
|
this.context = context;
|
|
@@ -5316,15 +5318,17 @@ var Logger = class _Logger {
|
|
|
5316
5318
|
total,
|
|
5317
5319
|
prefix
|
|
5318
5320
|
};
|
|
5319
|
-
|
|
5320
|
-
|
|
5321
|
+
const key = prefix ?? "";
|
|
5322
|
+
if (this.startTimes[key] === void 0) {
|
|
5323
|
+
this.startTimes[key] = Date.now();
|
|
5324
|
+
this.startCounts[key] = count;
|
|
5321
5325
|
}
|
|
5322
5326
|
const wantTimes = this.options.progressTimes;
|
|
5323
5327
|
const wantRate = this.options.progressRate;
|
|
5324
5328
|
if (wantTimes || wantRate) {
|
|
5325
|
-
const elapsedSeconds = (Date.now() - this.startTimes[
|
|
5326
|
-
const
|
|
5327
|
-
const itemsPerSec =
|
|
5329
|
+
const elapsedSeconds = (Date.now() - this.startTimes[key]) / 1e3;
|
|
5330
|
+
const done = count - (this.startCounts[key] ?? count);
|
|
5331
|
+
const itemsPerSec = done > 0 && elapsedSeconds > 0 ? done / elapsedSeconds : -1;
|
|
5328
5332
|
if (wantTimes) {
|
|
5329
5333
|
let remaining = -1;
|
|
5330
5334
|
if (itemsPerSec > 0) {
|
|
@@ -5338,8 +5342,9 @@ var Logger = class _Logger {
|
|
|
5338
5342
|
}
|
|
5339
5343
|
}
|
|
5340
5344
|
if (count >= total) {
|
|
5341
|
-
delete this.startTimes[
|
|
5342
|
-
delete this.
|
|
5345
|
+
delete this.startTimes[key];
|
|
5346
|
+
delete this.startCounts[key];
|
|
5347
|
+
delete this.lastProgressTimes[key];
|
|
5343
5348
|
}
|
|
5344
5349
|
if (this.shouldOutputProgress(prefix ?? "", count, total)) {
|
|
5345
5350
|
this.out(payload);
|
|
@@ -6315,6 +6320,12 @@ function resolveKillTimeoutMs(pm2) {
|
|
|
6315
6320
|
if (Number.isFinite(stopSec) && stopSec > 0) return Math.floor(stopSec * 1e3) + 5e3;
|
|
6316
6321
|
return 65e3;
|
|
6317
6322
|
}
|
|
6323
|
+
var DEFAULT_KILL_RETRY_TIME_MS = 1e4;
|
|
6324
|
+
function resolveKillRetryTimeMs(pm2) {
|
|
6325
|
+
const explicit = Number(pm2?.killRetryTime);
|
|
6326
|
+
if (Number.isFinite(explicit) && explicit > 0) return Math.floor(explicit);
|
|
6327
|
+
return DEFAULT_KILL_RETRY_TIME_MS;
|
|
6328
|
+
}
|
|
6318
6329
|
function resolvePm2Args(pm2) {
|
|
6319
6330
|
const base = String(pm2?.args ?? "").trim();
|
|
6320
6331
|
const stopSec = Number(pm2?.stopAllowance);
|
|
@@ -6338,6 +6349,7 @@ function buildEcosystemConfig(service, paths) {
|
|
|
6338
6349
|
const outLog = join9(paths.logs, `${pm2.appName}.out.log`);
|
|
6339
6350
|
const errLog = join9(paths.logs, `${pm2.appName}.err.log`);
|
|
6340
6351
|
const killTimeoutMs = resolveKillTimeoutMs(pm2);
|
|
6352
|
+
const killRetryTimeMs = resolveKillRetryTimeMs(pm2);
|
|
6341
6353
|
const args = resolvePm2Args(pm2);
|
|
6342
6354
|
const ensureEnv = paths.ensureEnv;
|
|
6343
6355
|
return `/**
|
|
@@ -6363,6 +6375,9 @@ module.exports = {
|
|
|
6363
6375
|
max_memory_restart: "1500M",
|
|
6364
6376
|
// Grace window after SIGINT/SIGTERM before SIGKILL (ms). Align with --stopAllowance.
|
|
6365
6377
|
kill_timeout: ${killTimeoutMs},
|
|
6378
|
+
// How often pm2 re-checks / logs "failed to kill - retrying in \u2026"
|
|
6379
|
+
// while waiting for graceful exit (pm2 default 100ms \u2192 noisy logs).
|
|
6380
|
+
kill_retry_time: ${killRetryTimeMs},
|
|
6366
6381
|
out_file: "${outLog}",
|
|
6367
6382
|
error_file: "${errLog}",
|
|
6368
6383
|
merge_logs: true,
|