@zjex/git-workflow 0.2.11 → 0.2.14

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.
package/dist/index.js CHANGED
@@ -2095,7 +2095,7 @@ process.on("SIGTERM", () => {
2095
2095
  console.log("");
2096
2096
  process.exit(0);
2097
2097
  });
2098
- var version = true ? "0.2.11" : "0.0.0-dev";
2098
+ var version = true ? "0.2.14" : "0.0.0-dev";
2099
2099
  async function mainMenu() {
2100
2100
  console.log(
2101
2101
  colors.green(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zjex/git-workflow",
3
- "version": "0.2.11",
3
+ "version": "0.2.14",
4
4
  "description": "🚀 极简的 Git 工作流 CLI 工具,让分支管理和版本发布变得轻松愉快",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node --no-warnings
2
2
 
3
3
  import { execSync } from "child_process";
4
4
  import { readFileSync } from "fs";
@@ -132,13 +132,22 @@ async function main() {
132
132
  }
133
133
 
134
134
  // 清除上面的输出,重新显示步骤5
135
- process.stdout.write("\x1b[2A"); // 向上移动2行
136
- process.stdout.write("\x1b[0J"); // 清除从光标到屏幕底部
135
+ // 需要清除:
136
+ // - "[5/11] 选择新版本号..." (1行)
137
+ // - 空行 (1行)
138
+ // - npm run version 的所有输出 (约11行)
139
+ // 总共 13 行
140
+ const linesToClear = 13;
141
+
142
+ for (let i = 0; i < linesToClear; i++) {
143
+ process.stdout.write("\x1b[1A"); // 向上移动一行
144
+ process.stdout.write("\x1b[2K"); // 清除整行
145
+ }
137
146
 
138
147
  console.log(
139
- `${colors.blue("[5/11]")} 选择新版本号... ${colors.green(
140
- "✅"
141
- )} ${colors.dim(`(${currentVersion} → ${newVersion})`)}`
148
+ `${colors.green("✔")} ${colors.blue("[5/11]")} 选择新版本号 ${colors.dim(
149
+ `(${currentVersion} → ${newVersion})`
150
+ )}`
142
151
  );
143
152
 
144
153
  // [6] 构建项目
@@ -219,18 +228,35 @@ async function main() {
219
228
  }
220
229
 
221
230
  // [11] 发布到 npm
231
+ const spinner11 = ora({
232
+ text: `${colors.blue("[11/11]")} 发布到 npm...`,
233
+ spinner: "dots",
234
+ }).start();
235
+
236
+ // 停止 spinner,保持交互式
237
+ spinner11.stop();
238
+
222
239
  console.log(`${colors.blue("[11/11]")} 发布到 npm...`);
223
240
  console.log("");
224
241
 
225
242
  try {
226
243
  execSync("npm publish", { stdio: "inherit" });
227
- console.log("");
228
- console.log(
229
- `${colors.blue("[11/11]")} 发布到 npm... ${colors.green("✅")}`
230
- );
244
+
245
+ // 清除 npm publish 的所有输出
246
+ // 根据实际测试,npm publish 输出约 50-60 行
247
+ // 包括:prepublishOnly、build、prepare、husky、npm notice、认证等
248
+ // 为了确保清除干净,使用 60 行
249
+ const linesToClear = 60;
250
+
251
+ for (let i = 0; i < linesToClear; i++) {
252
+ process.stdout.write("\x1b[1A");
253
+ process.stdout.write("\x1b[2K");
254
+ }
255
+
256
+ console.log(`${colors.green("✔")} ${colors.blue("[11/11]")} 发布到 npm`);
231
257
  } catch (error) {
232
258
  console.log("");
233
- console.log(`${colors.blue("[11/11]")} 发布到 npm... ${colors.red("❌")}`);
259
+ console.log(`${colors.red("✖")} ${colors.blue("[11/11]")} 发布到 npm`);
234
260
  process.exit(1);
235
261
  }
236
262