@spaceflow/publish 0.30.0 → 0.32.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 +28 -0
- 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,33 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.31.0](https://github.com/Lydanne/spaceflow/compare/@spaceflow/publish@0.30.0...@spaceflow/publish@0.31.0) (2026-02-26)
|
|
4
|
+
|
|
5
|
+
### 修复BUG
|
|
6
|
+
|
|
7
|
+
* **cli:** 自动安装扩展时根据命令行参数动态设置 verbose 级别 ([d2da6f5](https://github.com/Lydanne/spaceflow/commit/d2da6f5eb30425e48bb4fd924c73bb9237a437ab))
|
|
8
|
+
|
|
9
|
+
### 其他修改
|
|
10
|
+
|
|
11
|
+
* **cli:** released version 0.29.0 [no ci] ([5fd87d3](https://github.com/Lydanne/spaceflow/commit/5fd87d31511d13d4937b1b1a247ad8a322d6fc9c))
|
|
12
|
+
* **review-summary:** released version 0.8.0 [no ci] ([0e73a97](https://github.com/Lydanne/spaceflow/commit/0e73a97b035692b0fe7f59e36585cffccf6c6854))
|
|
13
|
+
* **review:** released version 0.38.0 [no ci] ([f8c96be](https://github.com/Lydanne/spaceflow/commit/f8c96bed623f24e6c21af389aaaaecf7c057ae5f))
|
|
14
|
+
* **scripts:** released version 0.8.0 [no ci] ([efea246](https://github.com/Lydanne/spaceflow/commit/efea246fe1bbd8815c7af44e8fd40df57a0219d6))
|
|
15
|
+
* **shell:** released version 0.8.0 [no ci] ([607b93b](https://github.com/Lydanne/spaceflow/commit/607b93bd911e3da102a73dd4513a4733b40c8672))
|
|
16
|
+
|
|
17
|
+
## [0.30.0](https://github.com/Lydanne/spaceflow/compare/@spaceflow/publish@0.29.0...@spaceflow/publish@0.30.0) (2026-02-26)
|
|
18
|
+
|
|
19
|
+
### 修复BUG
|
|
20
|
+
|
|
21
|
+
* **cli:** 修复扩展自动安装逻辑,优化 npm 包名解析 ([0271dd4](https://github.com/Lydanne/spaceflow/commit/0271dd48e0169ae5055cfab28e0656e777de10f4))
|
|
22
|
+
|
|
23
|
+
### 其他修改
|
|
24
|
+
|
|
25
|
+
* **cli:** released version 0.28.0 [no ci] ([944de26](https://github.com/Lydanne/spaceflow/commit/944de26607e91123818bad469ee7b7487473de5f))
|
|
26
|
+
* **review-summary:** released version 0.7.0 [no ci] ([21aced5](https://github.com/Lydanne/spaceflow/commit/21aced5a10fd522122e5f2c6f4ce3a318b80dff2))
|
|
27
|
+
* **review:** released version 0.37.0 [no ci] ([b26e2bb](https://github.com/Lydanne/spaceflow/commit/b26e2bba0df5471d4fb54c70bf230d6f2c964504))
|
|
28
|
+
* **scripts:** released version 0.7.0 [no ci] ([6392c03](https://github.com/Lydanne/spaceflow/commit/6392c03e2c8dc9376ae24baaa3ef3fc62be9c762))
|
|
29
|
+
* **shell:** released version 0.7.0 [no ci] ([da9dd6b](https://github.com/Lydanne/spaceflow/commit/da9dd6b07b0cfc807a20fecaa84418c90fc97b7b))
|
|
30
|
+
|
|
3
31
|
## [0.29.0](https://github.com/Lydanne/spaceflow/compare/@spaceflow/publish@0.28.0...@spaceflow/publish@0.29.0) (2026-02-26)
|
|
4
32
|
|
|
5
33
|
### 代码重构
|
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.32.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.30.0"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
|
-
"@spaceflow/core": "0.
|
|
27
|
+
"@spaceflow/core": "0.9.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 能正确计算版本
|