@coze-arch/rush-publish-plugin 0.0.4 → 0.0.5-alpha.1ae01f
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/command-line.json +35 -3
- package/lib/action/publish/confirm.d.ts +5 -1
- package/lib/action/publish/git.d.ts +1 -5
- package/lib/action/publish/packages.d.ts +1 -1
- package/lib/action/publish/push-to-remote.d.ts +1 -0
- package/lib/action/publish/types.d.ts +3 -0
- package/lib/action/publish/version.d.ts +1 -1
- package/lib/action/release/plan.d.ts +1 -1
- package/lib/action/release/types.d.ts +3 -1
- package/lib/const/index.d.ts +12 -0
- package/lib/index.js +696 -133
- package/lib/utils/ci.d.ts +86 -0
- package/lib/utils/get-plugin-config.d.ts +8 -0
- package/lib/utils/git.d.ts +27 -0
- package/package.json +6 -10
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CI 环境检测工具
|
|
3
|
+
*/
|
|
4
|
+
export declare const ciEnvironment: {
|
|
5
|
+
/**
|
|
6
|
+
* 检查是否在 GitHub Actions 环境中
|
|
7
|
+
*/
|
|
8
|
+
isGitHubActions(): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* 检查是否在任何 CI 环境中
|
|
11
|
+
*/
|
|
12
|
+
isCI(): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* 获取 GitHub 仓库信息
|
|
15
|
+
*/
|
|
16
|
+
getRepository(): string | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* 获取当前工作流名称
|
|
19
|
+
*/
|
|
20
|
+
getWorkflow(): string | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* 获取运行 ID
|
|
23
|
+
*/
|
|
24
|
+
getRunId(): string | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* 获取当前分支名
|
|
27
|
+
*/
|
|
28
|
+
getBranch(): string | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* 检查是否是 Pull Request 事件
|
|
31
|
+
*/
|
|
32
|
+
isPullRequest(): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* 检查是否是 Push 事件
|
|
35
|
+
*/
|
|
36
|
+
isPush(): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* 获取触发用户
|
|
39
|
+
*/
|
|
40
|
+
getActor(): string | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* 获取提交 SHA
|
|
43
|
+
*/
|
|
44
|
+
getCommitSha(): string | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* 获取运行器操作系统
|
|
47
|
+
*/
|
|
48
|
+
getRunnerOS(): string | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* 获取完整的环境信息
|
|
51
|
+
*/
|
|
52
|
+
getEnvironmentInfo(): {
|
|
53
|
+
name: string;
|
|
54
|
+
isCI: boolean;
|
|
55
|
+
isGitHubActions: boolean;
|
|
56
|
+
repository?: undefined;
|
|
57
|
+
workflow?: undefined;
|
|
58
|
+
runId?: undefined;
|
|
59
|
+
branch?: undefined;
|
|
60
|
+
actor?: undefined;
|
|
61
|
+
commitSha?: undefined;
|
|
62
|
+
runnerOS?: undefined;
|
|
63
|
+
eventName?: undefined;
|
|
64
|
+
isPullRequest?: undefined;
|
|
65
|
+
isPush?: undefined;
|
|
66
|
+
} | {
|
|
67
|
+
name: string;
|
|
68
|
+
isCI: boolean;
|
|
69
|
+
isGitHubActions: boolean;
|
|
70
|
+
repository: string | undefined;
|
|
71
|
+
workflow: string | undefined;
|
|
72
|
+
runId: string | undefined;
|
|
73
|
+
branch: string | undefined;
|
|
74
|
+
actor: string | undefined;
|
|
75
|
+
commitSha: string | undefined;
|
|
76
|
+
runnerOS: string | undefined;
|
|
77
|
+
eventName: string | undefined;
|
|
78
|
+
isPullRequest: boolean;
|
|
79
|
+
isPush: boolean;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* 简单的检查函数
|
|
84
|
+
*/
|
|
85
|
+
export declare const isGitHubActions: () => boolean;
|
|
86
|
+
export declare const isCI: () => boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface IPublishPluginConfig {
|
|
2
|
+
branchPrefix?: string;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Read plugin configuration from common/config/rush-plugins/@coze-arch/rush-publish-plugin.json
|
|
6
|
+
* @returns Plugin configuration object
|
|
7
|
+
*/
|
|
8
|
+
export declare function getPluginConfig(): IPublishPluginConfig;
|
package/lib/utils/git.d.ts
CHANGED
|
@@ -4,6 +4,11 @@ export declare const getChangedFilesFromCached: () => Promise<string[]>;
|
|
|
4
4
|
* @returns string
|
|
5
5
|
*/
|
|
6
6
|
export declare const getCurrentBranchName: () => Promise<string>;
|
|
7
|
+
/**
|
|
8
|
+
* 获取当前 commit hash
|
|
9
|
+
* @returns commit hash
|
|
10
|
+
*/
|
|
11
|
+
export declare const getCurrentCommitHash: () => Promise<string>;
|
|
7
12
|
export declare const isMainBranch: () => Promise<boolean>;
|
|
8
13
|
export declare const getChangedFiles: () => Promise<string[]>;
|
|
9
14
|
/**
|
|
@@ -17,3 +22,25 @@ export declare const ensureNotUncommittedChanges: () => Promise<boolean>;
|
|
|
17
22
|
*/
|
|
18
23
|
export declare const getCurrentOrigin: (cwd?: string) => Promise<string | undefined>;
|
|
19
24
|
export declare const convertGitSchemaToHttp: (gitUrl: string) => string;
|
|
25
|
+
/**
|
|
26
|
+
* 解析 Git 远程仓库 URL,提取主机和仓库路径
|
|
27
|
+
* 支持 HTTP/HTTPS 和 SSH 格式
|
|
28
|
+
* @param gitUrl Git 仓库 URL
|
|
29
|
+
* @returns 包含主机和仓库路径的对象,解析失败返回 null
|
|
30
|
+
*/
|
|
31
|
+
export declare const parseGitRemoteUrl: (gitUrl: string) => {
|
|
32
|
+
host: string;
|
|
33
|
+
path: string;
|
|
34
|
+
fullUrl: string;
|
|
35
|
+
} | null;
|
|
36
|
+
/**
|
|
37
|
+
* 根据仓库信息构建 MR/PR 创建链接
|
|
38
|
+
* @param repoInfo 仓库信息
|
|
39
|
+
* @param branchName 分支名称
|
|
40
|
+
* @returns MR/PR 创建链接,如果无法构建则返回 null
|
|
41
|
+
*/
|
|
42
|
+
export declare const buildMergeRequestUrl: (repoInfo: {
|
|
43
|
+
host: string;
|
|
44
|
+
path: string;
|
|
45
|
+
fullUrl: string;
|
|
46
|
+
}, branchName: string) => string | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coze-arch/rush-publish-plugin",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5-alpha.1ae01f",
|
|
4
4
|
"description": "rush plugin to generate change log and publish packages",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rush",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"release",
|
|
10
10
|
"publish"
|
|
11
11
|
],
|
|
12
|
-
"license": "
|
|
12
|
+
"license": "MIT",
|
|
13
13
|
"author": "tecvan.fe@gmail.com",
|
|
14
14
|
"maintainers": [],
|
|
15
15
|
"main": "./lib/index.js",
|
|
@@ -42,24 +42,20 @@
|
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@commitlint/types": "^17.4.0",
|
|
45
|
+
"@coze-arch/build-lib-preset": "workspace:*",
|
|
45
46
|
"@coze-arch/eslint-config": "workspace:*",
|
|
46
47
|
"@coze-arch/fs-enhance": "workspace:*",
|
|
47
48
|
"@coze-arch/logger": "workspace:*",
|
|
49
|
+
"@coze-arch/monorepo-kits": "workspace:*",
|
|
48
50
|
"@coze-arch/ts-config": "workspace:*",
|
|
49
51
|
"@coze-arch/vitest-config": "workspace:*",
|
|
50
|
-
"@
|
|
51
|
-
"@rollup/plugin-json": "~6.0.0",
|
|
52
|
-
"@rollup/plugin-node-resolve": "~15.0.1",
|
|
53
|
-
"@rollup/plugin-sucrase": "^5.0.2",
|
|
54
|
-
"@types/node": "^22.13.13",
|
|
52
|
+
"@types/node": "^22",
|
|
55
53
|
"@types/semver": "^7.5.8",
|
|
56
54
|
"@types/shelljs": "^0.8.15",
|
|
57
55
|
"@vitest/coverage-v8": "^3.0.9",
|
|
58
56
|
"commander": "^13.1.0",
|
|
59
|
-
"rollup": "^4.
|
|
60
|
-
"rollup-plugin-terser": "^7.0.2",
|
|
57
|
+
"rollup": "^4.41.1",
|
|
61
58
|
"sucrase": "^3.32.0",
|
|
62
|
-
"tsx": "^4.19.3",
|
|
63
59
|
"vitest": "^3.0.9"
|
|
64
60
|
},
|
|
65
61
|
"peerDependencies": {
|