bun-push 0.2.0 → 0.2.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.
package/README.md CHANGED
@@ -22,7 +22,7 @@
22
22
  - 📝 **Changelog 支持**:发布前记录变更日志,自动生成 CHANGELOG.md 文件
23
23
  - 🛠️ **脚本执行**:支持发布前执行构建脚本(如 build)
24
24
  - 🎨 **美观的 UI**:带有 loading 动画和成功提示
25
- - 📚 **JS API**:同时提供程序化 API 供 Node.js 脚本使用
25
+ - 📚 **JS API**:同时提供程序化 API 供 Bun 脚本使用
26
26
  - 🌍 **多语言支持**:支持中文、英文、日语、韩语,默认使用中文
27
27
 
28
28
  ## 📦 安装
@@ -30,15 +30,6 @@
30
30
  ```bash
31
31
  # 使用 bun
32
32
  bun add -g bun-push
33
-
34
- # 或使用 npm
35
- npm install -g bun-push
36
-
37
- # 或使用 yarn
38
- yarn global add bun-push
39
-
40
- # 或使用 pnpm
41
- pnpm add -g bun-push
42
33
  ```
43
34
 
44
35
  ## 🌍 多语言支持
package/dist/cli.js CHANGED
@@ -19,7 +19,7 @@ var __toESM = (mod, isNodeMode, target) => {
19
19
  var __require = import.meta.require;
20
20
 
21
21
  // src/cli.ts
22
- import ora from "ora";
22
+ import ora2 from "ora";
23
23
  import chalk3 from "chalk";
24
24
 
25
25
  // src/utils/workspace.ts
@@ -81,7 +81,11 @@ var zh_default = {
81
81
  git: {
82
82
  pushTag: "\u662F\u5426\u63A8\u9001 git tag\uFF1F",
83
83
  createTagFailed: "\u521B\u5EFA git tag \u5931\u8D25\uFF0C\u9000\u51FA\u7801: {exitCode}",
84
- pushTagFailed: "\u63A8\u9001 git tag \u5931\u8D25\uFF0C\u9000\u51FA\u7801: {exitCode}"
84
+ pushTagFailed: "\u63A8\u9001 git tag \u5931\u8D25\uFF0C\u9000\u51FA\u7801: {exitCode}\uFF0C\u9519\u8BEF: {error}",
85
+ pushTagTimeout: "\u63A8\u9001 git tag \u8D85\u65F6\uFF08{timeout} \u79D2\uFF09",
86
+ commitFailed: "\u521B\u5EFA git commit \u5931\u8D25\uFF0C\u9000\u51FA\u7801: {exitCode}\uFF0C\u9519\u8BEF: {error}",
87
+ pushCodeFailed: "\u63A8\u9001\u4EE3\u7801\u5931\u8D25\uFF0C\u9000\u51FA\u7801: {exitCode}\uFF0C\u9519\u8BEF: {error}",
88
+ pushCodeTimeout: "\u63A8\u9001\u4EE3\u7801\u8D85\u65F6\uFF08{timeout} \u79D2\uFF09"
85
89
  },
86
90
  registry: {
87
91
  input: "\u8BF7\u8F93\u5165 npm registry \u5730\u5740",
@@ -116,7 +120,27 @@ var zh_default = {
116
120
  otp: "\u4E00\u6B21\u6027\u4EE3\u7801\uFF08OTP\uFF09",
117
121
  rollingBack: "\u53D1\u5E03\u5931\u8D25\uFF0C\u6B63\u5728\u56DE\u6EDA\u4FEE\u6539...",
118
122
  rollbackComplete: "\u56DE\u6EDA\u5B8C\u6210",
119
- rollbackFailed: "\u56DE\u6EDA\u5931\u8D25\uFF0C\u8BF7\u624B\u52A8\u6062\u590D\u7248\u672C\u53F7\u548C changelog:"
123
+ rollbackFailed: "\u56DE\u6EDA\u5931\u8D25\uFF0C\u8BF7\u624B\u52A8\u6062\u590D\u7248\u672C\u53F7\u548C changelog:",
124
+ updatingVersion: "\u6B63\u5728\u66F4\u65B0\u7248\u672C\u53F7...",
125
+ versionUpdated: "\u7248\u672C\u53F7\u66F4\u65B0\u6210\u529F",
126
+ versionUpdateFailed: "\u7248\u672C\u53F7\u66F4\u65B0\u5931\u8D25",
127
+ updatingChangelog: "\u6B63\u5728\u66F4\u65B0 changelog...",
128
+ changelogUpdated: "changelog \u66F4\u65B0\u6210\u529F",
129
+ changelogUpdateFailed: "changelog \u66F4\u65B0\u5931\u8D25",
130
+ checkingNpmAuth: "\u6B63\u5728\u68C0\u67E5 npm \u767B\u5F55\u72B6\u6001...",
131
+ npmAuthChecked: "npm \u767B\u5F55\u72B6\u6001\u68C0\u67E5\u6210\u529F",
132
+ creatingCommit: "\u6B63\u5728\u521B\u5EFA git commit...",
133
+ commitCreated: "git commit \u521B\u5EFA\u6210\u529F",
134
+ commitFailed: "git commit \u521B\u5EFA\u5931\u8D25",
135
+ pushingCode: "\u6B63\u5728\u63A8\u9001\u4EE3\u7801\u5230\u8FDC\u7A0B\u4ED3\u5E93...",
136
+ codePushed: "\u4EE3\u7801\u63A8\u9001\u6210\u529F",
137
+ codePushFailed: "\u4EE3\u7801\u63A8\u9001\u5931\u8D25",
138
+ creatingTag: "\u6B63\u5728\u521B\u5EFA git tag...",
139
+ tagCreated: "git tag \u521B\u5EFA\u6210\u529F",
140
+ tagCreateFailed: "git tag \u521B\u5EFA\u5931\u8D25",
141
+ pushingTag: "\u6B63\u5728\u63A8\u9001 git tag...",
142
+ tagPushed: "git tag \u63A8\u9001\u6210\u529F",
143
+ tagPushFailed: "git tag \u63A8\u9001\u5931\u8D25"
120
144
  },
121
145
  success: {
122
146
  title: "\u53D1\u5E03\u6210\u529F\uFF01",
@@ -197,7 +221,11 @@ var en_default = {
197
221
  git: {
198
222
  pushTag: "Push git tag?",
199
223
  createTagFailed: "Failed to create git tag, exit code: {exitCode}",
200
- pushTagFailed: "Failed to push git tag, exit code: {exitCode}"
224
+ pushTagFailed: "Failed to push git tag, exit code: {exitCode}, error: {error}",
225
+ pushTagTimeout: "Push git tag timeout ({timeout} seconds)",
226
+ commitFailed: "Failed to create git commit, exit code: {exitCode}, error: {error}",
227
+ pushCodeFailed: "Failed to push code, exit code: {exitCode}, error: {error}",
228
+ pushCodeTimeout: "Push code timeout ({timeout} seconds)"
201
229
  },
202
230
  registry: {
203
231
  input: "Enter npm registry address",
@@ -232,7 +260,27 @@ var en_default = {
232
260
  otp: "One-time code (OTP)",
233
261
  rollingBack: "Publish failed, rolling back changes...",
234
262
  rollbackComplete: "Rollback completed",
235
- rollbackFailed: "Rollback failed, please manually restore version and changelog:"
263
+ rollbackFailed: "Rollback failed, please manually restore version and changelog:",
264
+ updatingVersion: "Updating version number...",
265
+ versionUpdated: "Version number updated successfully",
266
+ versionUpdateFailed: "Version number update failed",
267
+ updatingChangelog: "Updating changelog...",
268
+ changelogUpdated: "Changelog updated successfully",
269
+ changelogUpdateFailed: "Changelog update failed",
270
+ checkingNpmAuth: "Checking npm login status...",
271
+ npmAuthChecked: "Npm login status check successful",
272
+ creatingCommit: "Creating git commit...",
273
+ commitCreated: "Git commit created successfully",
274
+ commitFailed: "Git commit creation failed",
275
+ pushingCode: "Pushing code to remote repository...",
276
+ codePushed: "Code pushed successfully",
277
+ codePushFailed: "Code push failed",
278
+ creatingTag: "Creating git tag...",
279
+ tagCreated: "Git tag created successfully",
280
+ tagCreateFailed: "Git tag creation failed",
281
+ pushingTag: "Pushing git tag...",
282
+ tagPushed: "Git tag pushed successfully",
283
+ tagPushFailed: "Git tag push failed"
236
284
  },
237
285
  success: {
238
286
  title: "Published successfully!",
@@ -313,7 +361,11 @@ var ja_default = {
313
361
  git: {
314
362
  pushTag: "git tag\u3092\u30D7\u30C3\u30B7\u30E5\u3057\u307E\u3059\u304B\uFF1F",
315
363
  createTagFailed: "git tag\u306E\u4F5C\u6210\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3001\u7D42\u4E86\u30B3\u30FC\u30C9: {exitCode}",
316
- pushTagFailed: "git tag\u306E\u30D7\u30C3\u30B7\u30E5\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3001\u7D42\u4E86\u30B3\u30FC\u30C9: {exitCode}"
364
+ pushTagFailed: "git tag\u306E\u30D7\u30C3\u30B7\u30E5\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3001\u7D42\u4E86\u30B3\u30FC\u30C9: {exitCode}\uFF0C\u30A8\u30E9\u30FC: {error}",
365
+ pushTagTimeout: "git tag\u306E\u30D7\u30C3\u30B7\u30E5\u304C\u30BF\u30A4\u30E0\u30A2\u30A6\u30C8\u3057\u307E\u3057\u305F\uFF08{timeout}\u79D2\uFF09",
366
+ commitFailed: "git commit\u306E\u4F5C\u6210\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3001\u7D42\u4E86\u30B3\u30FC\u30C9: {exitCode}\uFF0C\u30A8\u30E9\u30FC: {error}",
367
+ pushCodeFailed: "\u30B3\u30FC\u30C9\u306E\u30D7\u30C3\u30B7\u30E5\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3001\u7D42\u4E86\u30B3\u30FC\u30C9: {exitCode}\uFF0C\u30A8\u30E9\u30FC: {error}",
368
+ pushCodeTimeout: "\u30B3\u30FC\u30C9\u306E\u30D7\u30C3\u30B7\u30E5\u304C\u30BF\u30A4\u30E0\u30A2\u30A6\u30C8\u3057\u307E\u3057\u305F\uFF08{timeout}\u79D2\uFF09"
317
369
  },
318
370
  registry: {
319
371
  input: "npm registry\u30A2\u30C9\u30EC\u30B9\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",
@@ -348,7 +400,27 @@ var ja_default = {
348
400
  otp: "\u30EF\u30F3\u30BF\u30A4\u30E0\u30B3\u30FC\u30C9\uFF08OTP\uFF09",
349
401
  rollingBack: "\u516C\u958B\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3001\u5909\u66F4\u3092\u30ED\u30FC\u30EB\u30D0\u30C3\u30AF\u4E2D...",
350
402
  rollbackComplete: "\u30ED\u30FC\u30EB\u30D0\u30C3\u30AF\u304C\u5B8C\u4E86\u3057\u307E\u3057\u305F",
351
- rollbackFailed: "\u30ED\u30FC\u30EB\u30D0\u30C3\u30AF\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3001\u30D0\u30FC\u30B8\u30E7\u30F3\u3068changelog\u3092\u624B\u52D5\u3067\u5FA9\u5143\u3057\u3066\u304F\u3060\u3055\u3044:"
403
+ rollbackFailed: "\u30ED\u30FC\u30EB\u30D0\u30C3\u30AF\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3001\u30D0\u30FC\u30B8\u30E7\u30F3\u3068changelog\u3092\u624B\u52D5\u3067\u5FA9\u5143\u3057\u3066\u304F\u3060\u3055\u3044:",
404
+ updatingVersion: "\u30D0\u30FC\u30B8\u30E7\u30F3\u756A\u53F7\u3092\u66F4\u65B0\u4E2D...",
405
+ versionUpdated: "\u30D0\u30FC\u30B8\u30E7\u30F3\u756A\u53F7\u306E\u66F4\u65B0\u306B\u6210\u529F\u3057\u307E\u3057\u305F",
406
+ versionUpdateFailed: "\u30D0\u30FC\u30B8\u30E7\u30F3\u756A\u53F7\u306E\u66F4\u65B0\u306B\u5931\u6557\u3057\u307E\u3057\u305F",
407
+ updatingChangelog: "changelog\u3092\u66F4\u65B0\u4E2D...",
408
+ changelogUpdated: "changelog\u306E\u66F4\u65B0\u306B\u6210\u529F\u3057\u307E\u3057\u305F",
409
+ changelogUpdateFailed: "changelog\u306E\u66F4\u65B0\u306B\u5931\u6557\u3057\u307E\u3057\u305F",
410
+ checkingNpmAuth: "npm\u30ED\u30B0\u30A4\u30F3\u72B6\u614B\u3092\u78BA\u8A8D\u4E2D...",
411
+ npmAuthChecked: "npm\u30ED\u30B0\u30A4\u30F3\u72B6\u614B\u306E\u78BA\u8A8D\u306B\u6210\u529F\u3057\u307E\u3057\u305F",
412
+ creatingCommit: "git commit\u3092\u4F5C\u6210\u4E2D...",
413
+ commitCreated: "git commit\u306E\u4F5C\u6210\u306B\u6210\u529F\u3057\u307E\u3057\u305F",
414
+ commitFailed: "git commit\u306E\u4F5C\u6210\u306B\u5931\u6557\u3057\u307E\u3057\u305F",
415
+ pushingCode: "\u30EA\u30E2\u30FC\u30C8\u30EA\u30DD\u30B8\u30C8\u30EA\u306B\u30B3\u30FC\u30C9\u3092\u30D7\u30C3\u30B7\u30E5\u4E2D...",
416
+ codePushed: "\u30B3\u30FC\u30C9\u306E\u30D7\u30C3\u30B7\u30E5\u306B\u6210\u529F\u3057\u307E\u3057\u305F",
417
+ codePushFailed: "\u30B3\u30FC\u30C9\u306E\u30D7\u30C3\u30B7\u30E5\u306B\u5931\u6557\u3057\u307E\u3057\u305F",
418
+ creatingTag: "git tag\u3092\u4F5C\u6210\u4E2D...",
419
+ tagCreated: "git tag\u306E\u4F5C\u6210\u306B\u6210\u529F\u3057\u307E\u3057\u305F",
420
+ tagCreateFailed: "git tag\u306E\u4F5C\u6210\u306B\u5931\u6557\u3057\u307E\u3057\u305F",
421
+ pushingTag: "git tag\u3092\u30D7\u30C3\u30B7\u30E5\u4E2D...",
422
+ tagPushed: "git tag\u306E\u30D7\u30C3\u30B7\u30E5\u306B\u6210\u529F\u3057\u307E\u3057\u305F",
423
+ tagPushFailed: "git tag\u306E\u30D7\u30C3\u30B7\u30E5\u306B\u5931\u6557\u3057\u307E\u3057\u305F"
352
424
  },
353
425
  success: {
354
426
  title: "\u516C\u958B\u306B\u6210\u529F\u3057\u307E\u3057\u305F\uFF01",
@@ -429,7 +501,11 @@ var ko_default = {
429
501
  git: {
430
502
  pushTag: "git tag\uB97C \uD478\uC2DC\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?",
431
503
  createTagFailed: "git tag \uC0DD\uC131 \uC2E4\uD328, \uC885\uB8CC \uCF54\uB4DC: {exitCode}",
432
- pushTagFailed: "git tag \uD478\uC2DC \uC2E4\uD328, \uC885\uB8CC \uCF54\uB4DC: {exitCode}"
504
+ pushTagFailed: "git tag \uD478\uC2DC \uC2E4\uD328, \uC885\uB8CC \uCF54\uB4DC: {exitCode}, \uC624\uB958: {error}",
505
+ pushTagTimeout: "git tag \uD478\uC2DC \uC2DC\uAC04 \uCD08\uACFC ({timeout}\uCD08)",
506
+ commitFailed: "git commit \uC0DD\uC131 \uC2E4\uD328, \uC885\uB8CC \uCF54\uB4DC: {exitCode}, \uC624\uB958: {error}",
507
+ pushCodeFailed: "\uCF54\uB4DC \uD478\uC2DC \uC2E4\uD328, \uC885\uB8CC \uCF54\uB4DC: {exitCode}, \uC624\uB958: {error}",
508
+ pushCodeTimeout: "\uCF54\uB4DC \uD478\uC2DC \uC2DC\uAC04 \uCD08\uACFC ({timeout}\uCD08)"
433
509
  },
434
510
  registry: {
435
511
  input: "npm registry \uC8FC\uC18C\uB97C \uC785\uB825\uD558\uC138\uC694",
@@ -464,7 +540,27 @@ var ko_default = {
464
540
  otp: "\uC77C\uD68C\uC6A9 \uCF54\uB4DC(OTP)",
465
541
  rollingBack: "\uAC8C\uC2DC \uC2E4\uD328, \uBCC0\uACBD \uC0AC\uD56D \uB864\uBC31 \uC911...",
466
542
  rollbackComplete: "\uB864\uBC31 \uC644\uB8CC",
467
- rollbackFailed: "\uB864\uBC31 \uC2E4\uD328, \uBC84\uC804\uACFC changelog\uB97C \uC218\uB3D9\uC73C\uB85C \uBCF5\uC6D0\uD558\uC138\uC694:"
543
+ rollbackFailed: "\uB864\uBC31 \uC2E4\uD328, \uBC84\uC804\uACFC changelog\uB97C \uC218\uB3D9\uC73C\uB85C \uBCF5\uC6D0\uD558\uC138\uC694:",
544
+ updatingVersion: "\uBC84\uC804 \uBC88\uD638 \uC5C5\uB370\uC774\uD2B8 \uC911...",
545
+ versionUpdated: "\uBC84\uC804 \uBC88\uD638 \uC5C5\uB370\uC774\uD2B8 \uC131\uACF5",
546
+ versionUpdateFailed: "\uBC84\uC804 \uBC88\uD638 \uC5C5\uB370\uC774\uD2B8 \uC2E4\uD328",
547
+ updatingChangelog: "changelog \uC5C5\uB370\uC774\uD2B8 \uC911...",
548
+ changelogUpdated: "changelog \uC5C5\uB370\uC774\uD2B8 \uC131\uACF5",
549
+ changelogUpdateFailed: "changelog \uC5C5\uB370\uC774\uD2B8 \uC2E4\uD328",
550
+ checkingNpmAuth: "npm \uB85C\uADF8\uC778 \uC0C1\uD0DC \uD655\uC778 \uC911...",
551
+ npmAuthChecked: "npm \uB85C\uADF8\uC778 \uC0C1\uD0DC \uD655\uC778 \uC131\uACF5",
552
+ creatingCommit: "git commit \uC0DD\uC131 \uC911...",
553
+ commitCreated: "git commit \uC0DD\uC131 \uC131\uACF5",
554
+ commitFailed: "git commit \uC0DD\uC131 \uC2E4\uD328",
555
+ pushingCode: "\uC6D0\uACA9 \uC800\uC7A5\uC18C\uC5D0 \uCF54\uB4DC \uD478\uC2DC \uC911...",
556
+ codePushed: "\uCF54\uB4DC \uD478\uC2DC \uC131\uACF5",
557
+ codePushFailed: "\uCF54\uB4DC \uD478\uC2DC \uC2E4\uD328",
558
+ creatingTag: "git tag \uC0DD\uC131 \uC911...",
559
+ tagCreated: "git tag \uC0DD\uC131 \uC131\uACF5",
560
+ tagCreateFailed: "git tag \uC0DD\uC131 \uC2E4\uD328",
561
+ pushingTag: "git tag \uD478\uC2DC \uC911...",
562
+ tagPushed: "git tag \uD478\uC2DC \uC131\uACF5",
563
+ tagPushFailed: "git tag \uD478\uC2DC \uC2E4\uD328"
468
564
  },
469
565
  success: {
470
566
  title: "\uAC8C\uC2DC \uC131\uACF5!",
@@ -719,10 +815,6 @@ function isValidVersion(version) {
719
815
  }
720
816
  return valid === trimmed;
721
817
  }
722
- function generateTag(packageName, version) {
723
- const nameWithoutScope = packageName.replace(/^@[^/]+\//, "");
724
- return `${nameWithoutScope}@${version}`;
725
- }
726
818
  function getReleaseTypeDescription(type) {
727
819
  const descriptions = {
728
820
  patch: t("version.patch"),
@@ -923,18 +1015,6 @@ async function selectScript(packageInfo) {
923
1015
  }
924
1016
  return answer === "skip" ? undefined : answer;
925
1017
  }
926
- async function confirmPushTag() {
927
- const { value } = await prompts({
928
- type: "confirm",
929
- name: "value",
930
- message: t("git.pushTag"),
931
- initial: true
932
- });
933
- if (value === undefined) {
934
- process.exit(0);
935
- }
936
- return value;
937
- }
938
1018
  async function confirmOtp() {
939
1019
  const { value: needOtp } = await prompts({
940
1020
  type: "confirm",
@@ -998,10 +1078,8 @@ async function confirmPublish(config) {
998
1078
  console.log(chalk.cyan(`${t("publish.packageName")}:`), config.package.name);
999
1079
  console.log(chalk.cyan(`${t("publish.currentVersion")}:`), config.package.version);
1000
1080
  console.log(chalk.cyan(`${t("publish.newVersion")}:`), config.newVersion);
1001
- console.log(chalk.cyan(`${t("publish.tag")}:`), config.tag);
1002
1081
  console.log(chalk.cyan(`${t("publish.changelog")}:`), config.changelog);
1003
1082
  console.log(chalk.cyan(`${t("publish.registry")}:`), config.registry);
1004
- console.log(chalk.cyan(`${t("publish.pushTag")}:`), config.pushTag ? t("common.yes") : t("common.no"));
1005
1083
  console.log(chalk.cyan(`${t("publish.generateChangelog")}:`), config.generateChangelog ? t("common.yes") : t("common.no"));
1006
1084
  if (config.otp) {
1007
1085
  console.log(chalk.cyan(`${t("publish.otp")}:`), chalk.gray("***"));
@@ -1025,6 +1103,7 @@ async function confirmPublish(config) {
1025
1103
  // src/publisher.ts
1026
1104
  import { writeFileSync as writeFileSync2, readFileSync as readFileSync3, existsSync as existsSync3, unlinkSync } from "fs";
1027
1105
  import { join as join3 } from "path";
1106
+ import ora from "ora";
1028
1107
 
1029
1108
  // src/utils/changelog.ts
1030
1109
  import { readFileSync as readFileSync2, writeFileSync, existsSync as existsSync2 } from "fs";
@@ -1236,33 +1315,6 @@ function restoreChangelog(packagePath, oldContent) {
1236
1315
  writeFileSync2(changelogPath, oldContent, "utf-8");
1237
1316
  }
1238
1317
  }
1239
- async function createGitTag(tag) {
1240
- const proc = Bun.spawn(["git", "tag", tag], {
1241
- stdout: "inherit",
1242
- stderr: "inherit"
1243
- });
1244
- const exitCode = await proc.exited;
1245
- if (exitCode !== 0) {
1246
- throw new Error(t("git.createTagFailed", { exitCode }));
1247
- }
1248
- }
1249
- async function deleteGitTag(tag) {
1250
- const proc = Bun.spawn(["git", "tag", "-d", tag], {
1251
- stdout: "pipe",
1252
- stderr: "pipe"
1253
- });
1254
- await proc.exited;
1255
- }
1256
- async function pushGitTag(tag) {
1257
- const proc = Bun.spawn(["git", "push", "origin", tag], {
1258
- stdout: "inherit",
1259
- stderr: "inherit"
1260
- });
1261
- const exitCode = await proc.exited;
1262
- if (exitCode !== 0) {
1263
- throw new Error(t("git.pushTagFailed", { exitCode }));
1264
- }
1265
- }
1266
1318
  async function checkNpmAuth(registry) {
1267
1319
  const proc = Bun.spawn(["bun", "pm", "whoami"], {
1268
1320
  stdout: "pipe",
@@ -1299,40 +1351,58 @@ async function publishToNpm(packagePath, registry, otp) {
1299
1351
  });
1300
1352
  const exitCode = await proc.exited;
1301
1353
  if (exitCode !== 0) {
1302
- return Promise.reject(new Error(t("publish.npmPublishFailed", { exitCode })));
1354
+ throw new Error(t("publish.npmPublishFailed", { exitCode }));
1303
1355
  }
1304
1356
  }
1305
1357
  async function publish(config) {
1306
1358
  const originalVersion = readPackageVersion(config.package.path);
1307
1359
  const originalChangelog = config.generateChangelog ? readChangelog(config.package.path) : "";
1308
- let gitTagCreated = false;
1309
1360
  try {
1310
- updatePackageVersion(config.package.path, config.newVersion);
1361
+ const updateVersionSpinner = ora(t("publish.updatingVersion")).start();
1362
+ try {
1363
+ updatePackageVersion(config.package.path, config.newVersion);
1364
+ updateVersionSpinner.succeed(t("publish.versionUpdated"));
1365
+ } catch (error) {
1366
+ updateVersionSpinner.fail(t("publish.versionUpdateFailed"));
1367
+ throw error;
1368
+ }
1311
1369
  if (config.generateChangelog) {
1312
- updateChangelog(config.package.path, config.newVersion, config.changelog);
1370
+ const changelogSpinner = ora(t("publish.updatingChangelog")).start();
1371
+ try {
1372
+ updateChangelog(config.package.path, config.newVersion, config.changelog);
1373
+ changelogSpinner.succeed(t("publish.changelogUpdated"));
1374
+ } catch (error) {
1375
+ changelogSpinner.fail(t("publish.changelogUpdateFailed"));
1376
+ throw error;
1377
+ }
1313
1378
  }
1314
- await checkNpmAuth(config.registry);
1315
- if (config.pushTag) {
1316
- await createGitTag(config.tag);
1317
- gitTagCreated = true;
1379
+ const authSpinner = ora(t("publish.checkingNpmAuth")).start();
1380
+ try {
1381
+ await checkNpmAuth(config.registry);
1382
+ authSpinner.succeed(t("publish.npmAuthChecked"));
1383
+ } catch (error) {
1384
+ authSpinner.fail(t("publish.npmAuthCheckFailed"));
1385
+ throw error;
1318
1386
  }
1319
- await publishToNpm(config.package.path, config.registry, config.otp);
1320
- if (config.pushTag) {
1321
- await pushGitTag(config.tag);
1387
+ const publishSpinner = ora(t("publish.publishing")).start();
1388
+ try {
1389
+ await publishToNpm(config.package.path, config.registry, config.otp);
1390
+ publishSpinner.succeed(t("publish.success"));
1391
+ } catch (error) {
1392
+ publishSpinner.fail(t("publish.failed"));
1393
+ throw error;
1322
1394
  }
1323
1395
  } catch (error) {
1324
- console.error(t("publish.rollingBack") || "\u53D1\u5E03\u5931\u8D25\uFF0C\u6B63\u5728\u56DE\u6EDA\u4FEE\u6539...");
1396
+ const rollbackSpinner = ora(t("publish.rollingBack")).start();
1325
1397
  try {
1326
1398
  restorePackageVersion(config.package.path, originalVersion);
1327
1399
  if (config.generateChangelog) {
1328
1400
  restoreChangelog(config.package.path, originalChangelog);
1329
1401
  }
1330
- if (gitTagCreated) {
1331
- await deleteGitTag(config.tag);
1332
- }
1333
- console.error(t("publish.rollbackComplete") || "\u56DE\u6EDA\u5B8C\u6210");
1402
+ rollbackSpinner.succeed(t("publish.rollbackComplete"));
1334
1403
  } catch (rollbackError) {
1335
- console.error(t("publish.rollbackFailed") || "\u56DE\u6EDA\u5931\u8D25\uFF0C\u8BF7\u624B\u52A8\u6062\u590D\u7248\u672C\u53F7\u548C changelog:", rollbackError);
1404
+ rollbackSpinner.fail(t("publish.rollbackFailed"));
1405
+ console.error(rollbackError);
1336
1406
  }
1337
1407
  throw error;
1338
1408
  }
@@ -1404,10 +1474,9 @@ async function main() {
1404
1474
  \u2705 ${t("package.selectedPackage")}: ${chalk3.bold(selectedPackage.name)} (${selectedPackage.version})`));
1405
1475
  const { version: newVersion } = await selectVersion(selectedPackage.version);
1406
1476
  const changelog = await inputChangelog(selectedPackage.name, selectedPackage.version, newVersion);
1407
- const tag = generateTag(selectedPackage.name, newVersion);
1408
1477
  const script = await selectScript(selectedPackage);
1409
1478
  if (script) {
1410
- const spinner = ora(`${t("script.running")}: ${chalk3.cyan(script)}`).start();
1479
+ const spinner = ora2(`${t("script.running")}: ${chalk3.cyan(script)}`).start();
1411
1480
  try {
1412
1481
  await runScript(selectedPackage, script);
1413
1482
  spinner.succeed(`${t("script.success")}: ${chalk3.cyan(script)}`);
@@ -1416,7 +1485,6 @@ async function main() {
1416
1485
  throw error;
1417
1486
  }
1418
1487
  }
1419
- const pushTag = await confirmPushTag();
1420
1488
  const registry = await confirmRegistry();
1421
1489
  const generateChangelog = await confirmGenerateChangelog();
1422
1490
  const otp = await confirmOtp();
@@ -1424,9 +1492,7 @@ async function main() {
1424
1492
  package: selectedPackage,
1425
1493
  changelog,
1426
1494
  newVersion,
1427
- tag,
1428
1495
  script,
1429
- pushTag,
1430
1496
  registry,
1431
1497
  generateChangelog,
1432
1498
  otp
@@ -1437,7 +1503,7 @@ async function main() {
1437
1503
  \u274C ${t("publish.cancelled")}`));
1438
1504
  process.exit(0);
1439
1505
  }
1440
- const publishSpinner = ora(t("publish.publishing")).start();
1506
+ const publishSpinner = ora2(t("publish.publishing")).start();
1441
1507
  try {
1442
1508
  await publish(config);
1443
1509
  publishSpinner.succeed(t("publish.success"));
@@ -1456,4 +1522,4 @@ async function main() {
1456
1522
  }
1457
1523
  main();
1458
1524
 
1459
- //# debugId=5DAA9E169C926ABE64756E2164756E21
1525
+ //# debugId=43577D492C79838A64756E2164756E21