release-it-gitea 1.9.2 → 1.9.3

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/lib/global.d.d.ts CHANGED
@@ -17,8 +17,6 @@ declare module "release-it" {
17
17
  "release-it-gitea"?: GiteaConfig;
18
18
  };
19
19
  };
20
- /** 设置上下文值,支持对象形式或键值对形式 */
21
- setContext(path: string, value: unknown): void;
22
20
  /** 设置上下文对象 */
23
21
  setContext(context: Record<string, unknown>): void;
24
22
  }
@@ -62,6 +60,12 @@ declare module "release-it" {
62
60
  * 所有插件都应该继承此类
63
61
  */
64
62
  class Plugin {
63
+ /** 插件命名空间 */
64
+ namespace: string;
65
+ /** 插件选项(冻结的) */
66
+ options: Readonly<Record<string, unknown>>;
67
+ /** 插件上下文 */
68
+ context: Record<string, unknown>;
65
69
  /** 配置对象 */
66
70
  config: Config;
67
71
  /** 日志工具 */
@@ -72,6 +76,8 @@ declare module "release-it" {
72
76
  exec: (command: string) => void;
73
77
  /** 输出普通信息 */
74
78
  info: (message: string) => void;
79
+ /** 输出日志信息 */
80
+ log: (message: string) => void;
75
81
  /** 输出详细信息 */
76
82
  verbose: (message: string) => void;
77
83
  /** 输出警告信息 */
@@ -80,10 +86,30 @@ declare module "release-it" {
80
86
  /** Shell 命令执行工具 */
81
87
  shell: {
82
88
  /** 执行 shell 命令 */
83
- exec: (command: string) => Promise<string>;
89
+ exec: (
90
+ command: string,
91
+ options?: unknown,
92
+ context?: unknown,
93
+ ) => Promise<string>;
84
94
  };
85
-
86
- constructor(config: Config);
95
+ /** 进度指示器 */
96
+ spinner: unknown;
97
+ /** 提示工具 */
98
+ prompt: unknown;
99
+ /** 调试工具 */
100
+ debug: (...args: unknown[]) => void;
101
+
102
+ constructor(args?: {
103
+ container?: {
104
+ config?: Config;
105
+ log?: Plugin["log"];
106
+ prompt?: unknown;
107
+ shell?: Plugin["shell"];
108
+ spinner?: unknown;
109
+ };
110
+ namespace?: string;
111
+ options?: Record<string, unknown>;
112
+ });
87
113
 
88
114
  /** 禁用插件 */
89
115
  static disablePlugin(): void;
@@ -96,9 +122,22 @@ declare module "release-it" {
96
122
  /** 发布前的钩子 */
97
123
  beforeRelease(): Promise<void>;
98
124
  /** 提升版本号 */
99
- bump(): Promise<void>;
125
+ bump(version?: string): Promise<void>;
100
126
  /** 获取上下文值 */
101
127
  getContext(path?: string): unknown;
128
+ /** 设置上下文值 */
129
+ setContext(context: Record<string, unknown>): void;
130
+ /** 执行 shell 命令 */
131
+ exec(
132
+ command: string,
133
+ options?: { context?: Record<string, unknown>; options?: unknown },
134
+ ): Promise<string>;
135
+ /** 注册提示 */
136
+ registerPrompts(prompts: Record<string, unknown>): void;
137
+ /** 显示提示 */
138
+ showPrompt(options: Record<string, unknown>): Promise<unknown>;
139
+ /** 执行步骤 */
140
+ step(options: Record<string, unknown>): Promise<unknown>;
102
141
  /** 获取版本增量类型 */
103
142
  getIncrement(): string;
104
143
  /** 获取增量后的版本号 */
@@ -106,10 +145,13 @@ declare module "release-it" {
106
145
  /** 在 CI 环境中获取增量后的版本号 */
107
146
  getIncrementedVersionCI(): string;
108
147
  /** 获取初始配置选项 */
109
- getInitialOptions(): unknown;
148
+ getInitialOptions(
149
+ options: Record<string, unknown>,
150
+ namespace: string,
151
+ ): Record<string, unknown>;
110
152
  /** 获取最新版本号 */
111
153
  getLatestVersion(): string;
112
- /** 获取项目名称 */
154
+ /** 获取项目名称,返回当前项目的名称 */
113
155
  getName(): string;
114
156
  /** 初始化插件 */
115
157
  init(): Promise<void>;
package/lib/index.d.ts CHANGED
@@ -2,6 +2,11 @@ import { Plugin } from 'release-it';
2
2
 
3
3
  declare class GiteaPlugin extends Plugin {
4
4
  static isEnabled(config?: GiteaConfig): boolean;
5
+ /**
6
+ * 获取项目名称
7
+ * @returns 项目名称
8
+ */
9
+ getName(): string;
5
10
  /**
6
11
  * 获取并验证 Gitea 配置信息
7
12
  * @returns 验证后的 Gitea 配置对象
package/lib/index.js CHANGED
@@ -9,6 +9,13 @@ class GiteaPlugin extends Plugin {
9
9
  static isEnabled(config) {
10
10
  return config?.release !== false;
11
11
  }
12
+ /**
13
+ * 获取项目名称
14
+ * @returns 项目名称
15
+ */
16
+ getName() {
17
+ return this.config.getContext("name");
18
+ }
12
19
  /**
13
20
  * 获取并验证 Gitea 配置信息
14
21
  * @returns 验证后的 Gitea 配置对象
@@ -493,7 +500,7 @@ class GiteaPlugin extends Plugin {
493
500
  if (this.giteaConfig.assets && this.giteaConfig.assets.length > 0) {
494
501
  await this.uploadAssets(release.id);
495
502
  }
496
- this.config.setContext("releaseUrl", release.html_url);
503
+ this.config.setContext({ releaseUrl: release.html_url });
497
504
  } catch (error) {
498
505
  if (error instanceof Error) {
499
506
  this.log.error(`\u274C \u521B\u5EFA Gitea \u53D1\u5E03\u5931\u8D25: ${error.message}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "release-it-gitea",
3
- "version": "1.9.2",
3
+ "version": "1.9.3",
4
4
  "description": "release-it gitea plugin.",
5
5
  "keywords": [
6
6
  "gitea",
@@ -50,7 +50,7 @@
50
50
  "devDependencies": {
51
51
  "@eslint-community/eslint-plugin-eslint-comments": "4.7.0",
52
52
  "@eslint/js": "9.39.2",
53
- "@release-it/conventional-changelog": "10.0.0",
53
+ "@release-it/conventional-changelog": "10.0.6",
54
54
  "@types/archiver": "7.0.0",
55
55
  "@types/node": "24.12.0",
56
56
  "@vitest/coverage-v8": "4.0.16",
@@ -77,13 +77,13 @@
77
77
  "release-it": "19.2.2",
78
78
  "tsup": "8.5.1",
79
79
  "typescript": "5.9.3",
80
- "typescript-eslint": "8.56.0",
80
+ "typescript-eslint": "8.57.0",
81
81
  "vitest": "4.0.16"
82
82
  },
83
83
  "peerDependencies": {
84
84
  "release-it": "^19.0.3"
85
85
  },
86
- "packageManager": "pnpm@10.31.0",
86
+ "packageManager": "pnpm@10.32.0",
87
87
  "engines": {
88
88
  "node": ">=18.3.0"
89
89
  },