@zuplo/cli 2.3.0 → 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
@@ -1,17 +1,17 @@
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]="b240c7b1-8f8c-54c7-b381-3ec9bae18cd4")}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]="1c1c6e29-7b10-5f96-810c-08323d6b3c10")}catch(e){}}();
3
3
  import { confirm } from "@inquirer/prompts";
4
4
  import { printDiagnosticsToConsole, printResultToConsoleAndExitGracefully, } from "../../common/output.js";
5
5
  import { PackageJsonUpgrader } from "../../common/upgraders/package-json-upgrader.js";
6
6
  import { TSConfigUpgrader } from "../../common/upgraders/tsconfig-upgrader.js";
7
7
  import { VsCodeSettingsJsonUpgrader } from "../../common/upgraders/vscode-settings-json-upgrader.js";
8
8
  export async function update(argv) {
9
- let answer = !!argv.prompt;
10
- if (answer) {
9
+ let answer = false;
10
+ if (argv.prompt === true) {
11
11
  printDiagnosticsToConsole("This command will make changes to your source code. Please commit your changes to version control before continuing.");
12
12
  answer = await confirm({ message: "Continue?", default: true });
13
13
  }
14
- if (answer) {
14
+ if (answer || argv.prompt === false) {
15
15
  const u = new PackageJsonUpgrader(argv.dir);
16
16
  if ((await u.isApplicable()).ok) {
17
17
  printDiagnosticsToConsole("Updating your package.json...");
@@ -31,4 +31,4 @@ export async function update(argv) {
31
31
  }
32
32
  }
33
33
  //# sourceMappingURL=handler.js.map
34
- //# debugId=b240c7b1-8f8c-54c7-b381-3ec9bae18cd4
34
+ //# debugId=1c1c6e29-7b10-5f96-810c-08323d6b3c10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zuplo/cli",
3
- "version": "2.3.0",
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",