codemodctl 0.1.29 → 0.1.30

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.mjs +11 -17
  2. package/package.json +2 -2
package/dist/cli.mjs CHANGED
@@ -7,14 +7,6 @@ import { $ } from "execa";
7
7
  import { writeFile } from "node:fs/promises";
8
8
 
9
9
  //#region src/commands/git/create-pr.ts
10
- function logExecError(message, error) {
11
- console.error(message);
12
- if (error && typeof error === "object" && "stderr" in error) {
13
- const execError = error;
14
- if (execError.stderr) console.error(execError.stderr);
15
- if (execError.stdout) console.error(execError.stdout);
16
- } else console.error(error instanceof Error ? error.message : String(error));
17
- }
18
10
  const createPrCommand = defineCommand({
19
11
  meta: {
20
12
  name: "create-pr",
@@ -95,7 +87,8 @@ const createPrCommand = defineCommand({
95
87
  try {
96
88
  remoteBaseBranch = (await $`git remote show origin`).stdout.match(/HEAD branch: (.+)/)?.[1]?.trim() || "main";
97
89
  } catch (error) {
98
- logExecError("Error: Failed to get remote base branch", error);
90
+ console.error("Error: Failed to get remote base branch");
91
+ console.error(error);
99
92
  process.exit(1);
100
93
  }
101
94
  if (codemodBranchName) prData.head = codemodBranchName;
@@ -104,19 +97,22 @@ const createPrCommand = defineCommand({
104
97
  try {
105
98
  await $`git checkout -b ${codemodBranchName}`;
106
99
  } catch (error) {
107
- logExecError("Error: Failed to checkout branch", error);
100
+ console.error("Error: Failed to checkout branch");
101
+ console.error(error);
108
102
  process.exit(1);
109
103
  }
110
104
  try {
111
105
  await $`git add .`;
112
106
  } catch (error) {
113
- logExecError("Error: Failed to add changes", error);
107
+ console.error("Error: Failed to add changes");
108
+ console.error(error);
114
109
  process.exit(1);
115
110
  }
116
111
  try {
117
112
  await $`git commit --no-verify -m ${commitMessage}`;
118
113
  } catch (error) {
119
- logExecError("Error: Failed to commit changes", error);
114
+ console.error("Error: Failed to commit changes");
115
+ console.error(error);
120
116
  process.exit(1);
121
117
  }
122
118
  try {
@@ -126,11 +122,9 @@ const createPrCommand = defineCommand({
126
122
  } : {} })`git push origin ${codemodBranchName} --force`;
127
123
  console.log(`Pushed branch to origin: ${codemodBranchName}`);
128
124
  } catch (error) {
129
- if ((error && typeof error === "object" && "stderr" in error ? String(error.stderr) : "").includes("Everything up-to-date")) console.log(`Branch ${codemodBranchName} is already up-to-date on remote, continuing...`);
130
- else {
131
- logExecError("Error: Failed to push changes", error);
132
- process.exit(1);
133
- }
125
+ console.error("Error: Failed to push changes");
126
+ console.error(error);
127
+ process.exit(1);
134
128
  }
135
129
  }
136
130
  if (body) prData.body = body;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codemodctl",
3
- "version": "0.1.29",
3
+ "version": "0.1.30",
4
4
  "description": "CLI tool and utilities for workflow engine operations, file sharding, and codeowner analysis",
5
5
  "type": "module",
6
6
  "exports": {
@@ -18,7 +18,7 @@
18
18
  }
19
19
  },
20
20
  "bin": {
21
- "codemodctl": "./dist/cli.js"
21
+ "codemodctl": "./dist/cli.mjs"
22
22
  },
23
23
  "files": [
24
24
  "dist"