@spaceflow/publish 0.31.0 → 0.33.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 +40 -0
- package/README.md +2 -5
- package/dist/index.js +7 -11
- package/package.json +3 -3
- package/src/index.ts +2 -8
- package/src/publish.service.ts +5 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,45 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.32.0](https://github.com/Lydanne/spaceflow/compare/@spaceflow/publish@0.31.0...@spaceflow/publish@0.32.0) (2026-02-26)
|
|
4
|
+
|
|
5
|
+
### 代码重构
|
|
6
|
+
|
|
7
|
+
* **cli:** 从配置文件读取扩展依赖,自动同步到 .spaceflow/package.json ([0f3a0ae](https://github.com/Lydanne/spaceflow/commit/0f3a0ae3f1e580b6fed627e29caf55d8207ece14))
|
|
8
|
+
* **cli:** 将 .env 加载提前至主流程最开始,确保子进程启动前环境变量已就绪 ([8851359](https://github.com/Lydanne/spaceflow/commit/88513596b52299c2f8262548fa60ec89d1c466f4))
|
|
9
|
+
* **cli:** 将 .spaceflow/bin/ 添加到 .gitignore,移除静态生成的入口文件 ([df01d2d](https://github.com/Lydanne/spaceflow/commit/df01d2d6a8dc647d8b067e3f529b0967b2a6eabd))
|
|
10
|
+
* **cli:** 改用 dynamic import 加载扩展,确保 i18n 在扩展模块执行前初始化 ([926286d](https://github.com/Lydanne/spaceflow/commit/926286d98d867a7521e7943e15d62952df35c017))
|
|
11
|
+
* **cli:** 重构配置和 .env 文件查找逻辑,支持从 cwd 向上遍历目录树 ([62a381b](https://github.com/Lydanne/spaceflow/commit/62a381bac340033ce0ff9c39afca82d7f8f20311))
|
|
12
|
+
* **config:** 将 .env 加载逻辑迁移至 shared 包,并在 CLI 壳子阶段提前加载 ([4c6b825](https://github.com/Lydanne/spaceflow/commit/4c6b825d44a98d1fec92ed6a4e17b74a79f7206d))
|
|
13
|
+
* **core:** 移除 ConfigReaderService,统一使用 IConfigReader 接口 ([ea9ed2b](https://github.com/Lydanne/spaceflow/commit/ea9ed2b9d35886f768eac9c6d1a50ca4fc79b67d))
|
|
14
|
+
* **core:** 重构 CLI 架构,将运行时逻辑迁移至 Core 包 ([6539795](https://github.com/Lydanne/spaceflow/commit/653979503d720c8a37f1731044e3c65ac2dd6e1c))
|
|
15
|
+
* **core:** 重构 i18n 模块结构,统一导出路径至 cli-runtime/i18n ([b49ae95](https://github.com/Lydanne/spaceflow/commit/b49ae95cf99a41a91f9018e141afb5bbfb6b8884))
|
|
16
|
+
* **mcp:** 移除重复的扩展加载逻辑,新增 TTY 检测避免手动运行时阻塞 ([51fb35f](https://github.com/Lydanne/spaceflow/commit/51fb35fab28c11cf8d297d7950c31a60bc4c4e2a))
|
|
17
|
+
* 调整构建顺序,优先构建 shared 包并排除其重复构建 ([d7cd392](https://github.com/Lydanne/spaceflow/commit/d7cd392ed6578acb1e6ee85ae2097d92d81e5efb))
|
|
18
|
+
|
|
19
|
+
### 其他修改
|
|
20
|
+
|
|
21
|
+
* **cli:** released version 0.30.0 [no ci] ([7af2925](https://github.com/Lydanne/spaceflow/commit/7af292524349effcfc85a26cf3285dba7726b441))
|
|
22
|
+
* **core:** released version 0.9.0 [no ci] ([e4bd091](https://github.com/Lydanne/spaceflow/commit/e4bd091c3f3cb4ae675f4e594d0c651cea481bc5))
|
|
23
|
+
* **review-summary:** released version 0.9.0 [no ci] ([c1a2322](https://github.com/Lydanne/spaceflow/commit/c1a2322bb7535d15c63251ea515ee21ea7a4e1bf))
|
|
24
|
+
* **review:** released version 0.39.0 [no ci] ([0fbda14](https://github.com/Lydanne/spaceflow/commit/0fbda140982510f49c449eb35605b0dedd27c8cc))
|
|
25
|
+
* **scripts:** released version 0.9.0 [no ci] ([8db4c68](https://github.com/Lydanne/spaceflow/commit/8db4c681b6a00bb9717f05aa809bb4e13bbb7e53))
|
|
26
|
+
* **shared:** released version 0.1.0 [no ci] ([243e31d](https://github.com/Lydanne/spaceflow/commit/243e31de49dbde605d5a16ec9f0d589792b9cc30))
|
|
27
|
+
* **shell:** released version 0.9.0 [no ci] ([b161fe1](https://github.com/Lydanne/spaceflow/commit/b161fe17aec13f59f0dbc04a7a2d392ba6740cca))
|
|
28
|
+
|
|
29
|
+
## [0.31.0](https://github.com/Lydanne/spaceflow/compare/@spaceflow/publish@0.30.0...@spaceflow/publish@0.31.0) (2026-02-26)
|
|
30
|
+
|
|
31
|
+
### 修复BUG
|
|
32
|
+
|
|
33
|
+
* **cli:** 自动安装扩展时根据命令行参数动态设置 verbose 级别 ([d2da6f5](https://github.com/Lydanne/spaceflow/commit/d2da6f5eb30425e48bb4fd924c73bb9237a437ab))
|
|
34
|
+
|
|
35
|
+
### 其他修改
|
|
36
|
+
|
|
37
|
+
* **cli:** released version 0.29.0 [no ci] ([5fd87d3](https://github.com/Lydanne/spaceflow/commit/5fd87d31511d13d4937b1b1a247ad8a322d6fc9c))
|
|
38
|
+
* **review-summary:** released version 0.8.0 [no ci] ([0e73a97](https://github.com/Lydanne/spaceflow/commit/0e73a97b035692b0fe7f59e36585cffccf6c6854))
|
|
39
|
+
* **review:** released version 0.38.0 [no ci] ([f8c96be](https://github.com/Lydanne/spaceflow/commit/f8c96bed623f24e6c21af389aaaaecf7c057ae5f))
|
|
40
|
+
* **scripts:** released version 0.8.0 [no ci] ([efea246](https://github.com/Lydanne/spaceflow/commit/efea246fe1bbd8815c7af44e8fd40df57a0219d6))
|
|
41
|
+
* **shell:** released version 0.8.0 [no ci] ([607b93b](https://github.com/Lydanne/spaceflow/commit/607b93bd911e3da102a73dd4513a4733b40c8672))
|
|
42
|
+
|
|
3
43
|
## [0.30.0](https://github.com/Lydanne/spaceflow/compare/@spaceflow/publish@0.29.0...@spaceflow/publish@0.30.0) (2026-02-26)
|
|
4
44
|
|
|
5
45
|
### 修复BUG
|
package/README.md
CHANGED
|
@@ -16,16 +16,13 @@
|
|
|
16
16
|
|
|
17
17
|
## 安装
|
|
18
18
|
|
|
19
|
-
`@spaceflow/publish`
|
|
19
|
+
`@spaceflow/publish` 是独立的扩展包,需要先安装:
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
|
-
# 使用 pnpm
|
|
23
|
-
pnpm add -D @spaceflow/cli
|
|
24
|
-
|
|
25
22
|
pnpm spaceflow install @spaceflow/publish
|
|
26
23
|
```
|
|
27
24
|
|
|
28
|
-
|
|
25
|
+
然后在配置文件中添加 `publish` 字段:
|
|
29
26
|
|
|
30
27
|
```json
|
|
31
28
|
{
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as __rspack_external_fs from "fs";
|
|
2
2
|
import * as __rspack_external_release_it_4c635798 from "release-it";
|
|
3
|
-
import { addLocaleResources,
|
|
3
|
+
import { addLocaleResources, defineExtension, t as core_t, z } from "@spaceflow/core";
|
|
4
4
|
import { join } from "path";
|
|
5
5
|
import { execSync } from "child_process";
|
|
6
6
|
var __webpack_modules__ = ({
|
|
@@ -146,29 +146,26 @@ addLocaleResources("publish", publishLocales);
|
|
|
146
146
|
;// CONCATENATED MODULE: ./src/publish.service.ts
|
|
147
147
|
|
|
148
148
|
|
|
149
|
-
|
|
150
149
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
151
150
|
const releaseItModule = __webpack_require__(547);
|
|
152
151
|
const releaseIt = typeof releaseItModule === "function" ? releaseItModule : releaseItModule.default;
|
|
153
152
|
class PublishService {
|
|
154
153
|
gitProvider;
|
|
155
154
|
config;
|
|
156
|
-
configReader;
|
|
157
155
|
monorepoService;
|
|
158
156
|
cleanupOnExit = null;
|
|
159
157
|
uncaughtExceptionHandler = null;
|
|
160
158
|
branchUnlocked = false;
|
|
161
|
-
constructor(gitProvider, config,
|
|
159
|
+
constructor(gitProvider, config, monorepoService){
|
|
162
160
|
this.gitProvider = gitProvider;
|
|
163
161
|
this.config = config;
|
|
164
|
-
this.configReader = configReader;
|
|
165
162
|
this.monorepoService = monorepoService;
|
|
166
163
|
}
|
|
167
164
|
getContextFromEnv(options) {
|
|
168
165
|
this.gitProvider.validateConfig();
|
|
169
|
-
const ciConf =
|
|
170
|
-
const repository = ciConf
|
|
171
|
-
const branch = ciConf
|
|
166
|
+
const ciConf = this.config.get("ci");
|
|
167
|
+
const repository = ciConf?.repository;
|
|
168
|
+
const branch = ciConf?.refName;
|
|
172
169
|
if (!repository) {
|
|
173
170
|
throw new Error("缺少配置 ci.repository (环境变量 GITHUB_REPOSITORY)");
|
|
174
171
|
}
|
|
@@ -190,7 +187,7 @@ class PublishService {
|
|
|
190
187
|
};
|
|
191
188
|
}
|
|
192
189
|
async execute(context) {
|
|
193
|
-
const publishConf = this.
|
|
190
|
+
const publishConf = this.config.getPluginConfig("publish");
|
|
194
191
|
const monorepoConf = publishConf.monorepo;
|
|
195
192
|
// CI 环境下自动 fetch tags,确保 release-it 能正确计算版本
|
|
196
193
|
if (context.ci) {
|
|
@@ -972,13 +969,12 @@ const extension = defineExtension({
|
|
|
972
969
|
],
|
|
973
970
|
run: async (_args, options, ctx)=>{
|
|
974
971
|
const gitProvider = ctx.getService("gitProvider");
|
|
975
|
-
const configReader = ctx.getService("config");
|
|
976
972
|
if (!gitProvider) {
|
|
977
973
|
ctx.output.error("publish 命令需要配置 Git Provider");
|
|
978
974
|
process.exit(1);
|
|
979
975
|
}
|
|
980
976
|
const monorepoService = new MonorepoService();
|
|
981
|
-
const publishService = new PublishService(gitProvider, ctx.config,
|
|
977
|
+
const publishService = new PublishService(gitProvider, ctx.config, monorepoService);
|
|
982
978
|
const publishOptions = {
|
|
983
979
|
dryRun: !!options?.dryRun,
|
|
984
980
|
ci: !!options?.ci,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spaceflow/publish",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.33.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.
|
|
24
|
+
"@spaceflow/cli": "0.31.0"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
|
-
"@spaceflow/core": "0.
|
|
27
|
+
"@spaceflow/core": "0.10.0"
|
|
28
28
|
},
|
|
29
29
|
"spaceflow": {
|
|
30
30
|
"type": "flow",
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./locales";
|
|
2
2
|
import { defineExtension, t } from "@spaceflow/core";
|
|
3
|
-
import type { GitProviderService
|
|
3
|
+
import type { GitProviderService } from "@spaceflow/core";
|
|
4
4
|
import { publishSchema } from "./publish.config";
|
|
5
5
|
import { PublishService } from "./publish.service";
|
|
6
6
|
import { MonorepoService } from "./monorepo.service";
|
|
@@ -23,7 +23,6 @@ export const extension = defineExtension({
|
|
|
23
23
|
],
|
|
24
24
|
run: async (_args, options, ctx) => {
|
|
25
25
|
const gitProvider = ctx.getService<GitProviderService>("gitProvider");
|
|
26
|
-
const configReader = ctx.getService<ConfigReaderService>("config");
|
|
27
26
|
|
|
28
27
|
if (!gitProvider) {
|
|
29
28
|
ctx.output.error("publish 命令需要配置 Git Provider");
|
|
@@ -31,12 +30,7 @@ export const extension = defineExtension({
|
|
|
31
30
|
}
|
|
32
31
|
|
|
33
32
|
const monorepoService = new MonorepoService();
|
|
34
|
-
const publishService = new PublishService(
|
|
35
|
-
gitProvider,
|
|
36
|
-
ctx.config,
|
|
37
|
-
configReader,
|
|
38
|
-
monorepoService,
|
|
39
|
-
);
|
|
33
|
+
const publishService = new PublishService(gitProvider, ctx.config, monorepoService);
|
|
40
34
|
|
|
41
35
|
const publishOptions = {
|
|
42
36
|
dryRun: !!options?.dryRun,
|
package/src/publish.service.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
GitProviderService,
|
|
3
|
-
type ConfigReaderService,
|
|
4
3
|
type IConfigReader,
|
|
5
4
|
type BranchProtection,
|
|
6
|
-
|
|
5
|
+
type CiConfig,
|
|
7
6
|
} from "@spaceflow/core";
|
|
8
7
|
import { type PublishConfig } from "./publish.config";
|
|
9
8
|
import { MonorepoService, type PackageInfo } from "./monorepo.service";
|
|
@@ -61,16 +60,15 @@ export class PublishService {
|
|
|
61
60
|
constructor(
|
|
62
61
|
protected readonly gitProvider: GitProviderService,
|
|
63
62
|
protected readonly config: IConfigReader,
|
|
64
|
-
protected readonly configReader: ConfigReaderService,
|
|
65
63
|
protected readonly monorepoService: MonorepoService,
|
|
66
64
|
) {}
|
|
67
65
|
|
|
68
66
|
getContextFromEnv(options: PublishOptions): PublishContext {
|
|
69
67
|
this.gitProvider.validateConfig();
|
|
70
68
|
|
|
71
|
-
const ciConf =
|
|
72
|
-
const repository = ciConf
|
|
73
|
-
const branch = ciConf
|
|
69
|
+
const ciConf = this.config.get<CiConfig>("ci");
|
|
70
|
+
const repository = ciConf?.repository;
|
|
71
|
+
const branch = ciConf?.refName;
|
|
74
72
|
|
|
75
73
|
if (!repository) {
|
|
76
74
|
throw new Error("缺少配置 ci.repository (环境变量 GITHUB_REPOSITORY)");
|
|
@@ -97,7 +95,7 @@ export class PublishService {
|
|
|
97
95
|
}
|
|
98
96
|
|
|
99
97
|
async execute(context: PublishContext): Promise<PublishResult> {
|
|
100
|
-
const publishConf = this.
|
|
98
|
+
const publishConf = this.config.getPluginConfig<PublishConfig>("publish");
|
|
101
99
|
const monorepoConf = publishConf.monorepo;
|
|
102
100
|
|
|
103
101
|
// CI 环境下自动 fetch tags,确保 release-it 能正确计算版本
|