@soybeanjs/changelog 0.3.2 → 0.3.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.
@@ -0,0 +1,204 @@
1
+ /**
2
+ * the commit author
3
+ */
4
+ interface GitCommitAuthor {
5
+ /**
6
+ * the author name
7
+ */
8
+ name: string;
9
+ /**
10
+ * the author email
11
+ */
12
+ email: string;
13
+ }
14
+ /**
15
+ * the raw git commit
16
+ */
17
+ interface RawGitCommit {
18
+ /**
19
+ * the commit message
20
+ */
21
+ message: string;
22
+ /**
23
+ * the commit body
24
+ */
25
+ body: string;
26
+ /**
27
+ * the commit hash
28
+ */
29
+ shortHash: string;
30
+ /**
31
+ * the commit author
32
+ */
33
+ author: GitCommitAuthor;
34
+ }
35
+ /**
36
+ * the reference of the commit
37
+ */
38
+ interface Reference {
39
+ /**
40
+ * the reference type
41
+ */
42
+ type: 'hash' | 'issue' | 'pull-request';
43
+ /**
44
+ * the reference value
45
+ */
46
+ value: string;
47
+ }
48
+ /**
49
+ * the resolved github author
50
+ */
51
+ interface ResolvedAuthor extends GitCommitAuthor {
52
+ /**
53
+ * the git commit of the author
54
+ */
55
+ commits: string[];
56
+ /**
57
+ * the github logged username of the author
58
+ */
59
+ login: string;
60
+ }
61
+ /**
62
+ * git commit config
63
+ */
64
+ interface GitCommit extends RawGitCommit {
65
+ /**
66
+ * the commit description
67
+ */
68
+ description: string;
69
+ /**
70
+ * the commit scope type
71
+ */
72
+ type: string;
73
+ /**
74
+ * the commit scope
75
+ */
76
+ scope: string;
77
+ /**
78
+ * the commit references
79
+ */
80
+ references: Reference[];
81
+ /**
82
+ * the commit authors
83
+ */
84
+ authors: GitCommitAuthor[];
85
+ /**
86
+ * the resolved authors
87
+ */
88
+ resolvedAuthors: ResolvedAuthor[];
89
+ /**
90
+ * the commit breaking changes
91
+ */
92
+ isBreaking: boolean;
93
+ }
94
+ /**
95
+ * github config
96
+ */
97
+ interface GithubConfig {
98
+ /**
99
+ * the github repository name
100
+ * @example soybeanjs/changelog
101
+ */
102
+ repo: string;
103
+ /**
104
+ * the github token
105
+ */
106
+ token: string;
107
+ }
108
+ interface ChangelogOption {
109
+ /**
110
+ * the directory of the project
111
+ * @default process.cwd()
112
+ */
113
+ cwd: string;
114
+ /**
115
+ * the commit scope types
116
+ */
117
+ types: Record<string, string>;
118
+ /**
119
+ * github config
120
+ */
121
+ github: GithubConfig;
122
+ /**
123
+ * the commit hash or tag
124
+ */
125
+ from: string;
126
+ /**
127
+ * the commit hash or tag
128
+ */
129
+ to: string;
130
+ /**
131
+ * the whole commit tags
132
+ */
133
+ tags: string[];
134
+ /**
135
+ * the commit tag and date map
136
+ */
137
+ tagDateMap: Map<string, string>;
138
+ /**
139
+ * Whether to capitalize the first letter of the commit type
140
+ */
141
+ capitalize: boolean;
142
+ /**
143
+ * Use emojis in section titles
144
+ * @default true
145
+ */
146
+ emoji: boolean;
147
+ /**
148
+ * the section titles
149
+ */
150
+ titles: {
151
+ /**
152
+ * the title of breaking changes section
153
+ */
154
+ breakingChanges: string;
155
+ };
156
+ /**
157
+ * the output file path of the changelog
158
+ */
159
+ output: string;
160
+ /**
161
+ * Whether to regenerate the changelog if it already exists
162
+ * @example the changelog already exists the content of v0.0.1, but you want to regenerate it
163
+ */
164
+ regenerate: boolean;
165
+ /**
166
+ * version from package.json, with prefix "v"
167
+ * @description if the options "to" is not specified, the version will be used
168
+ */
169
+ newVersion: string;
170
+ /**
171
+ * Mark the release as prerelease
172
+ */
173
+ prerelease?: boolean;
174
+ }
175
+
176
+ /**
177
+ * get the changelog markdown by two git tags
178
+ * @param options the changelog options
179
+ * @param showTitle whither show the title
180
+ */
181
+ declare function getChangelogMarkdown(options?: Partial<ChangelogOption>, showTitle?: boolean): Promise<{
182
+ markdown: string;
183
+ commits: GitCommit[];
184
+ options: ChangelogOption;
185
+ }>;
186
+ /**
187
+ * get the changelog markdown by the total git tags
188
+ * @param options the changelog options
189
+ * @param showProgress whither show the progress bar
190
+ */
191
+ declare function getTotalChangelogMarkdown(options?: Partial<ChangelogOption>, showProgress?: boolean): Promise<string>;
192
+ /**
193
+ * generate the changelog markdown by two git tags
194
+ * @param options the changelog options
195
+ */
196
+ declare function generateChangelog(options?: Partial<ChangelogOption>): Promise<void>;
197
+ /**
198
+ * generate the changelog markdown by the total git tags
199
+ * @param options the changelog options
200
+ * @param showProgress whither show the progress bar
201
+ */
202
+ declare function generateTotalChangelog(options?: Partial<ChangelogOption>, showProgress?: boolean): Promise<void>;
203
+
204
+ export { type ChangelogOption, generateChangelog, generateTotalChangelog, getChangelogMarkdown, getTotalChangelogMarkdown };
@@ -0,0 +1,204 @@
1
+ /**
2
+ * the commit author
3
+ */
4
+ interface GitCommitAuthor {
5
+ /**
6
+ * the author name
7
+ */
8
+ name: string;
9
+ /**
10
+ * the author email
11
+ */
12
+ email: string;
13
+ }
14
+ /**
15
+ * the raw git commit
16
+ */
17
+ interface RawGitCommit {
18
+ /**
19
+ * the commit message
20
+ */
21
+ message: string;
22
+ /**
23
+ * the commit body
24
+ */
25
+ body: string;
26
+ /**
27
+ * the commit hash
28
+ */
29
+ shortHash: string;
30
+ /**
31
+ * the commit author
32
+ */
33
+ author: GitCommitAuthor;
34
+ }
35
+ /**
36
+ * the reference of the commit
37
+ */
38
+ interface Reference {
39
+ /**
40
+ * the reference type
41
+ */
42
+ type: 'hash' | 'issue' | 'pull-request';
43
+ /**
44
+ * the reference value
45
+ */
46
+ value: string;
47
+ }
48
+ /**
49
+ * the resolved github author
50
+ */
51
+ interface ResolvedAuthor extends GitCommitAuthor {
52
+ /**
53
+ * the git commit of the author
54
+ */
55
+ commits: string[];
56
+ /**
57
+ * the github logged username of the author
58
+ */
59
+ login: string;
60
+ }
61
+ /**
62
+ * git commit config
63
+ */
64
+ interface GitCommit extends RawGitCommit {
65
+ /**
66
+ * the commit description
67
+ */
68
+ description: string;
69
+ /**
70
+ * the commit scope type
71
+ */
72
+ type: string;
73
+ /**
74
+ * the commit scope
75
+ */
76
+ scope: string;
77
+ /**
78
+ * the commit references
79
+ */
80
+ references: Reference[];
81
+ /**
82
+ * the commit authors
83
+ */
84
+ authors: GitCommitAuthor[];
85
+ /**
86
+ * the resolved authors
87
+ */
88
+ resolvedAuthors: ResolvedAuthor[];
89
+ /**
90
+ * the commit breaking changes
91
+ */
92
+ isBreaking: boolean;
93
+ }
94
+ /**
95
+ * github config
96
+ */
97
+ interface GithubConfig {
98
+ /**
99
+ * the github repository name
100
+ * @example soybeanjs/changelog
101
+ */
102
+ repo: string;
103
+ /**
104
+ * the github token
105
+ */
106
+ token: string;
107
+ }
108
+ interface ChangelogOption {
109
+ /**
110
+ * the directory of the project
111
+ * @default process.cwd()
112
+ */
113
+ cwd: string;
114
+ /**
115
+ * the commit scope types
116
+ */
117
+ types: Record<string, string>;
118
+ /**
119
+ * github config
120
+ */
121
+ github: GithubConfig;
122
+ /**
123
+ * the commit hash or tag
124
+ */
125
+ from: string;
126
+ /**
127
+ * the commit hash or tag
128
+ */
129
+ to: string;
130
+ /**
131
+ * the whole commit tags
132
+ */
133
+ tags: string[];
134
+ /**
135
+ * the commit tag and date map
136
+ */
137
+ tagDateMap: Map<string, string>;
138
+ /**
139
+ * Whether to capitalize the first letter of the commit type
140
+ */
141
+ capitalize: boolean;
142
+ /**
143
+ * Use emojis in section titles
144
+ * @default true
145
+ */
146
+ emoji: boolean;
147
+ /**
148
+ * the section titles
149
+ */
150
+ titles: {
151
+ /**
152
+ * the title of breaking changes section
153
+ */
154
+ breakingChanges: string;
155
+ };
156
+ /**
157
+ * the output file path of the changelog
158
+ */
159
+ output: string;
160
+ /**
161
+ * Whether to regenerate the changelog if it already exists
162
+ * @example the changelog already exists the content of v0.0.1, but you want to regenerate it
163
+ */
164
+ regenerate: boolean;
165
+ /**
166
+ * version from package.json, with prefix "v"
167
+ * @description if the options "to" is not specified, the version will be used
168
+ */
169
+ newVersion: string;
170
+ /**
171
+ * Mark the release as prerelease
172
+ */
173
+ prerelease?: boolean;
174
+ }
175
+
176
+ /**
177
+ * get the changelog markdown by two git tags
178
+ * @param options the changelog options
179
+ * @param showTitle whither show the title
180
+ */
181
+ declare function getChangelogMarkdown(options?: Partial<ChangelogOption>, showTitle?: boolean): Promise<{
182
+ markdown: string;
183
+ commits: GitCommit[];
184
+ options: ChangelogOption;
185
+ }>;
186
+ /**
187
+ * get the changelog markdown by the total git tags
188
+ * @param options the changelog options
189
+ * @param showProgress whither show the progress bar
190
+ */
191
+ declare function getTotalChangelogMarkdown(options?: Partial<ChangelogOption>, showProgress?: boolean): Promise<string>;
192
+ /**
193
+ * generate the changelog markdown by two git tags
194
+ * @param options the changelog options
195
+ */
196
+ declare function generateChangelog(options?: Partial<ChangelogOption>): Promise<void>;
197
+ /**
198
+ * generate the changelog markdown by the total git tags
199
+ * @param options the changelog options
200
+ * @param showProgress whither show the progress bar
201
+ */
202
+ declare function generateTotalChangelog(options?: Partial<ChangelogOption>, showProgress?: boolean): Promise<void>;
203
+
204
+ export { type ChangelogOption, generateChangelog, generateTotalChangelog, getChangelogMarkdown, getTotalChangelogMarkdown };
package/dist/index.d.ts CHANGED
@@ -201,4 +201,4 @@ declare function generateChangelog(options?: Partial<ChangelogOption>): Promise<
201
201
  */
202
202
  declare function generateTotalChangelog(options?: Partial<ChangelogOption>, showProgress?: boolean): Promise<void>;
203
203
 
204
- export { ChangelogOption, generateChangelog, generateTotalChangelog, getChangelogMarkdown, getTotalChangelogMarkdown };
204
+ export { type ChangelogOption, generateChangelog, generateTotalChangelog, getChangelogMarkdown, getTotalChangelogMarkdown };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soybeanjs/changelog",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "generate changelog form git tags and commits for github",
5
5
  "author": {
6
6
  "name": "Soybean",
@@ -36,18 +36,18 @@
36
36
  "convert-gitmoji": "0.1.3",
37
37
  "dayjs": "1.11.9",
38
38
  "execa": "8.0.1",
39
- "ofetch": "1.2.0"
39
+ "ofetch": "1.2.1"
40
40
  },
41
41
  "devDependencies": {
42
- "@soybeanjs/cli": "0.6.7",
42
+ "@soybeanjs/cli": "0.7.1",
43
43
  "@types/cli-progress": "3.11.0",
44
- "@types/node": "20.5.2",
44
+ "@types/node": "20.5.3",
45
45
  "eslint": "8.47.0",
46
- "eslint-config-soybeanjs": "0.5.5",
46
+ "eslint-config-soybeanjs": "0.5.6",
47
47
  "simple-git-hooks": "2.9.0",
48
48
  "tsx": "3.12.7",
49
49
  "typescript": "5.1.6",
50
- "unbuild": "1.2.1"
50
+ "unbuild": "2.0.0"
51
51
  },
52
52
  "simple-git-hooks": {
53
53
  "commit-msg": "pnpm soy git-commit-verify",