@spaceflow/publish 0.33.0 → 0.35.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,40 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.34.0](https://github.com/Lydanne/spaceflow/compare/@spaceflow/publish@0.33.0...@spaceflow/publish@0.34.0) (2026-02-27)
4
+
5
+ ### 代码重构
6
+
7
+ * **cli:** 简化 getSpaceflowDir 逻辑,直接回退到全局目录 ([6763afa](https://github.com/Lydanne/spaceflow/commit/6763afab09c1a303a8a278cb8880490f2f39e769))
8
+
9
+ ### 其他修改
10
+
11
+ * **cli:** released version 0.32.0 [no ci] ([0702e0e](https://github.com/Lydanne/spaceflow/commit/0702e0e4c5dd6c1d067297372d718225dab9aaee))
12
+ * **review-summary:** released version 0.11.0 [no ci] ([d68ceef](https://github.com/Lydanne/spaceflow/commit/d68ceef911941e80fc1e71d530bf0b412b54a64a))
13
+ * **review:** released version 0.41.0 [no ci] ([df19355](https://github.com/Lydanne/spaceflow/commit/df193555f523bfde891cd2ab96f823713199749a))
14
+ * **scripts:** released version 0.11.0 [no ci] ([4c1d726](https://github.com/Lydanne/spaceflow/commit/4c1d726587a0be3187957e069b78d6eaefa7fddc))
15
+ * **shell:** released version 0.11.0 [no ci] ([3df4552](https://github.com/Lydanne/spaceflow/commit/3df4552e24e6f73b3cb8116c348453dd46dd1db5))
16
+
17
+ ## [0.33.0](https://github.com/Lydanne/spaceflow/compare/@spaceflow/publish@0.32.0...@spaceflow/publish@0.33.0) (2026-02-26)
18
+
19
+ ### 文档更新
20
+
21
+ * **cli:** 更新 CLI README 以明确其定位和工作原理 ([88a4e8e](https://github.com/Lydanne/spaceflow/commit/88a4e8e6cc5be014cf418367c89e00f65cc6d57c))
22
+ * **core:** 更新核心包 README,反映新架构和职责 ([5d8ed7b](https://github.com/Lydanne/spaceflow/commit/5d8ed7b131af4deaf8f815e4db547e52de337758))
23
+ * **publish:** 更新 README 以反映扩展包独立安装方式 ([042ac92](https://github.com/Lydanne/spaceflow/commit/042ac920fe6e8e018cf50539a990f6231582e460))
24
+ * **review:** 更新 README.md 以反映扩展架构和配置变更 ([560f270](https://github.com/Lydanne/spaceflow/commit/560f27080f3739c2e222cdd985222cfaacafbab6))
25
+ * **shared:** 为 shared 包添加 README 文档 ([5d171d5](https://github.com/Lydanne/spaceflow/commit/5d171d5872f849a62251c646294903d11a0c46d2))
26
+ * 更新文档以反映新架构和扩展系统重构 ([828c436](https://github.com/Lydanne/spaceflow/commit/828c436bdbba7798ee3211fc77c4f2ef485c6f55))
27
+
28
+ ### 其他修改
29
+
30
+ * **cli:** released version 0.31.0 [no ci] ([9038e40](https://github.com/Lydanne/spaceflow/commit/9038e4018cfcbea7ab466ee94546324fcebceabe))
31
+ * **core:** released version 0.10.0 [no ci] ([21facb5](https://github.com/Lydanne/spaceflow/commit/21facb554c145cac4f6daac121157e5c11db4191))
32
+ * **review-summary:** released version 0.10.0 [no ci] ([69ce9f8](https://github.com/Lydanne/spaceflow/commit/69ce9f809a93eb244c5851605062fdd6e26ec73e))
33
+ * **review:** released version 0.40.0 [no ci] ([4e89094](https://github.com/Lydanne/spaceflow/commit/4e890941e688b42d5802e5dd65ed9a754871464b))
34
+ * **scripts:** released version 0.10.0 [no ci] ([ced0072](https://github.com/Lydanne/spaceflow/commit/ced00727f30171a281555664bc874d1a38a28762))
35
+ * **shared:** released version 0.2.0 [no ci] ([2a9db6f](https://github.com/Lydanne/spaceflow/commit/2a9db6fb0ef4af1bfd0bdeac23119df329c34351))
36
+ * **shell:** released version 0.10.0 [no ci] ([8ea0f8b](https://github.com/Lydanne/spaceflow/commit/8ea0f8bebe51e8cfff30cfbdcbb3deb66a4b3909))
37
+
3
38
  ## [0.32.0](https://github.com/Lydanne/spaceflow/compare/@spaceflow/publish@0.31.0...@spaceflow/publish@0.32.0) (2026-02-26)
4
39
 
5
40
  ### 代码重构
package/dist/index.js CHANGED
@@ -466,32 +466,39 @@ class PublishService {
466
466
  // rehearsal 模式下也不添加 pnpm publish
467
467
  return Object.keys(hooks).length > 0 ? hooks : undefined;
468
468
  }
469
- // 如果使用 pnpm 且需要发布
470
- if (npmConf?.packageManager === "pnpm" && npmConf?.publish && !skipWrite) {
471
- const tag = prerelease || npmConf.tag || "latest";
472
- const publishArgs = npmConf.publishArgs ?? [];
473
- const registry = npmConf.registry;
474
- // 构建 pnpm publish 命令
475
- // monorepo 模式下已切换到包目录,不需要 -C 参数
476
- let publishCmd = `pnpm publish --tag ${tag} --no-git-checks`;
477
- if (registry) {
478
- publishCmd += ` --registry ${registry}`;
479
- }
480
- if (publishArgs.length > 0) {
481
- publishCmd += ` ${publishArgs.join(" ")}`;
469
+ // after:bump 阶段:先重新构建(确保 DefinePlugin 注入新版本号),再发布
470
+ if (!skipWrite) {
471
+ const afterBumpCmds = [];
472
+ // 1. 重新构建:版本号已更新到 package.json,重新构建使产物包含新版本
473
+ afterBumpCmds.push("pnpm run build");
474
+ // 2. 如果使用 pnpm 且需要发布
475
+ if (npmConf?.packageManager === "pnpm" && npmConf?.publish) {
476
+ const tag = prerelease || npmConf.tag || "latest";
477
+ const publishArgs = npmConf.publishArgs ?? [];
478
+ const registry = npmConf.registry;
479
+ // 构建 pnpm publish 命令
480
+ // monorepo 模式下已切换到包目录,不需要 -C 参数
481
+ let publishCmd = `pnpm publish --tag ${tag} --no-git-checks`;
482
+ if (registry) {
483
+ publishCmd += ` --registry ${registry}`;
484
+ }
485
+ if (publishArgs.length > 0) {
486
+ publishCmd += ` ${publishArgs.join(" ")}`;
487
+ }
488
+ afterBumpCmds.push(publishCmd);
482
489
  }
483
490
  // 合并到 after:bump hook
484
491
  const existingAfterBump = hooks["after:bump"];
485
492
  if (existingAfterBump) {
486
- hooks["after:bump"] = Array.isArray(existingAfterBump) ? [
487
- ...existingAfterBump,
488
- publishCmd
489
- ] : [
490
- existingAfterBump,
491
- publishCmd
493
+ const existing = Array.isArray(existingAfterBump) ? existingAfterBump : [
494
+ existingAfterBump
495
+ ];
496
+ hooks["after:bump"] = [
497
+ ...existing,
498
+ ...afterBumpCmds
492
499
  ];
493
500
  } else {
494
- hooks["after:bump"] = publishCmd;
501
+ hooks["after:bump"] = afterBumpCmds.length === 1 ? afterBumpCmds[0] : afterBumpCmds;
495
502
  }
496
503
  }
497
504
  return Object.keys(hooks).length > 0 ? hooks : undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spaceflow/publish",
3
- "version": "0.33.0",
3
+ "version": "0.35.0",
4
4
  "description": "Spaceflow CI 发布插件,用于在发布流程中锁定/解锁分支",
5
5
  "license": "MIT",
6
6
  "author": "Lydanne",
@@ -21,10 +21,10 @@
21
21
  },
22
22
  "devDependencies": {
23
23
  "@types/node": "^22.15.0",
24
- "@spaceflow/cli": "0.31.0"
24
+ "@spaceflow/cli": "0.33.0"
25
25
  },
26
26
  "peerDependencies": {
27
- "@spaceflow/core": "0.10.0"
27
+ "@spaceflow/core": "0.11.0"
28
28
  },
29
29
  "spaceflow": {
30
30
  "type": "flow",
@@ -433,30 +433,38 @@ export class PublishService {
433
433
  return Object.keys(hooks).length > 0 ? hooks : undefined;
434
434
  }
435
435
 
436
- // 如果使用 pnpm 且需要发布
437
- if (npmConf?.packageManager === "pnpm" && npmConf?.publish && !skipWrite) {
438
- const tag = prerelease || npmConf.tag || "latest";
439
- const publishArgs = npmConf.publishArgs ?? [];
440
- const registry = npmConf.registry;
441
-
442
- // 构建 pnpm publish 命令
443
- // monorepo 模式下已切换到包目录,不需要 -C 参数
444
- let publishCmd = `pnpm publish --tag ${tag} --no-git-checks`;
445
- if (registry) {
446
- publishCmd += ` --registry ${registry}`;
447
- }
448
- if (publishArgs.length > 0) {
449
- publishCmd += ` ${publishArgs.join(" ")}`;
436
+ // after:bump 阶段:先重新构建(确保 DefinePlugin 注入新版本号),再发布
437
+ if (!skipWrite) {
438
+ const afterBumpCmds: string[] = [];
439
+
440
+ // 1. 重新构建:版本号已更新到 package.json,重新构建使产物包含新版本
441
+ afterBumpCmds.push("pnpm run build");
442
+
443
+ // 2. 如果使用 pnpm 且需要发布
444
+ if (npmConf?.packageManager === "pnpm" && npmConf?.publish) {
445
+ const tag = prerelease || npmConf.tag || "latest";
446
+ const publishArgs = npmConf.publishArgs ?? [];
447
+ const registry = npmConf.registry;
448
+
449
+ // 构建 pnpm publish 命令
450
+ // monorepo 模式下已切换到包目录,不需要 -C 参数
451
+ let publishCmd = `pnpm publish --tag ${tag} --no-git-checks`;
452
+ if (registry) {
453
+ publishCmd += ` --registry ${registry}`;
454
+ }
455
+ if (publishArgs.length > 0) {
456
+ publishCmd += ` ${publishArgs.join(" ")}`;
457
+ }
458
+ afterBumpCmds.push(publishCmd);
450
459
  }
451
460
 
452
461
  // 合并到 after:bump hook
453
462
  const existingAfterBump = hooks["after:bump"];
454
463
  if (existingAfterBump) {
455
- hooks["after:bump"] = Array.isArray(existingAfterBump)
456
- ? [...existingAfterBump, publishCmd]
457
- : [existingAfterBump, publishCmd];
464
+ const existing = Array.isArray(existingAfterBump) ? existingAfterBump : [existingAfterBump];
465
+ hooks["after:bump"] = [...existing, ...afterBumpCmds];
458
466
  } else {
459
- hooks["after:bump"] = publishCmd;
467
+ hooks["after:bump"] = afterBumpCmds.length === 1 ? afterBumpCmds[0] : afterBumpCmds;
460
468
  }
461
469
  }
462
470