@zerodeploy/cli 0.1.5 → 0.1.7

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 +20 -5
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -5941,13 +5941,28 @@ Error: Build failed`);
5941
5941
  deployPayload.branch = branch;
5942
5942
  }
5943
5943
  if (!isPreview && commitSha) {
5944
- const findRes = await client.orgs[":orgSlug"].sites[":siteSlug"].deployments["by-commit"][":commitSha"].$get({
5945
- param: { orgSlug, siteSlug, commitSha }
5944
+ const commitsToCheck = [commitSha];
5945
+ try {
5946
+ const { execSync } = await import("node:child_process");
5947
+ const parentOutput = execSync("git rev-parse HEAD^@ 2>/dev/null", { encoding: "utf-8" }).trim();
5948
+ if (parentOutput) {
5949
+ const parents = parentOutput.split(`
5950
+ `).filter(Boolean);
5951
+ commitsToCheck.push(...parents);
5952
+ }
5953
+ } catch {}
5954
+ if (commitsToCheck.length > 1) {
5955
+ console.log(`Checking for existing deployment (commits: ${commitsToCheck.map((s) => s.slice(0, 7)).join(", ")})...`);
5956
+ }
5957
+ const findRes = await client.orgs[":orgSlug"].sites[":siteSlug"].deployments["by-commit"].$get({
5958
+ param: { orgSlug, siteSlug },
5959
+ query: { commits: commitsToCheck.join(",") }
5946
5960
  });
5947
5961
  if (findRes.ok) {
5948
5962
  const { data: existingDeployment } = await findRes.json();
5949
5963
  if (existingDeployment && existingDeployment.status === "ready") {
5950
- console.log(`Found existing deployment for commit ${commitSha.slice(0, 8)}`);
5964
+ const matchedSha = existingDeployment.commit_sha?.slice(0, 8) || "unknown";
5965
+ console.log(`Found existing deployment for commit ${matchedSha}`);
5951
5966
  console.log("Promoting to production instead of re-uploading...");
5952
5967
  console.log("");
5953
5968
  const promoteRes = await client.deployments[":id"].rollback.$post({
@@ -6862,7 +6877,7 @@ var accountCommand = new Command2("account").description("Manage your ZeroDeploy
6862
6877
  }));
6863
6878
 
6864
6879
  // src/lib/version.ts
6865
- var VERSION = "0.1.5";
6880
+ var VERSION = "0.1.7";
6866
6881
 
6867
6882
  // src/commands/inspect.ts
6868
6883
  function getCommandByPath(rootCommand, path3) {
@@ -6991,7 +7006,7 @@ function createInspectCommand(rootProgram) {
6991
7006
  }
6992
7007
 
6993
7008
  // src/lib/version.ts
6994
- var VERSION2 = "0.1.5";
7009
+ var VERSION2 = "0.1.7";
6995
7010
 
6996
7011
  // src/lib/update-check.ts
6997
7012
  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.5",
3
+ "version": "0.1.7",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "zerodeploy": "dist/cli.js"