@zuplo/cli 2.3.1 → 2.3.2

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.
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="2a68c8a7-7685-52e4-93e9-6b7b75a92f82")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="d21d5d9e-6092-5c5d-951f-77c2bc0b6a64")}catch(e){}}();
3
3
  import ignore from "ignore";
4
4
  import { minimatch } from "minimatch";
5
5
  import { randomBytes } from "node:crypto";
@@ -88,6 +88,22 @@ async function generateMetadata(argv) {
88
88
  throw new Error("Invalid state: Directory is in detached head state.");
89
89
  }
90
90
  branch = status.current.trim();
91
+ if (branch === "HEAD") {
92
+ const branchCommit = await git.branch(["-a"]);
93
+ const brancheRef = await git.branch([
94
+ "-r",
95
+ "--contains",
96
+ branchCommit.current,
97
+ ]);
98
+ if (brancheRef && brancheRef.all && brancheRef.all[0]) {
99
+ const originBranch = brancheRef.all[0];
100
+ const cleanOriginBranch = originBranch.replace(/^origin\//, "");
101
+ if (!cleanOriginBranch) {
102
+ throw new Error("Invalid state: Directory is in detached head state.");
103
+ }
104
+ branch = cleanOriginBranch.trim();
105
+ }
106
+ }
91
107
  }
92
108
  const sha = (await git.revparse(["HEAD"])).trim();
93
109
  const repoUrl = (await git.listRemote(["--get-url"])).trim();
@@ -115,4 +131,4 @@ async function writeGeneratedMetadata(dir, metadata) {
115
131
  });
116
132
  }
117
133
  //# sourceMappingURL=archive.js.map
118
- //# debugId=2a68c8a7-7685-52e4-93e9-6b7b75a92f82
134
+ //# debugId=d21d5d9e-6092-5c5d-951f-77c2bc0b6a64
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zuplo/cli",
3
- "version": "2.3.1",
3
+ "version": "2.3.2",
4
4
  "type": "module",
5
5
  "repository": "https://github.com/zuplo/cli",
6
6
  "description": "The command-line interface for Zuplo",