@zerodeploy/cli 0.1.13 → 0.1.14
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.js +74 -5
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -4977,8 +4977,7 @@ var usageCommand = new Command2("usage").description("Show current usage and lim
|
|
|
4977
4977
|
}
|
|
4978
4978
|
console.log();
|
|
4979
4979
|
console.log("Account Usage:");
|
|
4980
|
-
console.log(formatUsageLine("
|
|
4981
|
-
console.log(formatUsageLine("Total Sites", data.usage.sites, data.limits.max_orgs * data.limits.max_sites_per_org));
|
|
4980
|
+
console.log(formatUsageLine("Total Sites", data.usage.sites, data.limits.max_sites_per_org));
|
|
4982
4981
|
console.log(formatUsageLine("Deployments (month)", data.usage.deployments_this_month, data.limits.max_deployments_per_month));
|
|
4983
4982
|
console.log();
|
|
4984
4983
|
console.log("Limits:");
|
|
@@ -7086,7 +7085,7 @@ var deployPromoteCommand = new Command2("promote").description("Promote a previe
|
|
|
7086
7085
|
});
|
|
7087
7086
|
|
|
7088
7087
|
// src/lib/version.ts
|
|
7089
|
-
var VERSION = "0.1.
|
|
7088
|
+
var VERSION = "0.1.14";
|
|
7090
7089
|
|
|
7091
7090
|
// src/commands/deploy/index.ts
|
|
7092
7091
|
function slugify(input) {
|
|
@@ -7544,6 +7543,7 @@ Error: Build failed`);
|
|
|
7544
7543
|
body: JSON.stringify({ preview: isPreview, mode: options.append ? "append" : "replace" })
|
|
7545
7544
|
}, {
|
|
7546
7545
|
maxRetries: 3,
|
|
7546
|
+
timeoutMs: 120000,
|
|
7547
7547
|
onRetry: (attempt, error, delayMs) => {
|
|
7548
7548
|
finalizeSpinner.update(`Finalizing... ${formatRetryMessage(attempt, 3, error)}, retrying in ${Math.round(delayMs / 1000)}s`);
|
|
7549
7549
|
}
|
|
@@ -7819,8 +7819,77 @@ var deploymentsShowCommand = new Command2("show").description("View deployment d
|
|
|
7819
7819
|
}
|
|
7820
7820
|
});
|
|
7821
7821
|
|
|
7822
|
+
// src/commands/deployments/logs.ts
|
|
7823
|
+
function colorLevel(level) {
|
|
7824
|
+
switch (level) {
|
|
7825
|
+
case "error":
|
|
7826
|
+
return `\x1B[31m${level}\x1B[0m`;
|
|
7827
|
+
case "warn":
|
|
7828
|
+
return `\x1B[33m${level}\x1B[0m`;
|
|
7829
|
+
case "info":
|
|
7830
|
+
return `\x1B[36m${level}\x1B[0m`;
|
|
7831
|
+
default:
|
|
7832
|
+
return level;
|
|
7833
|
+
}
|
|
7834
|
+
}
|
|
7835
|
+
function formatTime(timestamp) {
|
|
7836
|
+
const d = new Date(timestamp);
|
|
7837
|
+
return d.toLocaleTimeString(undefined, { hour12: false, fractionalSecondDigits: 3 });
|
|
7838
|
+
}
|
|
7839
|
+
var deploymentsLogsCommand = new Command2("logs").description("View deployment finalize logs").argument("<id>", "Deployment ID (full or short)").option("--json", "Output as JSON").action(async (id, options) => {
|
|
7840
|
+
const token = loadToken();
|
|
7841
|
+
if (!token) {
|
|
7842
|
+
handleAuthError();
|
|
7843
|
+
}
|
|
7844
|
+
try {
|
|
7845
|
+
const client = getClient(token);
|
|
7846
|
+
const res = await client.deployments[":id"].logs.$get({
|
|
7847
|
+
param: { id }
|
|
7848
|
+
});
|
|
7849
|
+
if (!res.ok) {
|
|
7850
|
+
if (res.status === 404) {
|
|
7851
|
+
displayError({
|
|
7852
|
+
code: "not_found",
|
|
7853
|
+
message: `Deployment not found: ${id}`,
|
|
7854
|
+
hint: "Use the full deployment ID or at least 8 characters."
|
|
7855
|
+
});
|
|
7856
|
+
process.exit(ExitCode.NOT_FOUND);
|
|
7857
|
+
}
|
|
7858
|
+
await handleApiError(res);
|
|
7859
|
+
}
|
|
7860
|
+
const { data: entries } = await res.json();
|
|
7861
|
+
if (options.json) {
|
|
7862
|
+
console.log(JSON.stringify(entries, null, 2));
|
|
7863
|
+
return;
|
|
7864
|
+
}
|
|
7865
|
+
if (entries.length === 0) {
|
|
7866
|
+
console.log("No logs available for this deployment.");
|
|
7867
|
+
console.log("Logs are only available for deployments created after this feature was enabled.");
|
|
7868
|
+
return;
|
|
7869
|
+
}
|
|
7870
|
+
console.log("Deployment Logs");
|
|
7871
|
+
console.log("=".repeat(60));
|
|
7872
|
+
console.log();
|
|
7873
|
+
for (const entry of entries) {
|
|
7874
|
+
const time = formatTime(entry.timestamp);
|
|
7875
|
+
const level = colorLevel(entry.level);
|
|
7876
|
+
const phase = `\x1B[90m[${entry.phase}]\x1B[0m`;
|
|
7877
|
+
const duration = entry.duration_ms !== undefined ? ` \x1B[90m(${entry.duration_ms}ms)\x1B[0m` : "";
|
|
7878
|
+
console.log(`${time} ${level} ${phase} ${entry.message}${duration}`);
|
|
7879
|
+
if (entry.metadata && Object.keys(entry.metadata).length > 0) {
|
|
7880
|
+
const meta = Object.entries(entry.metadata).map(([k, v]) => `${k}=${v}`).join(" ");
|
|
7881
|
+
console.log(` \x1B[90m${meta}\x1B[0m`);
|
|
7882
|
+
}
|
|
7883
|
+
}
|
|
7884
|
+
} catch (err) {
|
|
7885
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
7886
|
+
displayError({ code: "network_error", message: `Failed to get deployment logs: ${message}` });
|
|
7887
|
+
process.exit(ExitCode.NETWORK_ERROR);
|
|
7888
|
+
}
|
|
7889
|
+
});
|
|
7890
|
+
|
|
7822
7891
|
// src/commands/deployments/index.ts
|
|
7823
|
-
var deploymentsCommand = new Command2("deployments").description("Manage deployments").addCommand(deploymentsListCommand).addCommand(deploymentsShowCommand);
|
|
7892
|
+
var deploymentsCommand = new Command2("deployments").description("Manage deployments").addCommand(deploymentsListCommand).addCommand(deploymentsShowCommand).addCommand(deploymentsLogsCommand);
|
|
7824
7893
|
|
|
7825
7894
|
// src/commands/rollback.ts
|
|
7826
7895
|
var rollbackCommand = new Command2("rollback").description("Rollback a site to a previous deployment").argument("<site>", "Site slug").requiredOption("--org <org>", "Organization slug").option("--to <deploymentId>", "Deployment ID to rollback to (defaults to previous deployment)").action(async (site, options) => {
|
|
@@ -8544,7 +8613,7 @@ function createInspectCommand(rootProgram) {
|
|
|
8544
8613
|
}
|
|
8545
8614
|
|
|
8546
8615
|
// src/lib/version.ts
|
|
8547
|
-
var VERSION2 = "0.1.
|
|
8616
|
+
var VERSION2 = "0.1.14";
|
|
8548
8617
|
|
|
8549
8618
|
// src/lib/update-check.ts
|
|
8550
8619
|
import { existsSync as existsSync3, mkdirSync, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
|