@zerodeploy/cli 0.1.7 → 0.1.9
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 +43 -8
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -5394,11 +5394,12 @@ function createProgressBar(options) {
|
|
|
5394
5394
|
// src/utils/ci.ts
|
|
5395
5395
|
function detectCI() {
|
|
5396
5396
|
if (process.env.GITHUB_ACTIONS === "true") {
|
|
5397
|
+
const commitSha = getGitHubCommitSha();
|
|
5397
5398
|
return {
|
|
5398
5399
|
name: "github-actions",
|
|
5399
5400
|
prNumber: extractGitHubPRNumber(),
|
|
5400
5401
|
prTitle: null,
|
|
5401
|
-
commitSha
|
|
5402
|
+
commitSha,
|
|
5402
5403
|
branch: process.env.GITHUB_HEAD_REF || process.env.GITHUB_REF_NAME || null,
|
|
5403
5404
|
commitMessage: null
|
|
5404
5405
|
};
|
|
@@ -5466,6 +5467,21 @@ function detectCI() {
|
|
|
5466
5467
|
}
|
|
5467
5468
|
return null;
|
|
5468
5469
|
}
|
|
5470
|
+
function getGitHubCommitSha() {
|
|
5471
|
+
if (process.env.GITHUB_EVENT_NAME === "pull_request") {
|
|
5472
|
+
const eventPath = process.env.GITHUB_EVENT_PATH;
|
|
5473
|
+
if (eventPath) {
|
|
5474
|
+
try {
|
|
5475
|
+
const { readFileSync: readFileSync2 } = __require("node:fs");
|
|
5476
|
+
const event = JSON.parse(readFileSync2(eventPath, "utf-8"));
|
|
5477
|
+
if (event?.pull_request?.head?.sha) {
|
|
5478
|
+
return event.pull_request.head.sha;
|
|
5479
|
+
}
|
|
5480
|
+
} catch {}
|
|
5481
|
+
}
|
|
5482
|
+
}
|
|
5483
|
+
return process.env.GITHUB_SHA || null;
|
|
5484
|
+
}
|
|
5469
5485
|
function extractGitHubPRNumber() {
|
|
5470
5486
|
const ref = process.env.GITHUB_REF;
|
|
5471
5487
|
if (process.env.GITHUB_EVENT_NAME === "pull_request" && ref) {
|
|
@@ -5800,7 +5816,7 @@ var deployCommand = new Command2("deploy").description("Deploy a site").argument
|
|
|
5800
5816
|
spinner.fail("Pre-flight check failed");
|
|
5801
5817
|
const body = await sitesRes.json();
|
|
5802
5818
|
displayError(parseApiError(body));
|
|
5803
|
-
|
|
5819
|
+
process.exit(sitesRes.status >= 500 ? 5 : 3);
|
|
5804
5820
|
}
|
|
5805
5821
|
const { data: sites } = await sitesRes.json();
|
|
5806
5822
|
const siteExists = sites.some((s) => s.slug === siteSlug);
|
|
@@ -5971,7 +5987,7 @@ Error: Build failed`);
|
|
|
5971
5987
|
if (!promoteRes.ok) {
|
|
5972
5988
|
const body = await promoteRes.json();
|
|
5973
5989
|
displayError(parseApiError(body));
|
|
5974
|
-
|
|
5990
|
+
process.exit(promoteRes.status >= 500 ? 5 : 3);
|
|
5975
5991
|
}
|
|
5976
5992
|
const { data: promoteData } = await promoteRes.json();
|
|
5977
5993
|
console.log("Deployment promoted!");
|
|
@@ -6008,7 +6024,7 @@ Error: Build failed`);
|
|
|
6008
6024
|
if (!createRes.ok) {
|
|
6009
6025
|
const body = await createRes.json();
|
|
6010
6026
|
displayError(parseApiError(body));
|
|
6011
|
-
|
|
6027
|
+
process.exit(createRes.status >= 500 ? 5 : 3);
|
|
6012
6028
|
}
|
|
6013
6029
|
const { data: deployment } = await createRes.json();
|
|
6014
6030
|
console.log(`Created deployment: ${deployment.id}`);
|
|
@@ -6045,8 +6061,27 @@ Error: Build failed`);
|
|
|
6045
6061
|
}
|
|
6046
6062
|
});
|
|
6047
6063
|
if (!finalizeRes.ok) {
|
|
6048
|
-
finalizeSpinner.stop(
|
|
6049
|
-
|
|
6064
|
+
finalizeSpinner.stop();
|
|
6065
|
+
const body = await finalizeRes.json().catch(() => ({}));
|
|
6066
|
+
displayError(parseApiError(body));
|
|
6067
|
+
process.exit(5);
|
|
6068
|
+
}
|
|
6069
|
+
const verifyRecordRes = await client.deployments[":id"].$get({
|
|
6070
|
+
param: { id: deployment.id }
|
|
6071
|
+
});
|
|
6072
|
+
if (!verifyRecordRes.ok) {
|
|
6073
|
+
finalizeSpinner.stop();
|
|
6074
|
+
console.log("");
|
|
6075
|
+
console.log("Error: Deployment finalized but record not found in database");
|
|
6076
|
+
console.log("This may be a temporary database issue. Please retry.");
|
|
6077
|
+
process.exit(5);
|
|
6078
|
+
}
|
|
6079
|
+
const { data: verifiedDeployment } = await verifyRecordRes.json();
|
|
6080
|
+
if (verifiedDeployment.status !== "ready") {
|
|
6081
|
+
finalizeSpinner.stop();
|
|
6082
|
+
console.log("");
|
|
6083
|
+
console.log(`Error: Deployment status is "${verifiedDeployment.status}", expected "ready"`);
|
|
6084
|
+
process.exit(5);
|
|
6050
6085
|
}
|
|
6051
6086
|
finalizeSpinner.stop();
|
|
6052
6087
|
const verifyUrl = isPreview ? deployment.previewUrl : deployment.url;
|
|
@@ -6877,7 +6912,7 @@ var accountCommand = new Command2("account").description("Manage your ZeroDeploy
|
|
|
6877
6912
|
}));
|
|
6878
6913
|
|
|
6879
6914
|
// src/lib/version.ts
|
|
6880
|
-
var VERSION = "0.1.
|
|
6915
|
+
var VERSION = "0.1.9";
|
|
6881
6916
|
|
|
6882
6917
|
// src/commands/inspect.ts
|
|
6883
6918
|
function getCommandByPath(rootCommand, path3) {
|
|
@@ -7006,7 +7041,7 @@ function createInspectCommand(rootProgram) {
|
|
|
7006
7041
|
}
|
|
7007
7042
|
|
|
7008
7043
|
// src/lib/version.ts
|
|
7009
|
-
var VERSION2 = "0.1.
|
|
7044
|
+
var VERSION2 = "0.1.9";
|
|
7010
7045
|
|
|
7011
7046
|
// src/lib/update-check.ts
|
|
7012
7047
|
import { existsSync as existsSync3, mkdirSync, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
|