@theholocron/cli 5.0.0-alpha.492 → 5.0.0-alpha.493
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 +8 -0
- package/dist/cli.mjs +45 -14
- package/dist/cli.mjs.map +1 -1
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -557,6 +557,14 @@ non-zero and the output includes the provider's own reason
|
|
|
557
557
|
exited with 1`). Providers build asynchronously, so accepting a deployment
|
|
558
558
|
isn't the same as it going live (holocron#911).
|
|
559
559
|
|
|
560
|
+
With `--files`, a deployment that ends `error` because its package install
|
|
561
|
+
failed (`Command "npm install" exited with 1`) is deployed again, twice more,
|
|
562
|
+
after 60 s and then 120 s: right after a release the registry can lag a
|
|
563
|
+
version published seconds earlier (holocron#2406). Each retry is reported, and
|
|
564
|
+
when every try fails the command exits non-zero with the deployment URL, the
|
|
565
|
+
install error and the manual redeploy command. Any other failure (a build
|
|
566
|
+
error, a cancellation, a timeout) is never retried.
|
|
567
|
+
|
|
560
568
|
Provider plugins support this through the `Deployment` capability's
|
|
561
569
|
existing `getDeployment(id)`. They should set `errorMessage` on the
|
|
562
570
|
returned `DeploymentRecord` whenever the provider exposes one.
|
package/dist/cli.mjs
CHANGED
|
@@ -6135,6 +6135,9 @@ const deployOnReleaseCommand = {
|
|
|
6135
6135
|
*/
|
|
6136
6136
|
const DEFAULT_WAIT_TIMEOUT_MS = 6e5;
|
|
6137
6137
|
const DEFAULT_WAIT_INTERVAL_MS = 5e3;
|
|
6138
|
+
/** Tries for a files deployment whose install fails (the first plus two retries), and the waits between them (3 minutes in all). */
|
|
6139
|
+
const DEFAULT_INSTALL_RETRY_ATTEMPTS = 3;
|
|
6140
|
+
const DEFAULT_INSTALL_RETRY_DELAYS_MS = [6e4, 12e4];
|
|
6138
6141
|
const TERMINAL_STATUSES = /* @__PURE__ */ new Set([
|
|
6139
6142
|
"ready",
|
|
6140
6143
|
"error",
|
|
@@ -6158,6 +6161,10 @@ async function waitForDeployment(deploy, deploymentId, options = {}) {
|
|
|
6158
6161
|
await sleep(intervalMs);
|
|
6159
6162
|
}
|
|
6160
6163
|
}
|
|
6164
|
+
/** True for a deployment the provider ended in `error` because its package install failed. */
|
|
6165
|
+
function isInstallFailure(record) {
|
|
6166
|
+
return record.status === "error" && /\b(?:npm|pnpm|yarn) install\b/i.test(record.errorMessage ?? "");
|
|
6167
|
+
}
|
|
6161
6168
|
/** One terminal, non-ready record as a single human-readable failure line. */
|
|
6162
6169
|
function terminalFailure(record) {
|
|
6163
6170
|
return `deployment ${record.id} ended ${record.status}${record.errorMessage ? `: ${record.errorMessage}` : ""}`;
|
|
@@ -6290,19 +6297,38 @@ async function runDeployFromFiles(input) {
|
|
|
6290
6297
|
};
|
|
6291
6298
|
}
|
|
6292
6299
|
try {
|
|
6293
|
-
const
|
|
6294
|
-
|
|
6295
|
-
|
|
6296
|
-
|
|
6297
|
-
|
|
6298
|
-
|
|
6299
|
-
|
|
6300
|
-
|
|
6301
|
-
|
|
6302
|
-
|
|
6303
|
-
|
|
6304
|
-
|
|
6305
|
-
|
|
6300
|
+
const retry = input.retry ?? {};
|
|
6301
|
+
const attempts = Math.max(1, retry.attempts ?? DEFAULT_INSTALL_RETRY_ATTEMPTS);
|
|
6302
|
+
const delays = retry.delaysMs ?? DEFAULT_INSTALL_RETRY_DELAYS_MS;
|
|
6303
|
+
const sleep = retry.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
6304
|
+
let result;
|
|
6305
|
+
for (let attempt = 1;; attempt++) {
|
|
6306
|
+
result = await withSpinner(`Deploying ${fileCount} file${fileCount === 1 ? "" : "s"} from ${input.dir}…`, () => deploy.deployFunction(input.projectId, {
|
|
6307
|
+
files,
|
|
6308
|
+
...input.target ? { target: input.target } : {},
|
|
6309
|
+
...input.previewKey && !input.target ? { meta: { holocronPreview: input.previewKey } } : {}
|
|
6310
|
+
}));
|
|
6311
|
+
logger.info({
|
|
6312
|
+
url: result.url,
|
|
6313
|
+
id: result.deploymentId,
|
|
6314
|
+
attempt
|
|
6315
|
+
}, "deploy: triggered (files)");
|
|
6316
|
+
const record = await withSpinner(`Waiting for ${withScheme(result.url)} to finish…`, () => waitForDeployment(deploy, result.deploymentId, input.wait));
|
|
6317
|
+
if (record.status === "ready") break;
|
|
6318
|
+
if (isInstallFailure(record) && attempt < attempts) {
|
|
6319
|
+
const delayMs = delays[Math.min(attempt - 1, delays.length - 1)] ?? 0;
|
|
6320
|
+
print(` ${style.warn(`${terminalFailure(record)} — ${withScheme(result.url)}; retrying in ${Math.round(delayMs / 1e3)}s (attempt ${attempt + 1} of ${attempts})`)}`);
|
|
6321
|
+
logger.warn({
|
|
6322
|
+
id: record.id,
|
|
6323
|
+
reason: record.errorMessage,
|
|
6324
|
+
attempt
|
|
6325
|
+
}, "deploy: install failed, retrying");
|
|
6326
|
+
await sleep(delayMs);
|
|
6327
|
+
continue;
|
|
6328
|
+
}
|
|
6329
|
+
const base = terminalFailure(record);
|
|
6330
|
+
const message = isInstallFailure(record) ? `${base} — ${withScheme(result.url)} (after ${attempt} attempt${attempt === 1 ? "" : "s"}). Redeploy by hand with \`pnpm --filter @theholocron/sentinel run deploy\` once npm serves the staged versions.` : base;
|
|
6331
|
+
print(` ${style.fail(`${message}${isInstallFailure(record) ? "" : ` — ${withScheme(result.url)}`}`)}`);
|
|
6306
6332
|
logger.warn({
|
|
6307
6333
|
id: record.id,
|
|
6308
6334
|
status: record.status,
|
|
@@ -24409,7 +24435,11 @@ function groupOf(dir) {
|
|
|
24409
24435
|
return dir.split("/")[0] || "root";
|
|
24410
24436
|
}
|
|
24411
24437
|
// src/commands/probe/deps/collect-edges.ts
|
|
24412
|
-
/**
|
|
24438
|
+
/**
|
|
24439
|
+
* Every dependency edge in the workspace: one per manifest entry that is not a `workspace:` link. The root manifest's
|
|
24440
|
+
* `link:` entries for workspace packages are left out too: turbo gives the root an edge to every package that has no
|
|
24441
|
+
* internal dependency, so a `workspace:` entry there makes every package affected by a change to any of them (#2407).
|
|
24442
|
+
*/
|
|
24413
24443
|
function collectEdges(root, dirs) {
|
|
24414
24444
|
const edges = [];
|
|
24415
24445
|
const inRepo = /* @__PURE__ */ new Set();
|
|
@@ -24428,6 +24458,7 @@ function collectEdges(root, dirs) {
|
|
|
24428
24458
|
for (const [name, spec] of Object.entries(entries)) {
|
|
24429
24459
|
const range = String(spec);
|
|
24430
24460
|
if (range.startsWith("workspace:")) continue;
|
|
24461
|
+
if (dir === "" && range.startsWith("link:") && inRepo.has(name)) continue;
|
|
24431
24462
|
edges.push({
|
|
24432
24463
|
name,
|
|
24433
24464
|
spec: range,
|