@release-change/git 0.1.4 → 0.2.1

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 (41) hide show
  1. package/README.md +2 -2
  2. package/dist/add.js +1 -1
  3. package/dist/add.js.map +1 -1
  4. package/dist/cancel-commits-since-ref.d.ts.map +1 -1
  5. package/dist/cancel-commits-since-ref.js +5 -4
  6. package/dist/cancel-commits-since-ref.js.map +1 -1
  7. package/dist/check-authorisation.d.ts.map +1 -1
  8. package/dist/check-authorisation.js +6 -6
  9. package/dist/check-authorisation.js.map +1 -1
  10. package/dist/commit.js +1 -1
  11. package/dist/commit.js.map +1 -1
  12. package/dist/delete-branch-on-remote-repository.d.ts +8 -0
  13. package/dist/delete-branch-on-remote-repository.d.ts.map +1 -0
  14. package/dist/delete-branch-on-remote-repository.js +41 -0
  15. package/dist/delete-branch-on-remote-repository.js.map +1 -0
  16. package/dist/delete-branch.d.ts +8 -0
  17. package/dist/delete-branch.d.ts.map +1 -0
  18. package/dist/delete-branch.js +33 -0
  19. package/dist/delete-branch.js.map +1 -0
  20. package/dist/index.d.ts +3 -0
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +3 -0
  23. package/dist/index.js.map +1 -1
  24. package/dist/push.d.ts.map +1 -1
  25. package/dist/push.js +7 -7
  26. package/dist/push.js.map +1 -1
  27. package/dist/remove-tag-on-remote-repository.d.ts.map +1 -1
  28. package/dist/remove-tag-on-remote-repository.js +5 -4
  29. package/dist/remove-tag-on-remote-repository.js.map +1 -1
  30. package/dist/remove-tag.d.ts.map +1 -1
  31. package/dist/remove-tag.js +5 -4
  32. package/dist/remove-tag.js.map +1 -1
  33. package/dist/switch-to-branch.d.ts +7 -0
  34. package/dist/switch-to-branch.d.ts.map +1 -0
  35. package/dist/switch-to-branch.js +20 -0
  36. package/dist/switch-to-branch.js.map +1 -0
  37. package/dist/switch-to-new-branch.d.ts +0 -1
  38. package/dist/switch-to-new-branch.d.ts.map +1 -1
  39. package/dist/switch-to-new-branch.js +0 -1
  40. package/dist/switch-to-new-branch.js.map +1 -1
  41. package/package.json +5 -5
package/README.md CHANGED
@@ -4,8 +4,8 @@ Functions used internally in release-change to make Git operations easier
4
4
 
5
5
  ![License: MIT](https://img.shields.io/github/license/release-change/release-change)
6
6
  [![ESM-only package](https://img.shields.io/badge/package-ESM--only-ffe536)](https://nodejs.org/api/esm.html)
7
- [![Conventional Commits 1.0.0](https://img.shields.io/badge/Conventional%20Commits-1.0.0-%23FE5196?logo=conventionalcommits&logoColor=white)](https://conventionalcommits.org)
8
- [![Formatted with Biome](https://img.shields.io/badge/Formatted_with-Biome-60a5fa?style=flat&logo=biome)](https://biomejs.dev/)
7
+ [![Conventional Commits 1.0.0](https://img.shields.io/badge/Conventional_Commits-1.0.0-fe5196?logo=conventionalcommits&logoColor=white)](https://conventionalcommits.org)
8
+ [![Checked with Biome](https://img.shields.io/badge/Checked_with-Biome-60a5fa?style=flat&logo=biome)](https://biomejs.dev)
9
9
  ![NPM latest version](https://img.shields.io/npm/v/%40release-change%2Fgit/latest)
10
10
  ![Node support](https://img.shields.io/node/v/%40release-change%2Fgit)
11
11
  ![Build status](https://img.shields.io/github/actions/workflow/status/release-change/release-change/run-tests.yml)
package/dist/add.js CHANGED
@@ -9,7 +9,7 @@ export const add = async (files, cwd) => {
9
9
  if (!files.length) {
10
10
  process.exitCode = 1;
11
11
  throw formatDetailedError({
12
- title: "Failed to run the `git` command",
12
+ title: "Failed to run the `git add` command",
13
13
  message: "No files to add.",
14
14
  details: {
15
15
  output: "files.length: 0"
package/dist/add.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"add.js","sourceRoot":"","sources":["../src/add.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,KAAK,EAAE,KAAe,EAAE,GAAW,EAA0B,EAAE;IAChF,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;QAClB,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACrB,MAAM,mBAAmB,CAAC;YACxB,KAAK,EAAE,iCAAiC;YACxC,OAAO,EAAE,kBAAkB;YAC3B,OAAO,EAAE;gBACP,MAAM,EAAE,iBAAiB;aAC1B;SACF,CAAC,CAAC;IACL,CAAC;IACD,OAAO,MAAM,UAAU,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;AAC7D,CAAC,CAAC"}
1
+ {"version":3,"file":"add.js","sourceRoot":"","sources":["../src/add.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,KAAK,EAAE,KAAe,EAAE,GAAW,EAA0B,EAAE;IAChF,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;QAClB,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACrB,MAAM,mBAAmB,CAAC;YACxB,KAAK,EAAE,qCAAqC;YAC5C,OAAO,EAAE,kBAAkB;YAC3B,OAAO,EAAE;gBACP,MAAM,EAAE,iBAAiB;aAC1B;SACF,CAAC,CAAC;IACL,CAAC;IACD,OAAO,MAAM,UAAU,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;AAC7D,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"cancel-commits-since-ref.d.ts","sourceRoot":"","sources":["../src/cancel-commits-since-ref.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GAAI,WAAW,MAAM,EAAE,KAAK,MAAM,EAAE,eAAa,KAAG,IA6BrF,CAAC"}
1
+ {"version":3,"file":"cancel-commits-since-ref.d.ts","sourceRoot":"","sources":["../src/cancel-commits-since-ref.ts"],"names":[],"mappings":"AAOA;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GAAI,WAAW,MAAM,EAAE,KAAK,MAAM,EAAE,eAAa,KAAG,IA8BrF,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { setLogger } from "@release-change/logger";
2
- import { formatDetailedError, runCommandSync } from "@release-change/shared";
2
+ import { formatDetailedError, formatOutputFromCommandResult, runCommandSync } from "@release-change/shared";
3
3
  /**
4
4
  * Cancels the commits since the commit reference.
5
5
  * @param commitRef - The reference of the commit after which all the commits are to be cancelled.
@@ -11,7 +11,8 @@ export const cancelCommitsSinceRef = (commitRef, cwd, debug = false) => {
11
11
  logger.setScope("git");
12
12
  if (commitRef) {
13
13
  const args = ["reset", "--hard", commitRef];
14
- const { status, stdout, stderr } = runCommandSync("git", args, { cwd });
14
+ const commandResult = runCommandSync("git", args, { cwd });
15
+ const { status } = commandResult;
15
16
  if (debug) {
16
17
  logger.setDebugScope("git:cancel-commits-since-ref");
17
18
  logger.logDebug(`Command run: git ${args.join(" ")}`);
@@ -19,10 +20,10 @@ export const cancelCommitsSinceRef = (commitRef, cwd, debug = false) => {
19
20
  if (status) {
20
21
  logger.logError(`Failed to cancel the commits since ${commitRef}.`);
21
22
  throw formatDetailedError({
22
- title: "Failed to run the `git` command",
23
+ title: "Failed to run the `git reset` command",
23
24
  message: `The command failed with status ${status}.`,
24
25
  details: {
25
- output: stderr || stdout || `Command failed with status ${status}.`,
26
+ output: formatOutputFromCommandResult(commandResult),
26
27
  command: `git ${args.join(" ")}`
27
28
  }
28
29
  });
@@ -1 +1 @@
1
- {"version":3,"file":"cancel-commits-since-ref.js","sourceRoot":"","sources":["../src/cancel-commits-since-ref.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,wBAAw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C;aACF,CAAC,CAAC;QACL,CAAC;QACD,MAAM,CAAC,OAAO,CAAC,iBAAiB,SAAS,aAAa,CAAC,CAAC;IAC1D,CAAC;SAAM,CAAC;QACN,MAAM,mBAAmB,CAAC;YACxB,KAAK,EAAE,0BAA0B;YACjC,OAAO,EAAE,yCAAyC;YAClD,OAAO,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE;SACnC,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"check-authorisation.d.ts","sourceRoot":"","sources":["../src/check-authorisation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAKtD;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAC7B,eAAe,MAAM,EACrB,SAAS,OAAO,KACf,OAAO,CAAC,IAAI,CA0Bd,CAAC"}
1
+ {"version":3,"file":"check-authorisation.d.ts","sourceRoot":"","sources":["../src/check-authorisation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAUtD;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAC7B,eAAe,MAAM,EACrB,SAAS,OAAO,KACf,OAAO,CAAC,IAAI,CA0Bd,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { setLogger } from "@release-change/logger";
2
- import { deepInspectObject, formatDetailedError, runCommand } from "@release-change/shared";
2
+ import { deepInspectObject, formatDetailedError, formatOutputFromCommandResult, runCommand } from "@release-change/shared";
3
3
  /**
4
4
  * Checks the authorisation to push commits to the remote repository.
5
5
  * @param repositoryUrl - The repository URL.
@@ -14,19 +14,19 @@ export const checkAuthorisation = async (repositoryUrl, context) => {
14
14
  return;
15
15
  }
16
16
  const args = ["push", "--dry-run", "--no-verify", repositoryUrl, branch];
17
- const gitCommandResult = await runCommand("git", args, { cwd });
17
+ const commandResult = await runCommand("git", args, { cwd });
18
18
  if (config.debug) {
19
19
  logger.setDebugScope("git:check-authorisation");
20
- logger.logDebug(deepInspectObject(gitCommandResult));
20
+ logger.logDebug(deepInspectObject(commandResult));
21
21
  }
22
- const { status, stdout, stderr } = gitCommandResult;
22
+ const { status } = commandResult;
23
23
  if (status) {
24
24
  process.exitCode = status;
25
25
  throw formatDetailedError({
26
- title: "Failed to run the `git` command",
26
+ title: "Failed to run the `git push` command",
27
27
  message: `The command failed with status ${status}.`,
28
28
  details: {
29
- output: stderr || stdout || `Command failed with status ${status}.`,
29
+ output: formatOutputFromCommandResult(commandResult),
30
30
  command: `git ${args.join(" ")}`
31
31
  }
32
32
  });
@@ -1 +1 @@
1
- {"version":3,"file":"check-authorisation.js","sourceRoot":"","sources":["../src/check-authorisation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAE5F;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,EACrC,aAAqB,EACrB,OAAgB,EACD,EAAE;IACjB,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IACxC,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACvB,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACjD,MAAM,CAAC,OAAO,CAAC,kCAAkC,CAAC,CAAC;QACnD,OAAO;IACT,CAAC;IACD,MAAM,IAAI,GAAG,CAAC,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC;IACzE,MAAM,gBAAgB,GAAG,MAAM,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,GA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CAAC;QACjD,MAAM,CAAC,OAAO,CAAC,kCAAkC,CAAC,CAAC;QACnD,OAAO;IACT,CAAC;IACD,MAAM,IAAI,GAAG,CAAC,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC;IACzE,MAAM,aAAa,GAAG,MAAM,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;IAC7D,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QACjB,MAAM,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;QAChD,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAAC,CAAC;IACpD,CAAC;IACD,MAAM,EAAE,MAAM,EAAE,GAAG,aAAa,CAAC;IACjC,IAAI,MAAM,EAAE,CAAC;QACX,OAAO,CAAC,QAAQ,GAAG,MAAM,CAAC;QAC1B,MAAM,mBAAmB,CAAC;YACxB,KAAK,EAAE,sCAAsC;YAC7C,OAAO,EAAE,kCAAkC,MAAM,GAAG;YACpD,OAAO,EAAE;gBACP,MAAM,EAAE,6BAA6B,CAAC,aAAa,CAAC;gBACpD,OAAO,EAAE,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;aACjC;SACF,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC"}
package/dist/commit.js CHANGED
@@ -9,7 +9,7 @@ export const commit = async (message, cwd) => {
9
9
  if (!message) {
10
10
  process.exitCode = 1;
11
11
  throw formatDetailedError({
12
- title: "Failed to run the `git` command",
12
+ title: "Failed to run the `git commit` command",
13
13
  message: "The commit message cannot be empty.",
14
14
  details: {
15
15
  output: "message: "
@@ -1 +1 @@
1
- {"version":3,"file":"commit.js","sourceRoot":"","sources":["../src/commit.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,EAAE,OAAe,EAAE,GAAW,EAA0B,EAAE;IACnF,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACrB,MAAM,mBAAmB,CAAC;YACxB,KAAK,EAAE,iCAAiC;YACxC,OAAO,EAAE,qCAAqC;YAC9C,OAAO,EAAE;gBACP,MAAM,EAAE,WAAW;aACpB;SACF,CAAC,CAAC;IACL,CAAC;IACD,OAAO,MAAM,UAAU,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;AACrE,CAAC,CAAC"}
1
+ {"version":3,"file":"commit.js","sourceRoot":"","sources":["../src/commit.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,EAAE,OAAe,EAAE,GAAW,EAA0B,EAAE;IACnF,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACrB,MAAM,mBAAmB,CAAC;YACxB,KAAK,EAAE,wCAAwC;YAC/C,OAAO,EAAE,qCAAqC;YAC9C,OAAO,EAAE;gBACP,MAAM,EAAE,WAAW;aACpB;SACF,CAAC,CAAC;IACL,CAAC;IACD,OAAO,MAAM,UAAU,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;AACrE,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { Context } from "@release-change/shared";
2
+ /**
3
+ * Deletes a branch on a remote repository.
4
+ * @param branch - The name of the branch to delete.
5
+ * @param context - The context where the CLI is running.
6
+ */
7
+ export declare const deleteBranchOnRemoteRepository: (branch: string, context: Context) => Promise<void>;
8
+ //# sourceMappingURL=delete-branch-on-remote-repository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete-branch-on-remote-repository.d.ts","sourceRoot":"","sources":["../src/delete-branch-on-remote-repository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAStD;;;;GAIG;AACH,eAAO,MAAM,8BAA8B,GACzC,QAAQ,MAAM,EACd,SAAS,OAAO,KACf,OAAO,CAAC,IAAI,CAiCd,CAAC"}
@@ -0,0 +1,41 @@
1
+ import { setLogger } from "@release-change/logger";
2
+ import { formatDetailedError, formatOutputFromCommandResult, runCommand } from "@release-change/shared";
3
+ /**
4
+ * Deletes a branch on a remote repository.
5
+ * @param branch - The name of the branch to delete.
6
+ * @param context - The context where the CLI is running.
7
+ */
8
+ export const deleteBranchOnRemoteRepository = async (branch, context) => {
9
+ const { config: { debug, remoteName } } = context;
10
+ const logger = setLogger(debug);
11
+ logger.setScope("git");
12
+ if (branch) {
13
+ const args = ["push", "--delete", remoteName, branch];
14
+ const commandResult = await runCommand("git", args);
15
+ const { status } = commandResult;
16
+ if (debug) {
17
+ logger.setDebugScope("git:delete-remote-branch");
18
+ logger.logDebug(`Command run: git ${args.join(" ")}`);
19
+ }
20
+ if (status) {
21
+ logger.logError(`Failed to remotely delete branch ${branch} on ${remoteName}.`);
22
+ throw formatDetailedError({
23
+ title: "Failed to run the `git push` command",
24
+ message: `The command failed with status ${status}.`,
25
+ details: {
26
+ output: formatOutputFromCommandResult(commandResult),
27
+ command: `git ${args.join(" ")}`
28
+ }
29
+ });
30
+ }
31
+ logger.logInfo(`Deleted remote branch ${branch} successfully.`);
32
+ }
33
+ else {
34
+ throw formatDetailedError({
35
+ title: "Failed to delete a branch on remote repository",
36
+ message: "The branch name must not be empty.",
37
+ details: { output: "branch: " }
38
+ });
39
+ }
40
+ };
41
+ //# sourceMappingURL=delete-branch-on-remote-repository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete-bran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ACjC;aACF,CAAC,CAAC;QACL,CAAC;QACD,MAAM,CAAC,OAAO,CAAC,yBAAyB,MAAM,gBAAgB,CAAC,CAAC;IAClE,CAAC;SAAM,CAAC;QACN,MAAM,mBAAmB,CAAC;YACxB,KAAK,EAAE,gDAAgD;YACvD,OAAO,EAAE,oCAAoC;YAC7C,OAAO,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE;SAChC,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Deletes a branch.
3
+ * @param branch - The name of the branch to delete.
4
+ * @param cwd - The current working directory.
5
+ * @param [debug] - Whether the CLI is running in debug mode or not.
6
+ */
7
+ export declare const deleteBranch: (branch: string, cwd: string, debug?: boolean) => void;
8
+ //# sourceMappingURL=delete-branch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete-branch.d.ts","sourceRoot":"","sources":["../src/delete-branch.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAI,QAAQ,MAAM,EAAE,KAAK,MAAM,EAAE,eAAa,KAAG,IAoBzE,CAAC"}
@@ -0,0 +1,33 @@
1
+ import { setLogger } from "@release-change/logger";
2
+ import { formatDetailedError, runCommandSync } from "@release-change/shared";
3
+ /**
4
+ * Deletes a branch.
5
+ * @param branch - The name of the branch to delete.
6
+ * @param cwd - The current working directory.
7
+ * @param [debug] - Whether the CLI is running in debug mode or not.
8
+ */
9
+ export const deleteBranch = (branch, cwd, debug = false) => {
10
+ const logger = setLogger(debug);
11
+ logger.setScope("git");
12
+ if (branch) {
13
+ const args = ["branch", "-D", branch];
14
+ const { status } = runCommandSync("git", args, { cwd });
15
+ if (debug) {
16
+ logger.setDebugScope("git:delete-branch");
17
+ logger.logDebug(`Command run: git ${args.join(" ")}`);
18
+ }
19
+ if (status)
20
+ logger.logError(`Failed to delete branch ${branch}.`);
21
+ else
22
+ logger.logInfo(`Deleted branch ${branch}.`);
23
+ }
24
+ else {
25
+ process.exitCode = 1;
26
+ throw formatDetailedError({
27
+ title: "Failed to delete a branch",
28
+ message: "The branch name must not be empty.",
29
+ details: { output: "branch: " }
30
+ });
31
+ }
32
+ };
33
+ //# sourceMappingURL=delete-branch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete-branch.js","sourceRoot":"","sources":["../src/delete-branch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAAc,EAAE,GAAW,EAAE,KAAK,GAAG,KAAK,EAAQ,EAAE;IAC/E,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;IAChC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACvB,IAAI,MAAM,EAAE,CAAC;QACX,MAAM,IAAI,GAAG,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QACtC,MAAM,EAAE,MAAM,EAAE,GAAG,cAAc,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;QACxD,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAC;YAC1C,MAAM,CAAC,QAAQ,CAAC,oBAAoB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACxD,CAAC;QACD,IAAI,MAAM;YAAE,MAAM,CAAC,QAAQ,CAAC,2BAA2B,MAAM,GAAG,CAAC,CAAC;;YAC7D,MAAM,CAAC,OAAO,CAAC,kBAAkB,MAAM,GAAG,CAAC,CAAC;IACnD,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACrB,MAAM,mBAAmB,CAAC;YACxB,KAAK,EAAE,2BAA2B;YAClC,OAAO,EAAE,oCAAoC;YAC7C,OAAO,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE;SAChC,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -5,6 +5,8 @@ export { checkPushPermissions } from "./check-push-permissions.js";
5
5
  export { checkRepository } from "./check-repository.js";
6
6
  export { commit } from "./commit.js";
7
7
  export { createTag } from "./create-tag.js";
8
+ export { deleteBranch } from "./delete-branch.js";
9
+ export { deleteBranchOnRemoteRepository } from "./delete-branch-on-remote-repository.js";
8
10
  export { getAllTags } from "./get-all-tags.js";
9
11
  export { getBranchName } from "./get-branch-name.js";
10
12
  export { getCommitsSinceRef } from "./get-commits-since-ref.js";
@@ -16,6 +18,7 @@ export { push } from "./push.js";
16
18
  export { removeTag } from "./remove-tag.js";
17
19
  export { removeTagOnRemoteRepository } from "./remove-tag-on-remote-repository.js";
18
20
  export { setBranchName } from "./set-branch-name.js";
21
+ export { switchToBranch } from "./switch-to-branch.js";
19
22
  export { switchToNewBranch } from "./switch-to-new-branch.js";
20
23
  export { COMMITTER_EMAIL, COMMITTER_NAME, GIT_TAG_PATTERN } from "./constants.js";
21
24
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,UAAU,E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AM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AACnF,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC"}
package/dist/index.js CHANGED
@@ -5,6 +5,8 @@ export { checkPushPermissions } from "./check-push-permissions.js";
5
5
  export { checkRepository } from "./check-repository.js";
6
6
  export { commit } from "./commit.js";
7
7
  export { createTag } from "./create-tag.js";
8
+ export { deleteBranch } from "./delete-branch.js";
9
+ export { deleteBranchOnRemoteRepository } from "./delete-branch-on-remote-repository.js";
8
10
  export { getAllTags } from "./get-all-tags.js";
9
11
  export { getBranchName } from "./get-branch-name.js";
10
12
  export { getCommitsSinceRef } from "./get-commits-since-ref.js";
@@ -16,6 +18,7 @@ export { push } from "./push.js";
16
18
  export { removeTag } from "./remove-tag.js";
17
19
  export { removeTagOnRemoteRepository } from "./remove-tag-on-remote-repository.js";
18
20
  export { setBranchName } from "./set-branch-name.js";
21
+ export { switchToBranch } from "./switch-to-branch.js";
19
22
  export { switchToNewBranch } from "./switch-to-new-branch.js";
20
23
  export { COMMITTER_EMAIL, COMMITTER_NAME, GIT_TAG_PATTERN } from "./constants.js";
21
24
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AACnF,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D,OAAO,EAAE,eAAe,EAAE,cAAc,EA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AAE9D,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"push.d.ts","sourceRoot":"","sources":["../src/push.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAKlD;;;;GAIG;AACH,eAAO,MAAM,IAAI,GAAU,SAAS,OAAO,EAAE,aAAa,WAAW,KAAG,OAAO,CAAC,IAAI,CAqCnF,CAAC"}
1
+ {"version":3,"file":"push.d.ts","sourceRoot":"","sources":["../src/push.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAUlD;;;;GAIG;AACH,eAAO,MAAM,IAAI,GAAU,SAAS,OAAO,EAAE,aAAa,WAAW,KAAG,OAAO,CAAC,IAAI,CAqCnF,CAAC"}
package/dist/push.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { setLogger } from "@release-change/logger";
2
- import { deepInspectObject, formatDetailedError, runCommand } from "@release-change/shared";
2
+ import { deepInspectObject, formatDetailedError, formatOutputFromCommandResult, runCommand } from "@release-change/shared";
3
3
  /**
4
4
  * Pushes the current branch to the remote repository.
5
5
  * @param context - The context where the CLI is running.
@@ -14,7 +14,7 @@ export const push = async (context, pushOptions) => {
14
14
  if (!destinationBranch) {
15
15
  process.exitCode = 1;
16
16
  throw formatDetailedError({
17
- title: "Failed to run the `git` command",
17
+ title: "Failed to run the `git push` command",
18
18
  message: "A branch name must be provided.",
19
19
  details: {
20
20
  output: "destinationBranch: "
@@ -22,15 +22,15 @@ export const push = async (context, pushOptions) => {
22
22
  });
23
23
  }
24
24
  const args = ["push", includeTags && "--follow-tags", remoteName, destinationBranch].filter(arg => typeof arg === "string");
25
- const gitCommandResult = await runCommand("git", args);
26
- const { status, stdout, stderr } = gitCommandResult;
25
+ const commandResult = await runCommand("git", args);
26
+ const { status } = commandResult;
27
27
  if (status) {
28
28
  process.exitCode = status;
29
29
  throw formatDetailedError({
30
- title: "Failed to run the `git` command",
30
+ title: "Failed to run the `git push` command",
31
31
  message: `The command failed with status ${status}.`,
32
32
  details: {
33
- output: stderr || stdout || `Command failed with status ${status}.`,
33
+ output: formatOutputFromCommandResult(commandResult),
34
34
  command: `git ${args.join(" ")}`
35
35
  }
36
36
  });
@@ -38,7 +38,7 @@ export const push = async (context, pushOptions) => {
38
38
  if (debug) {
39
39
  logger.setDebugScope("git:push");
40
40
  logger.logDebug(`Command run: git ${args.join(" ")}`);
41
- logger.logDebug(deepInspectObject(gitCommandResult));
41
+ logger.logDebug(deepInspectObject(commandResult));
42
42
  }
43
43
  };
44
44
  //# sourceMappingURL=push.js.map
package/dist/push.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"push.js","sourceRoot":"","sources":["../src/push.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAE5F;;;;GAIG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,KAAK,EAAE,OAAgB,EAAE,WAAwB,EAAiB,EAAE;IACtF,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAC3B,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;IACrC,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;IAChC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACvB,MAAM,EAAE,iBAAiB,EAAE,WAAW,EAAE,GAAG,WAAW,CAAC;IACvD,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACvB,OAAO,CAAC,QAAQ,GAAG,C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EAAE,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;aACjC;SACF,CAAC,CAAC;IACL,CAAC;IACD,IAAI,KAAK,EAAE,CAAC;QACV,MAAM,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QACjC,MAAM,CAAC,QAAQ,CAAC,oBAAoB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACtD,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAAC,CAAC;IACpD,CAAC;AACH,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"remove-tag-on-remote-repository.d.ts","sourceRoot":"","sources":["../src/remove-tag-on-remote-repository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAKtD;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,GACtC,QAAQ,MAAM,EACd,SAAS,OAAO,KACf,OAAO,CAAC,IAAI,CAgCd,CAAC"}
1
+ {"version":3,"file":"remove-tag-on-remote-repository.d.ts","sourceRoot":"","sources":["../src/remove-tag-on-remote-repository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAStD;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,GACtC,QAAQ,MAAM,EACd,SAAS,OAAO,KACf,OAAO,CAAC,IAAI,CAiCd,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { setLogger } from "@release-change/logger";
2
- import { formatDetailedError, runCommand } from "@release-change/shared";
2
+ import { formatDetailedError, formatOutputFromCommandResult, runCommand } from "@release-change/shared";
3
3
  /**
4
4
  * Removes a Git tag on a remote repository.
5
5
  * @param gitTag - The Git tag to remove.
@@ -11,7 +11,8 @@ export const removeTagOnRemoteRepository = async (gitTag, context) => {
11
11
  logger.setScope("git");
12
12
  if (gitTag) {
13
13
  const args = ["push", "--delete", remoteName, gitTag];
14
- const { status, stdout, stderr } = await runCommand("git", args);
14
+ const commandResult = await runCommand("git", args);
15
+ const { status } = commandResult;
15
16
  if (debug) {
16
17
  logger.setDebugScope("git:remove-tag-on-remote-repository");
17
18
  logger.logDebug(`Command run: git ${args.join(" ")}`);
@@ -19,10 +20,10 @@ export const removeTagOnRemoteRepository = async (gitTag, context) => {
19
20
  if (status) {
20
21
  logger.logError(`Failed to remotely remove Git tag ${gitTag} on ${remoteName}.`);
21
22
  throw formatDetailedError({
22
- title: "Failed to run the `git` command",
23
+ title: "Failed to run the `git push` command",
23
24
  message: `The command failed with status ${status}.`,
24
25
  details: {
25
- output: stderr || stdout || `Command failed with status ${status}.`,
26
+ output: formatOutputFromCommandResult(commandResult),
26
27
  command: `git ${args.join(" ")}`
27
28
  }
28
29
  });
@@ -1 +1 @@
1
- {"version":3,"file":"remove-tag-on-remote-repository.js","sourceRoot":"","sources":["../src/remove-tag-on-remote-repository.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzE;;;;GAIG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,KAAK,EAC9C,MAAc,EACd,OAAgB,EACD,EAAE;IACjB,MAAM,EACJ,MAAM,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,EAC9B,GAAG,OAAO,CAAC;IACZ,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;IAChC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACvB,IAAI,MAAM,EAAE,CAAC;QACX,MAAM,IAAI,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;QACtD,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QACjE,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,CAAC,aAAa,CAAC,qCAAqC,CAAC,CAAC;YAC5D,MAAM,CAAC,QAAQ,CAAC,oBAAoB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACxD,CAAC;QACD,IAAI,MAAM,EAAE,CAAC;YACX,MAAM,CAAC,QAAQ,CAAC,qCAAqC,MAAM,OAAO,UAAU,GAAG,CAAC,CAAC;YACjF,MAAM,mBAAmB,CAAC;gBACxB,KAAK,EAAE,iCAAiC;gBACxC,OAAO,EAAE,kCAAkC,MAAM,GAAG;gBACpD,OAAO,EAAE;oBACP,MAAM,EAAE,MAAM,IAAI,MAAM,IAAI,8BAA8B,MAAM,GAAG;oBACnE,OAAO,EAAE,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;iBACjC;aACF,CAAC,CAAC;QACL,CAAC;QACD,MAAM,CAAC,OAAO,CAAC,0BAA0B,MAAM,gBAAgB,CAAC,CAAC;IACnE,CAAC;SAAM,CAAC;QACN,MAAM,mBAAmB,CAAC;YACxB,KAAK,EAAE,iDAAiD;YACxD,OAAO,EAAE,gCAAgC;YACzC,OAAO,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE;SAChC,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC"}
1
+ {"version":3,"file":"remove-tag-on-remote-repository.js","sourceRoot":"","sources":["../src/remove-tag-on-remote-repository.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EACL,mBAAmB,EACnB,6BAA6B,EAC7B,UAAU,EACX,MAAM,wBAAwB,CAAC;AAEhC;;;;GAIG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,KAAK,EAC9C,MAAc,EACd,OAAgB,EACD,EAAE;IACjB,MAAM,EACJ,MAAM,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,EAC9B,GAAG,OAAO,CAAC;IACZ,MAAM,MAAM,GAA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;AACH,eAAO,MAAM,SAAS,GAAI,QAAQ,MAAM,EAAE,KAAK,MAAM,EAAE,eAAa,KAAG,IA6BtE,CAAC"}
1
+ {"version":3,"file":"remove-tag.d.ts","sourceRoot":"","sources":["../src/remove-tag.ts"],"names":[],"mappings":"AAOA;;;;;GAKG;AACH,eAAO,MAAM,SAAS,GAAI,QAAQ,MAAM,EAAE,KAAK,MAAM,EAAE,eAAa,KAAG,IA8BtE,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { setLogger } from "@release-change/logger";
2
- import { formatDetailedError, runCommandSync } from "@release-change/shared";
2
+ import { formatDetailedError, formatOutputFromCommandResult, runCommandSync } from "@release-change/shared";
3
3
  /**
4
4
  * Removes a Git tag.
5
5
  * @param gitTag - The Git tag to remove.
@@ -11,7 +11,8 @@ export const removeTag = (gitTag, cwd, debug = false) => {
11
11
  logger.setScope("git");
12
12
  if (gitTag) {
13
13
  const args = ["tag", "-d", gitTag];
14
- const { status, stdout, stderr } = runCommandSync("git", args, { cwd });
14
+ const commandResult = runCommandSync("git", args, { cwd });
15
+ const { status } = commandResult;
15
16
  if (debug) {
16
17
  logger.setDebugScope("git:remove-tag");
17
18
  logger.logDebug(`Command run: git ${args.join(" ")}`);
@@ -19,10 +20,10 @@ export const removeTag = (gitTag, cwd, debug = false) => {
19
20
  if (status) {
20
21
  logger.logError(`Failed to remove Git tag ${gitTag}.`);
21
22
  throw formatDetailedError({
22
- title: "Failed to run the `git` command",
23
+ title: "Failed to run the `git tag` command",
23
24
  message: `The command failed with status ${status}.`,
24
25
  details: {
25
- output: stderr || stdout || `Command failed with status ${status}.`,
26
+ output: formatOutputFromCommandResult(commandResult),
26
27
  command: `git ${args.join(" ")}`
27
28
  }
28
29
  });
@@ -1 +1 @@
1
- {"version":3,"file":"remove-tag.js","sourceRoot":"","sources":["../src/remove-tag.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,mBAAm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;iBACjC;aACF,CAAC,CAAC;QACL,CAAC;QACD,MAAM,CAAC,OAAO,CAAC,mBAAmB,MAAM,GAAG,CAAC,CAAC;IAC/C,CAAC;SAAM,CAAC;QACN,MAAM,mBAAmB,CAAC;YACxB,KAAK,EAAE,4BAA4B;YACnC,OAAO,EAAE,gCAAgC;YACzC,OAAO,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE;SAChC,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Switches to another branch.
3
+ * @param branch - The name of the branch.
4
+ * @param cwd - The current working directory.
5
+ */
6
+ export declare const switchToBranch: (branch: string, cwd: string) => void;
7
+ //# sourceMappingURL=switch-to-branch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"switch-to-branch.d.ts","sourceRoot":"","sources":["../src/switch-to-branch.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,QAAQ,MAAM,EAAE,KAAK,MAAM,KAAG,IAW5D,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { formatDetailedError, runCommandSync } from "@release-change/shared";
2
+ /**
3
+ * Switches to another branch.
4
+ * @param branch - The name of the branch.
5
+ * @param cwd - The current working directory.
6
+ */
7
+ export const switchToBranch = (branch, cwd) => {
8
+ if (branch)
9
+ runCommandSync("git", ["switch", branch], { cwd });
10
+ else {
11
+ throw formatDetailedError({
12
+ title: "Failed to switch to another branch",
13
+ message: "The branch name cannot be empty.",
14
+ details: {
15
+ output: `branch: ${branch}`
16
+ }
17
+ });
18
+ }
19
+ };
20
+ //# sourceMappingURL=switch-to-branch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"switch-to-branch.js","sourceRoot":"","sources":["../src/switch-to-branch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7E;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAc,EAAE,GAAW,EAAQ,EAAE;IAClE,IAAI,MAAM;QAAE,cAAc,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;SAC1D,CAAC;QACJ,MAAM,mBAAmB,CAAC;YACxB,KAAK,EAAE,oCAAoC;YAC3C,OAAO,EAAE,kCAAkC;YAC3C,OAAO,EAAE;gBACP,MAAM,EAAE,WAAW,MAAM,EAAE;aAC5B;SACF,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC"}
@@ -2,7 +2,6 @@
2
2
  * Switches to a new branch.
3
3
  * @param newBranch - The name of the new branch.
4
4
  * @param cwd - The current working directory.
5
- * @returns The result of the `git switch` command.
6
5
  */
7
6
  export declare const switchToNewBranch: (newBranch: string, cwd: string) => void;
8
7
  //# sourceMappingURL=switch-to-new-branch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"switch-to-new-branch.d.ts","sourceRoot":"","sources":["../src/switch-to-new-branch.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAAI,WAAW,MAAM,EAAE,KAAK,MAAM,KAAG,IAWlE,CAAC"}
1
+ {"version":3,"file":"switch-to-new-branch.d.ts","sourceRoot":"","sources":["../src/switch-to-new-branch.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAAI,WAAW,MAAM,EAAE,KAAK,MAAM,KAAG,IAWlE,CAAC"}
@@ -3,7 +3,6 @@ import { formatDetailedError, runCommandSync } from "@release-change/shared";
3
3
  * Switches to a new branch.
4
4
  * @param newBranch - The name of the new branch.
5
5
  * @param cwd - The current working directory.
6
- * @returns The result of the `git switch` command.
7
6
  */
8
7
  export const switchToNewBranch = (newBranch, cwd) => {
9
8
  if (newBranch)
@@ -1 +1 @@
1
- {"version":3,"file":"switch-to-new-branch.js","sourceRoot":"","sources":["../src/switch-to-new-branch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,SAAiB,EAAE,GAAW,EAAQ,EAAE;IACxE,IAAI,SAAS;QAAE,cAAc,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;SACtE,CAAC;QACJ,MAAM,mBAAmB,CAAC;YACxB,KAAK,EAAE,kCAAkC;YACzC,OAAO,EAAE,sCAAsC;YAC/C,OAAO,EAAE;gBACP,MAAM,EAAE,cAAc,SAAS,EAAE;aAClC;SACF,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC"}
1
+ {"version":3,"file":"switch-to-new-branch.js","sourceRoot":"","sources":["../src/switch-to-new-branch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7E;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,SAAiB,EAAE,GAAW,EAAQ,EAAE;IACxE,IAAI,SAAS;QAAE,cAAc,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;SACtE,CAAC;QACJ,MAAM,mBAAmB,CAAC;YACxB,KAAK,EAAE,kCAAkC;YACzC,OAAO,EAAE,sCAAsC;YAC/C,OAAO,EAAE;gBACP,MAAM,EAAE,cAAc,SAAS,EAAE;aAClC;SACF,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@release-change/git",
3
- "version": "0.1.4",
3
+ "version": "0.2.1",
4
4
  "description": "Functions used internally in release-change to make Git operations easier",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/release-change/release-change",
@@ -24,13 +24,13 @@
24
24
  "engines": {
25
25
  "node": "^20.18.3 || ^22.12.0 || ^24.0.0",
26
26
  "npm": ">=10.8.2",
27
- "pnpm": ">=10.28.0"
27
+ "pnpm": ">=10.32.1"
28
28
  },
29
29
  "dependencies": {
30
- "@release-change/commit-analyser": "0.1.3",
30
+ "@release-change/commit-analyser": "0.1.4",
31
31
  "@release-change/semver": "0.1.0",
32
- "@release-change/shared": "0.1.2",
33
- "@release-change/logger": "0.1.2"
32
+ "@release-change/shared": "0.1.3",
33
+ "@release-change/logger": "0.1.3"
34
34
  },
35
35
  "scripts": {
36
36
  "build": "tsc",