Skip to content

Commit 5f6ad09

Browse files
committed
refactor(projects): refactor get to tag
1 parent 4d00473 commit 5f6ad09

File tree

6 files changed

+83
-79
lines changed

6 files changed

+83
-79
lines changed

CHANGELOG.md

Lines changed: 46 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Changelog
22

33

4-
## [v0.3.15](https://github.com/soybeanjs/changelog/compare/v0.3.14...v0.3.15) (24-03-03)
4+
## [v0.3.15](https://github.com/soybeanjs/changelog/compare/v0.3.14...v0.3.15) (2024-03-03)
55

66
###    🐞 Bug Fixes
77

@@ -11,7 +11,7 @@
1111

1212
[![honghuangdc](https://github.com/honghuangdc.png?size=48)](https://github.com/honghuangdc)  
1313

14-
## [v0.3.14](https://github.com/soybeanjs/changelog/compare/v0.3.13...v0.3.14) (24-03-03)
14+
## [v0.3.14](https://github.com/soybeanjs/changelog/compare/v0.3.13...v0.3.14) (2024-03-03)
1515

1616
###    🏡 Chore
1717

@@ -22,7 +22,7 @@
2222

2323
[![honghuangdc](https://github.com/honghuangdc.png?size=48)](https://github.com/honghuangdc)  
2424

25-
## [v0.3.14-beta.1](https://github.com/soybeanjs/changelog/compare/v0.3.14-beta.0...v0.3.14-beta.1) (24-03-03)
25+
## [v0.3.14-beta.1](https://github.com/soybeanjs/changelog/compare/v0.3.14-beta.0...v0.3.14-beta.1) (2024-03-03)
2626

2727
###    🏡 Chore
2828

@@ -32,7 +32,7 @@
3232

3333
[![honghuangdc](https://github.com/honghuangdc.png?size=48)](https://github.com/honghuangdc)  
3434

35-
## [v0.3.14-beta.0](https://github.com/soybeanjs/changelog/compare/v0.3.13...v0.3.14-beta.0) (24-03-03)
35+
## [v0.3.14-beta.0](https://github.com/soybeanjs/changelog/compare/v0.3.13...v0.3.14-beta.0) (2024-03-03)
3636

3737
###    🏡 Chore
3838

@@ -42,7 +42,7 @@
4242

4343
[![honghuangdc](https://github.com/honghuangdc.png?size=48)](https://github.com/honghuangdc)  
4444

45-
## [v0.3.13](https://github.com/soybeanjs/changelog/compare/v0.3.12...v0.3.13) (24-03-03)
45+
## [v0.3.13](https://github.com/soybeanjs/changelog/compare/v0.3.12...v0.3.13) (2024-03-03)
4646

4747
###    🐞 Bug Fixes
4848

@@ -56,7 +56,7 @@
5656

5757
[![honghuangdc](https://github.com/honghuangdc.png?size=48)](https://github.com/honghuangdc)  
5858

59-
## [v0.3.13-beta.0](https://github.com/soybeanjs/changelog/compare/v0.3.12...v0.3.13-beta.0) (24-03-03)
59+
## [v0.3.13-beta.0](https://github.com/soybeanjs/changelog/compare/v0.3.12...v0.3.13-beta.0) (2024-03-03)
6060

6161
###    🏡 Chore
6262

@@ -66,7 +66,7 @@
6666

6767
[![honghuangdc](https://github.com/honghuangdc.png?size=48)](https://github.com/honghuangdc)  
6868

69-
## [v0.3.12](https://github.com/soybeanjs/changelog/compare/v0.3.11...v0.3.12) (24-01-21)
69+
## [v0.3.12](https://github.com/soybeanjs/changelog/compare/v0.3.11...v0.3.12) (2024-01-21)
7070

7171
###    🐞 Bug Fixes
7272

@@ -84,7 +84,7 @@
8484

8585
[![honghuangdc](https://github.com/honghuangdc.png?size=48)](https://github.com/honghuangdc)  
8686

87-
## [v0.3.11](https://github.com/soybeanjs/changelog/compare/v0.3.10...v0.3.11) (24-01-14)
87+
## [v0.3.11](https://github.com/soybeanjs/changelog/compare/v0.3.10...v0.3.11) (2024-01-14)
8888

8989
###    🐞 Bug Fixes
9090

@@ -94,7 +94,7 @@
9494

9595
[![honghuangdc](https://github.com/honghuangdc.png?size=48)](https://github.com/honghuangdc)  
9696

97-
## [v0.3.10](https://github.com/soybeanjs/changelog/compare/v0.3.9...v0.3.10) (24-01-14)
97+
## [v0.3.10](https://github.com/soybeanjs/changelog/compare/v0.3.9...v0.3.10) (2024-01-14)
9898

9999
###    🐞 Bug Fixes
100100

@@ -104,17 +104,29 @@
104104

105105
[![honghuangdc](https://github.com/honghuangdc.png?size=48)](https://github.com/honghuangdc)  
106106

107-
## [v0.3.9](https://github.com/soybeanjs/changelog/compare/v0.3.9-beta.3...v0.3.9) (24-01-14)
107+
## [v0.3.9](https://github.com/soybeanjs/changelog/compare/v0.3.8...v0.3.9) (2024-01-14)
108+
109+
###    🚀 Features
110+
111+
- **projects**:
112+
- use tsup replace unbuild &nbsp;-&nbsp; by @honghuangdc [<samp>(bf998)</samp>](https://github.com/soybeanjs/changelog/commit/bf99840)
113+
- the release content contain prerelease &nbsp;-&nbsp; by @honghuangdc [<samp>(40716)</samp>](https://github.com/soybeanjs/changelog/commit/40716c3)
114+
115+
### &nbsp;&nbsp;&nbsp;🐞 Bug Fixes
116+
117+
- **projects**: fix export &nbsp;-&nbsp; by @honghuangdc [<samp>(5b6a4)</samp>](https://github.com/soybeanjs/changelog/commit/5b6a4ab)
108118

109119
### &nbsp;&nbsp;&nbsp;🏡 Chore
110120

111-
- **deps**: update deps &nbsp;-&nbsp; by @honghuangdc [<samp>(c2cae)</samp>](https://github.com/soybeanjs/changelog/commit/c2cae28)
121+
- **deps**:
122+
- update deps &nbsp;-&nbsp; by @honghuangdc [<samp>(db919)</samp>](https://github.com/soybeanjs/changelog/commit/db91927)
123+
- update deps &nbsp;-&nbsp; by @honghuangdc [<samp>(c2cae)</samp>](https://github.com/soybeanjs/changelog/commit/c2cae28)
112124

113125
### &nbsp;&nbsp;&nbsp;❤️ Contributors
114126

115127
[![honghuangdc](https://github.com/honghuangdc.png?size=48)](https://github.com/honghuangdc)&nbsp;&nbsp;
116128

117-
## [v0.3.9-beta.3](https://github.com/soybeanjs/changelog/compare/v0.3.9-beta.2...v0.3.9-beta.3) (24-01-13)
129+
## [v0.3.9-beta.3](https://github.com/soybeanjs/changelog/compare/v0.3.9-beta.2...v0.3.9-beta.3) (2024-01-13)
118130

119131
### &nbsp;&nbsp;&nbsp;🐞 Bug Fixes
120132

@@ -124,7 +136,7 @@
124136

125137
[![honghuangdc](https://github.com/honghuangdc.png?size=48)](https://github.com/honghuangdc)&nbsp;&nbsp;
126138

127-
## [v0.3.9-beta.2](https://github.com/soybeanjs/changelog/compare/v0.3.9-beta.1...v0.3.9-beta.2) (24-01-13)
139+
## [v0.3.9-beta.2](https://github.com/soybeanjs/changelog/compare/v0.3.9-beta.1...v0.3.9-beta.2) (2024-01-13)
128140

129141
### &nbsp;&nbsp;&nbsp;🚀 Features
130142

@@ -134,7 +146,7 @@
134146

135147
[![honghuangdc](https://github.com/honghuangdc.png?size=48)](https://github.com/honghuangdc)&nbsp;&nbsp;
136148

137-
## [v0.3.9-beta.1](https://github.com/soybeanjs/changelog/compare/v0.3.9-beta.0...v0.3.9-beta.1) (24-01-13)
149+
## [v0.3.9-beta.1](https://github.com/soybeanjs/changelog/compare/v0.3.9-beta.0...v0.3.9-beta.1) (2024-01-13)
138150

139151
### &nbsp;&nbsp;&nbsp;🚀 Features
140152

@@ -144,7 +156,7 @@
144156

145157
[![honghuangdc](https://github.com/honghuangdc.png?size=48)](https://github.com/honghuangdc)&nbsp;&nbsp;
146158

147-
## [v0.3.9-beta.0](https://github.com/soybeanjs/changelog/compare/v0.3.8...v0.3.9-beta.0) (24-01-13)
159+
## [v0.3.9-beta.0](https://github.com/soybeanjs/changelog/compare/v0.3.8...v0.3.9-beta.0) (2024-01-13)
148160

149161
### &nbsp;&nbsp;&nbsp;🏡 Chore
150162

@@ -154,7 +166,7 @@
154166

155167
[![honghuangdc](https://github.com/honghuangdc.png?size=48)](https://github.com/honghuangdc)&nbsp;&nbsp;
156168

157-
## [v0.3.8](https://github.com/soybeanjs/changelog/compare/v0.3.7...v0.3.8) (23-12-10)
169+
## [v0.3.8](https://github.com/soybeanjs/changelog/compare/v0.3.7...v0.3.8) (2023-12-10)
158170

159171
### &nbsp;&nbsp;&nbsp;🐞 Bug Fixes
160172

@@ -164,7 +176,7 @@
164176

165177
[![honghuangdc](https://github.com/honghuangdc.png?size=48)](https://github.com/honghuangdc)&nbsp;&nbsp;
166178

167-
## [v0.3.7](https://github.com/soybeanjs/changelog/compare/v0.3.6...v0.3.7) (23-12-10)
179+
## [v0.3.7](https://github.com/soybeanjs/changelog/compare/v0.3.6...v0.3.7) (2023-12-10)
168180

169181
### &nbsp;&nbsp;&nbsp;🐞 Bug Fixes
170182

@@ -182,7 +194,7 @@
182194

183195
[![honghuangdc](https://github.com/honghuangdc.png?size=48)](https://github.com/honghuangdc)&nbsp;&nbsp;
184196

185-
## [v0.3.6](https://github.com/soybeanjs/changelog/compare/v0.3.5...v0.3.6) (23-12-10)
197+
## [v0.3.6](https://github.com/soybeanjs/changelog/compare/v0.3.5...v0.3.6) (2023-12-10)
186198

187199
### &nbsp;&nbsp;&nbsp;📖 Documentation
188200

@@ -192,7 +204,7 @@
192204

193205
[![honghuangdc](https://github.com/honghuangdc.png?size=48)](https://github.com/honghuangdc)&nbsp;&nbsp;
194206

195-
## [v0.3.5](https://github.com/soybeanjs/changelog/compare/v0.3.4...v0.3.5) (23-12-10)
207+
## [v0.3.5](https://github.com/soybeanjs/changelog/compare/v0.3.4...v0.3.5) (2023-12-10)
196208

197209
### &nbsp;&nbsp;&nbsp;🐞 Bug Fixes
198210

@@ -210,7 +222,7 @@
210222

211223
[![honghuangdc](https://github.com/honghuangdc.png?size=48)](https://github.com/honghuangdc)&nbsp;&nbsp;
212224

213-
## [v0.3.4](https://github.com/soybeanjs/changelog/compare/v0.3.3...v0.3.4) (23-08-23)
225+
## [v0.3.4](https://github.com/soybeanjs/changelog/compare/v0.3.3...v0.3.4) (2023-08-23)
214226

215227
### &nbsp;&nbsp;&nbsp;🐞 Bug Fixes
216228

@@ -220,7 +232,7 @@
220232

221233
[![honghuangdc](https://github.com/honghuangdc.png?size=48)](https://github.com/honghuangdc)&nbsp;&nbsp;
222234

223-
## [v0.3.3](https://github.com/soybeanjs/changelog/compare/v0.3.2...v0.3.3) (23-08-23)
235+
## [v0.3.3](https://github.com/soybeanjs/changelog/compare/v0.3.2...v0.3.3) (2023-08-23)
224236

225237
### &nbsp;&nbsp;&nbsp;🐞 Bug Fixes
226238

@@ -234,7 +246,7 @@
234246

235247
[![honghuangdc](https://github.com/honghuangdc.png?size=48)](https://github.com/honghuangdc)&nbsp;&nbsp;
236248

237-
## [v0.3.2](https://github.com/soybeanjs/changelog/compare/v0.3.1...v0.3.2) (23-08-23)
249+
## [v0.3.2](https://github.com/soybeanjs/changelog/compare/v0.3.1...v0.3.2) (2023-08-23)
238250

239251
### &nbsp;&nbsp;&nbsp;🏡 Chore
240252

@@ -244,7 +256,7 @@
244256

245257
[![honghuangdc](https://github.com/honghuangdc.png?size=48)](https://github.com/honghuangdc)&nbsp;&nbsp;
246258

247-
## [v0.3.1](https://github.com/soybeanjs/changelog/compare/v0.3.0...v0.3.1) (23-08-23)
259+
## [v0.3.1](https://github.com/soybeanjs/changelog/compare/v0.3.0...v0.3.1) (2023-08-23)
248260

249261
### &nbsp;&nbsp;&nbsp;🐞 Bug Fixes
250262

@@ -254,7 +266,7 @@
254266

255267
[![honghuangdc](https://github.com/honghuangdc.png?size=48)](https://github.com/honghuangdc)&nbsp;&nbsp;
256268

257-
## [v0.3.0](https://github.com/soybeanjs/changelog/compare/v0.0.7...v0.3.0) (23-08-23)
269+
## [v0.3.0](https://github.com/soybeanjs/changelog/compare/v0.0.7...v0.3.0) (2023-08-23)
258270

259271
### &nbsp;&nbsp;&nbsp;🐞 Bug Fixes
260272

@@ -268,7 +280,7 @@
268280

269281
[![honghuangdc](https://github.com/honghuangdc.png?size=48)](https://github.com/honghuangdc)&nbsp;&nbsp;
270282

271-
## [v0.0.7](https://github.com/soybeanjs/changelog/compare/v0.0.6...v0.0.7) (23-07-27)
283+
## [v0.0.7](https://github.com/soybeanjs/changelog/compare/v0.0.6...v0.0.7) (2023-07-27)
272284

273285
### &nbsp;&nbsp;&nbsp;🔥 Performance
274286

@@ -278,7 +290,7 @@
278290

279291
[![honghuangdc](https://github.com/honghuangdc.png?size=48)](https://github.com/honghuangdc)&nbsp;&nbsp;
280292

281-
## [v0.0.6](https://github.com/soybeanjs/changelog/compare/v0.0.5...v0.0.6) (23-07-27)
293+
## [v0.0.6](https://github.com/soybeanjs/changelog/compare/v0.0.5...v0.0.6) (2023-07-27)
282294

283295
### &nbsp;&nbsp;&nbsp;🐞 Bug Fixes
284296

@@ -288,7 +300,7 @@
288300

289301
[![honghuangdc](https://github.com/honghuangdc.png?size=48)](https://github.com/honghuangdc)&nbsp;&nbsp;
290302

291-
## [v0.0.5](https://github.com/soybeanjs/changelog/compare/v0.0.4...v0.0.5) (23-07-27)
303+
## [v0.0.5](https://github.com/soybeanjs/changelog/compare/v0.0.4...v0.0.5) (2023-07-27)
292304

293305
### &nbsp;&nbsp;&nbsp;🔥 Performance
294306

@@ -302,7 +314,7 @@
302314

303315
[![honghuangdc](https://github.com/honghuangdc.png?size=48)](https://github.com/honghuangdc)&nbsp;&nbsp;
304316

305-
## [v0.0.4](https://github.com/soybeanjs/changelog/compare/v0.0.3...main) (23-06-13)
317+
## [v0.0.4](https://github.com/soybeanjs/changelog/compare/v0.0.3...v0.0.4) (2023-06-13)
306318

307319
### &nbsp;&nbsp;&nbsp;🏡 Chore
308320

@@ -311,36 +323,32 @@
311323
### &nbsp;&nbsp;&nbsp;❤️ Contributors
312324

313325

314-
[Soybean](mailto:honghuangdc@gmail.com)
326+
[![honghuangdc](https://github.com/honghuangdc.png?size=48)](https://github.com/honghuangdc)&nbsp;&nbsp;
315327

316328
## [v0.0.3](https://github.com/soybeanjs/changelog/compare/v0.0.2...v0.0.3) (2023-06-12)
317329

318330
### &nbsp;&nbsp;&nbsp;🐞 Bug Fixes
319331

320-
- **projects**: fix version title &nbsp;-&nbsp; by @honghuangdc [<samp>(035df)</samp>](https://github.com/soybeanjs/changelog/commit/035df12)
332+
- **projects**: fix version title &nbsp;-&nbsp; by **Soybean** [<samp>(035df)</samp>](https://github.com/soybeanjs/changelog/commit/035df12)
321333

322334
### &nbsp;&nbsp;&nbsp;🏡 Chore
323335

324-
- **projects**:
325-
- update deps & update package.json &nbsp;-&nbsp; by @honghuangdc [<samp>(02330)</samp>](https://github.com/soybeanjs/changelog/commit/0233089)
326-
- release v0.0.3 &nbsp;-&nbsp; by @honghuangdc [<samp>(ed7fe)</samp>](https://github.com/soybeanjs/changelog/commit/ed7fe7e)
336+
- **projects**: update deps & update package.json &nbsp;-&nbsp; by **Soybean** [<samp>(02330)</samp>](https://github.com/soybeanjs/changelog/commit/0233089)
327337

328338
### &nbsp;&nbsp;&nbsp;❤️ Contributors
329339

340+
330341
[![honghuangdc](https://github.com/honghuangdc.png?size=48)](https://github.com/honghuangdc)&nbsp;&nbsp;
331342

332343
## [v0.0.2](https://github.com/soybeanjs/changelog/compare/v0.0.1...v0.0.2) (2023-06-07)
333344

334345
### &nbsp;&nbsp;&nbsp;🐞 Bug Fixes
335346

336-
- **projects**: fix when only one tag generate total changelog &nbsp;-&nbsp; by @honghuangdc [<samp>(6b878)</samp>](https://github.com/soybeanjs/changelog/commit/6b878e1)
337-
338-
### &nbsp;&nbsp;&nbsp;🏡 Chore
339-
340-
- **projects**: release v0.0.2 &nbsp;-&nbsp; by @honghuangdc [<samp>(13e14)</samp>](https://github.com/soybeanjs/changelog/commit/13e146f)
347+
- **projects**: fix when only one tag generate total changelog &nbsp;-&nbsp; by **Soybean** [<samp>(6b878)</samp>](https://github.com/soybeanjs/changelog/commit/6b878e1)
341348

342349
### &nbsp;&nbsp;&nbsp;❤️ Contributors
343350

351+
344352
[![honghuangdc](https://github.com/honghuangdc.png?size=48)](https://github.com/honghuangdc)&nbsp;&nbsp;
345353

346354

src/git.ts

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export async function getTotalGitTags() {
1111

1212
const tags = tagStr.split('\n');
1313

14-
return tags;
14+
return tags.filter(tag => VERSION_REG.test(tag));
1515
}
1616

1717
/** Get map of the git tag and date */
@@ -52,19 +52,31 @@ export async function getTagDateMap() {
5252
export function getFromToTags(tags: string[]) {
5353
const result: { from: string; to: string }[] = [];
5454

55-
tags.forEach((tag, index) => {
56-
if (index < tags.length - 1) {
57-
result.push({ from: tag, to: tags[index + 1] });
58-
}
59-
});
55+
if (tags.length < 2) {
56+
return result;
57+
}
6058

61-
return result;
62-
}
59+
const releaseTags = tags.filter(tag => !isPrerelease(tag));
60+
61+
const reversedTags = [...tags].reverse();
62+
63+
reversedTags.forEach((tag, index) => {
64+
if (index < reversedTags.length - 1) {
65+
const to = tag;
6366

64-
export async function getLastGitTag(delta = 0) {
65-
const tags = await getTotalGitTags();
67+
let from = reversedTags[index + 1];
68+
69+
if (!isPrerelease(to)) {
70+
const toIndex = releaseTags.indexOf(to);
71+
72+
from = releaseTags[toIndex - 1];
73+
}
74+
75+
result.push({ from, to });
76+
}
77+
});
6678

67-
return tags[tags.length + delta - 1];
79+
return result.reverse();
6880
}
6981

7082
async function getGitMainBranchName() {

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export async function getTotalChangelogMarkdown(options?: Partial<ChangelogOptio
8181
export async function generateChangelog(options?: Partial<ChangelogOption>) {
8282
const opts = await createOptions(options);
8383

84-
const existContent = await isVersionInMarkdown(opts.newVersion, opts.output);
84+
const existContent = await isVersionInMarkdown(opts.to, opts.output);
8585

8686
if (!opts.regenerate && existContent) return;
8787

src/markdown.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,12 @@ export function generateMarkdown(params: {
151151

152152
const lines: string[] = [];
153153

154-
const url = `https://github.com/${options.github.repo}/compare/${options.from}...${options.newVersion}`;
154+
const url = `https://github.com/${options.github.repo}/compare/${options.from}...${options.to}`;
155155

156156
if (showTitle) {
157-
const date = options.tagDateMap.get(options.newVersion) || dayjs().format('YY-MM-DD');
157+
const date = options.tagDateMap.get(options.to) || dayjs().format('YYYY-MM-DD');
158158

159-
let title = `## [${options.newVersion}](${url})`;
159+
let title = `## [${options.to}](${url})`;
160160

161161
if (date) {
162162
title += ` (${date})`;

0 commit comments

Comments
 (0)