@zerodeploy/cli 0.1.8 → 0.1.10

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.
Files changed (2) hide show
  1. package/dist/cli.js +35 -12
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -5616,6 +5616,9 @@ var deployPromoteCommand = new Command2("promote").description("Promote a previe
5616
5616
  }
5617
5617
  });
5618
5618
 
5619
+ // src/lib/version.ts
5620
+ var VERSION = "0.1.10";
5621
+
5619
5622
  // src/commands/deploy/index.ts
5620
5623
  function slugify(input) {
5621
5624
  return input.toLowerCase().trim().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)+/g, "");
@@ -5816,7 +5819,7 @@ var deployCommand = new Command2("deploy").description("Deploy a site").argument
5816
5819
  spinner.fail("Pre-flight check failed");
5817
5820
  const body = await sitesRes.json();
5818
5821
  displayError(parseApiError(body));
5819
- return;
5822
+ process.exit(sitesRes.status >= 500 ? 5 : 3);
5820
5823
  }
5821
5824
  const { data: sites } = await sitesRes.json();
5822
5825
  const siteExists = sites.some((s) => s.slug === siteSlug);
@@ -5909,6 +5912,7 @@ Error: Build failed`);
5909
5912
  }
5910
5913
  }
5911
5914
  console.log(`Deploying: ${deployDir}`);
5915
+ console.log(`CLI version: ${VERSION}`);
5912
5916
  const files = await scanDirectory(deployDir);
5913
5917
  if (files.length === 0) {
5914
5918
  console.log("Error: No files found to deploy");
@@ -5967,15 +5971,18 @@ Error: Build failed`);
5967
5971
  commitsToCheck.push(...parents);
5968
5972
  }
5969
5973
  } catch {}
5970
- if (commitsToCheck.length > 1) {
5971
- console.log(`Checking for existing deployment (commits: ${commitsToCheck.map((s) => s.slice(0, 7)).join(", ")})...`);
5972
- }
5974
+ console.log(`Checking for existing deployment...`);
5975
+ console.log(` Commits: ${commitsToCheck.map((s) => s.slice(0, 7)).join(", ")}`);
5976
+ console.log(` Full SHA lengths: ${commitsToCheck.map((s) => s.length).join(", ")}`);
5973
5977
  const findRes = await client.orgs[":orgSlug"].sites[":siteSlug"].deployments["by-commit"].$get({
5974
5978
  param: { orgSlug, siteSlug },
5975
5979
  query: { commits: commitsToCheck.join(",") }
5976
5980
  });
5977
5981
  if (findRes.ok) {
5978
5982
  const { data: existingDeployment } = await findRes.json();
5983
+ if (!existingDeployment) {
5984
+ console.log(` No matching deployment found`);
5985
+ }
5979
5986
  if (existingDeployment && existingDeployment.status === "ready") {
5980
5987
  const matchedSha = existingDeployment.commit_sha?.slice(0, 8) || "unknown";
5981
5988
  console.log(`Found existing deployment for commit ${matchedSha}`);
@@ -5987,7 +5994,7 @@ Error: Build failed`);
5987
5994
  if (!promoteRes.ok) {
5988
5995
  const body = await promoteRes.json();
5989
5996
  displayError(parseApiError(body));
5990
- return;
5997
+ process.exit(promoteRes.status >= 500 ? 5 : 3);
5991
5998
  }
5992
5999
  const { data: promoteData } = await promoteRes.json();
5993
6000
  console.log("Deployment promoted!");
@@ -6024,7 +6031,7 @@ Error: Build failed`);
6024
6031
  if (!createRes.ok) {
6025
6032
  const body = await createRes.json();
6026
6033
  displayError(parseApiError(body));
6027
- return;
6034
+ process.exit(createRes.status >= 500 ? 5 : 3);
6028
6035
  }
6029
6036
  const { data: deployment } = await createRes.json();
6030
6037
  console.log(`Created deployment: ${deployment.id}`);
@@ -6061,8 +6068,27 @@ Error: Build failed`);
6061
6068
  }
6062
6069
  });
6063
6070
  if (!finalizeRes.ok) {
6064
- finalizeSpinner.stop("Error: Failed to finalize deployment");
6065
- return;
6071
+ finalizeSpinner.stop();
6072
+ const body = await finalizeRes.json().catch(() => ({}));
6073
+ displayError(parseApiError(body));
6074
+ process.exit(5);
6075
+ }
6076
+ const verifyRecordRes = await client.deployments[":id"].$get({
6077
+ param: { id: deployment.id }
6078
+ });
6079
+ if (!verifyRecordRes.ok) {
6080
+ finalizeSpinner.stop();
6081
+ console.log("");
6082
+ console.log("Error: Deployment finalized but record not found in database");
6083
+ console.log("This may be a temporary database issue. Please retry.");
6084
+ process.exit(5);
6085
+ }
6086
+ const { data: verifiedDeployment } = await verifyRecordRes.json();
6087
+ if (verifiedDeployment.status !== "ready") {
6088
+ finalizeSpinner.stop();
6089
+ console.log("");
6090
+ console.log(`Error: Deployment status is "${verifiedDeployment.status}", expected "ready"`);
6091
+ process.exit(5);
6066
6092
  }
6067
6093
  finalizeSpinner.stop();
6068
6094
  const verifyUrl = isPreview ? deployment.previewUrl : deployment.url;
@@ -6892,9 +6918,6 @@ var accountCommand = new Command2("account").description("Manage your ZeroDeploy
6892
6918
  }
6893
6919
  }));
6894
6920
 
6895
- // src/lib/version.ts
6896
- var VERSION = "0.1.8";
6897
-
6898
6921
  // src/commands/inspect.ts
6899
6922
  function getCommandByPath(rootCommand, path3) {
6900
6923
  let current = rootCommand;
@@ -7022,7 +7045,7 @@ function createInspectCommand(rootProgram) {
7022
7045
  }
7023
7046
 
7024
7047
  // src/lib/version.ts
7025
- var VERSION2 = "0.1.8";
7048
+ var VERSION2 = "0.1.10";
7026
7049
 
7027
7050
  // src/lib/update-check.ts
7028
7051
  import { existsSync as existsSync3, mkdirSync, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zerodeploy/cli",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "zerodeploy": "dist/cli.js"