@peiyanlu/release 0.0.2 → 0.0.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/dist/index.cjs CHANGED
@@ -1,11 +1,10 @@
1
+ let _peiyanlu_ts_utils = require("@peiyanlu/ts-utils");
1
2
 
2
3
  //#region src/config.ts
3
4
  function defineConfig(config) {
4
5
  return config;
5
6
  }
6
- const toString = (self) => Object.prototype.toString.call(self);
7
- const isPlainObject = (v) => toString(v) === "[object Object]";
8
- const isFunction = (v) => toString(v) === "[object Function]";
7
+ const isFunction = (v) => typeof v === "function";
9
8
  const mergeConfig = (defaults, overrides) => {
10
9
  if (!overrides) return structuredClone(defaults);
11
10
  if (Object.keys(defaults).length === 0) return structuredClone(overrides);
@@ -15,7 +14,7 @@ const mergeConfig = (defaults, overrides) => {
15
14
  const overrideValue = overrides[key];
16
15
  if (overrideValue === void 0) if (isFunction(defaultValue)) result[key] = defaultValue;
17
16
  else result[key] = structuredClone(defaultValue);
18
- else if (isPlainObject(defaultValue) && isPlainObject(overrideValue)) result[key] = mergeConfig(defaultValue, overrideValue);
17
+ else if ((0, _peiyanlu_ts_utils.isPlainObject)(defaultValue) && (0, _peiyanlu_ts_utils.isPlainObject)(overrideValue)) result[key] = mergeConfig(defaultValue, overrideValue);
19
18
  else if (isFunction(overrideValue)) result[key] = overrideValue;
20
19
  else result[key] = structuredClone(overrideValue);
21
20
  }
package/dist/index.d.cts CHANGED
@@ -1,5 +1,12 @@
1
1
  import { DeepPartial, DeepRequired } from "@peiyanlu/ts-utils";
2
2
 
3
+ //#region src/git/changetype.d.ts
4
+ interface CommitType {
5
+ type: string;
6
+ section: string;
7
+ description: string;
8
+ }
9
+ //#endregion
3
10
  //#region src/types.d.ts
4
11
 
5
12
  type HookTiming = 'before' | 'after';
@@ -8,27 +15,137 @@ type ReleaseHookKey = `${HookTiming}:${HookAction}`;
8
15
  type ReleaseHookValue = string | string[] | (() => Promise<void> | void);
9
16
  type HookConfig = { [key in ReleaseHookKey]: ReleaseHookValue };
10
17
  interface ReleaseConfig {
18
+ /**
19
+ * 生命周期钩子配置
20
+ */
11
21
  hooks: HookConfig;
22
+ /**
23
+ * Git 相关配置
24
+ */
12
25
  git: {
26
+ /**
27
+ * 是否创建提交
28
+ */
13
29
  commit: boolean | undefined;
30
+ /**
31
+ * 是否创建 Git Tag
32
+ */
14
33
  tag: boolean | undefined;
34
+ /**
35
+ * 是否推送到远程仓库
36
+ */
15
37
  push: boolean | undefined;
38
+ /**
39
+ * Git 提交信息模板
40
+ */
16
41
  commitMessage: string;
42
+ /**
43
+ * 额外的 git commit 参数
44
+ */
45
+ commitArgs: string[];
46
+ /**
47
+ * Git Tag 的消息内容
48
+ */
17
49
  tagMessage: string;
50
+ /**
51
+ * Git Tag 名称模板
52
+ */
18
53
  tagName: string;
54
+ /**
55
+ * 额外的 git tag 参数
56
+ */
57
+ tagArgs: string[];
58
+ /**
59
+ * 额外的 git push 参数
60
+ */
61
+ pushArgs: string[];
62
+ /**
63
+ * 是否自动添加未追踪的文件
64
+ */
65
+ addUntrackedFiles: boolean;
66
+ /**
67
+ * 是否要求配置远程仓库
68
+ */
69
+ requireRemote: boolean;
70
+ /**
71
+ * 是否要求当前目录为 Git 仓库
72
+ */
73
+ requireRepository: boolean;
74
+ /**
75
+ * 是否要求工作目录保持干净(无未提交的更改)
76
+ */
77
+ requireWorkDirClean: boolean;
19
78
  };
79
+ /**
80
+ * NPM 发布相关配置
81
+ */
20
82
  npm: {
83
+ /**
84
+ * 是否发布到 npm
85
+ */
21
86
  publish: boolean | undefined;
22
- tag: string;
23
- allowSameVersion: boolean;
87
+ /**
88
+ * 发布目录路径
89
+ */
90
+ publishPath: string;
91
+ /**
92
+ * 额外的 npm publish 参数
93
+ */
94
+ pushArgs: string[];
95
+ /**
96
+ * 是否跳过发布前检查
97
+ */
98
+ skipChecks: boolean;
24
99
  };
100
+ /**
101
+ * GitHub Release 相关配置
102
+ */
25
103
  github: {
104
+ /**
105
+ * 是否创建 GitHub Release
106
+ */
26
107
  release: boolean | undefined;
108
+ /**
109
+ * Release 展示名称
110
+ */
111
+ releaseName: string;
112
+ /**
113
+ * 是否自动生成 Release Notes (CI)
114
+ */
115
+ autoGenerate: boolean;
116
+ /**
117
+ * 是否标记为预发布版本
118
+ */
27
119
  prerelease: boolean;
120
+ /**
121
+ * 是否创建为草稿
122
+ */
28
123
  draft: boolean;
29
- releaseName: string;
124
+ /**
125
+ * GitHub Token 引用名称
126
+ */
30
127
  tokenRef: string;
128
+ /**
129
+ * 需要上传的 Release 资源文件
130
+ */
31
131
  assets: string[];
132
+ /**
133
+ * 是否跳过 GitHub 发布前检查
134
+ */
135
+ skipChecks: boolean;
136
+ };
137
+ /**
138
+ * Changelog 生成相关配置
139
+ */
140
+ changelog: {
141
+ /**
142
+ * Changelog 输入文件路径
143
+ */
144
+ infile: string;
145
+ /**
146
+ * 用于生成 Changelog 的提交类型映射规则
147
+ */
148
+ types: CommitType[];
32
149
  };
33
150
  }
34
151
  //#endregion
package/dist/index.d.mts CHANGED
@@ -1,5 +1,12 @@
1
1
  import { DeepPartial, DeepRequired } from "@peiyanlu/ts-utils";
2
2
 
3
+ //#region src/git/changetype.d.ts
4
+ interface CommitType {
5
+ type: string;
6
+ section: string;
7
+ description: string;
8
+ }
9
+ //#endregion
3
10
  //#region src/types.d.ts
4
11
 
5
12
  type HookTiming = 'before' | 'after';
@@ -8,27 +15,137 @@ type ReleaseHookKey = `${HookTiming}:${HookAction}`;
8
15
  type ReleaseHookValue = string | string[] | (() => Promise<void> | void);
9
16
  type HookConfig = { [key in ReleaseHookKey]: ReleaseHookValue };
10
17
  interface ReleaseConfig {
18
+ /**
19
+ * 生命周期钩子配置
20
+ */
11
21
  hooks: HookConfig;
22
+ /**
23
+ * Git 相关配置
24
+ */
12
25
  git: {
26
+ /**
27
+ * 是否创建提交
28
+ */
13
29
  commit: boolean | undefined;
30
+ /**
31
+ * 是否创建 Git Tag
32
+ */
14
33
  tag: boolean | undefined;
34
+ /**
35
+ * 是否推送到远程仓库
36
+ */
15
37
  push: boolean | undefined;
38
+ /**
39
+ * Git 提交信息模板
40
+ */
16
41
  commitMessage: string;
42
+ /**
43
+ * 额外的 git commit 参数
44
+ */
45
+ commitArgs: string[];
46
+ /**
47
+ * Git Tag 的消息内容
48
+ */
17
49
  tagMessage: string;
50
+ /**
51
+ * Git Tag 名称模板
52
+ */
18
53
  tagName: string;
54
+ /**
55
+ * 额外的 git tag 参数
56
+ */
57
+ tagArgs: string[];
58
+ /**
59
+ * 额外的 git push 参数
60
+ */
61
+ pushArgs: string[];
62
+ /**
63
+ * 是否自动添加未追踪的文件
64
+ */
65
+ addUntrackedFiles: boolean;
66
+ /**
67
+ * 是否要求配置远程仓库
68
+ */
69
+ requireRemote: boolean;
70
+ /**
71
+ * 是否要求当前目录为 Git 仓库
72
+ */
73
+ requireRepository: boolean;
74
+ /**
75
+ * 是否要求工作目录保持干净(无未提交的更改)
76
+ */
77
+ requireWorkDirClean: boolean;
19
78
  };
79
+ /**
80
+ * NPM 发布相关配置
81
+ */
20
82
  npm: {
83
+ /**
84
+ * 是否发布到 npm
85
+ */
21
86
  publish: boolean | undefined;
22
- tag: string;
23
- allowSameVersion: boolean;
87
+ /**
88
+ * 发布目录路径
89
+ */
90
+ publishPath: string;
91
+ /**
92
+ * 额外的 npm publish 参数
93
+ */
94
+ pushArgs: string[];
95
+ /**
96
+ * 是否跳过发布前检查
97
+ */
98
+ skipChecks: boolean;
24
99
  };
100
+ /**
101
+ * GitHub Release 相关配置
102
+ */
25
103
  github: {
104
+ /**
105
+ * 是否创建 GitHub Release
106
+ */
26
107
  release: boolean | undefined;
108
+ /**
109
+ * Release 展示名称
110
+ */
111
+ releaseName: string;
112
+ /**
113
+ * 是否自动生成 Release Notes (CI)
114
+ */
115
+ autoGenerate: boolean;
116
+ /**
117
+ * 是否标记为预发布版本
118
+ */
27
119
  prerelease: boolean;
120
+ /**
121
+ * 是否创建为草稿
122
+ */
28
123
  draft: boolean;
29
- releaseName: string;
124
+ /**
125
+ * GitHub Token 引用名称
126
+ */
30
127
  tokenRef: string;
128
+ /**
129
+ * 需要上传的 Release 资源文件
130
+ */
31
131
  assets: string[];
132
+ /**
133
+ * 是否跳过 GitHub 发布前检查
134
+ */
135
+ skipChecks: boolean;
136
+ };
137
+ /**
138
+ * Changelog 生成相关配置
139
+ */
140
+ changelog: {
141
+ /**
142
+ * Changelog 输入文件路径
143
+ */
144
+ infile: string;
145
+ /**
146
+ * 用于生成 Changelog 的提交类型映射规则
147
+ */
148
+ types: CommitType[];
32
149
  };
33
150
  }
34
151
  //#endregion
package/dist/index.mjs CHANGED
@@ -1,10 +1,10 @@
1
+ import { isPlainObject } from "@peiyanlu/ts-utils";
2
+
1
3
  //#region src/config.ts
2
4
  function defineConfig(config) {
3
5
  return config;
4
6
  }
5
- const toString = (self) => Object.prototype.toString.call(self);
6
- const isPlainObject = (v) => toString(v) === "[object Object]";
7
- const isFunction = (v) => toString(v) === "[object Function]";
7
+ const isFunction = (v) => typeof v === "function";
8
8
  const mergeConfig = (defaults, overrides) => {
9
9
  if (!overrides) return structuredClone(defaults);
10
10
  if (Object.keys(defaults).length === 0) return structuredClone(overrides);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peiyanlu/release",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "Release project tool.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -24,14 +24,13 @@
24
24
  "dev": "tsdown -w",
25
25
  "build": "tsdown",
26
26
  "prepublish": "tsdown",
27
- "test": "vitest run",
28
- "test:cov": "vitest run --coverage"
27
+ "test": "vitest run"
29
28
  },
30
29
  "dependencies": {
31
30
  "@clack/prompts": "^0.11.0",
32
31
  "@octokit/rest": "^22.0.1",
33
- "@peiyanlu/cli-utils": "^0.0.3",
34
- "@peiyanlu/ts-utils": "^0.0.3",
32
+ "@peiyanlu/cli-utils": "^0.0.4",
33
+ "@peiyanlu/ts-utils": "^0.0.4",
35
34
  "ansis": "^4.2.0",
36
35
  "commander": "^14.0.2",
37
36
  "mime-types": "^3.0.2",
@@ -43,7 +42,6 @@
43
42
  "@types/semver": "^7.7.1",
44
43
  "@types/mime-types": "^3.0.1",
45
44
  "@types/node": "^24.10.3",
46
- "@vitest/coverage-v8": "^4.0.15",
47
45
  "tsdown": "^0.18.4",
48
46
  "typescript": "^5.9.3",
49
47
  "vitest": "^4.0.15"