@zerodeploy/cli 0.1.5 → 0.1.6

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 +17 -5
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -5941,13 +5941,25 @@ 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
+ const findRes = await client.orgs[":orgSlug"].sites[":siteSlug"].deployments["by-commit"].$get({
5955
+ param: { orgSlug, siteSlug },
5956
+ query: { commits: commitsToCheck.join(",") }
5946
5957
  });
5947
5958
  if (findRes.ok) {
5948
5959
  const { data: existingDeployment } = await findRes.json();
5949
5960
  if (existingDeployment && existingDeployment.status === "ready") {
5950
- console.log(`Found existing deployment for commit ${commitSha.slice(0, 8)}`);
5961
+ const matchedSha = existingDeployment.commit_sha?.slice(0, 8) || "unknown";
5962
+ console.log(`Found existing deployment for commit ${matchedSha}`);
5951
5963
  console.log("Promoting to production instead of re-uploading...");
5952
5964
  console.log("");
5953
5965
  const promoteRes = await client.deployments[":id"].rollback.$post({
@@ -6862,7 +6874,7 @@ var accountCommand = new Command2("account").description("Manage your ZeroDeploy
6862
6874
  }));
6863
6875
 
6864
6876
  // src/lib/version.ts
6865
- var VERSION = "0.1.5";
6877
+ var VERSION = "0.1.6";
6866
6878
 
6867
6879
  // src/commands/inspect.ts
6868
6880
  function getCommandByPath(rootCommand, path3) {
@@ -6991,7 +7003,7 @@ function createInspectCommand(rootProgram) {
6991
7003
  }
6992
7004
 
6993
7005
  // src/lib/version.ts
6994
- var VERSION2 = "0.1.5";
7006
+ var VERSION2 = "0.1.6";
6995
7007
 
6996
7008
  // src/lib/update-check.ts
6997
7009
  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.6",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "zerodeploy": "dist/cli.js"