Skip to content

Commit 1ab3cd5

Browse files
committed
docs: fix changelog gen
1 parent ebfe91e commit 1ab3cd5

File tree

2 files changed

+101
-28
lines changed

2 files changed

+101
-28
lines changed

CHANGELOG.md

Lines changed: 66 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,108 @@
11

2-
# Release [v2.1.1](https://github.com/josh-hemphill/maxminddb-wasm/releases/tag/v2.1.1)
2+
# Release [v2.1.0](https://github.com/josh-hemphill/maxminddb-wasm/releases/tag/v2.1.0)
33

4-
undefined
4+
###    📚 Documentation
55

6+
- 📝 JSDoc comments &nbsp;-&nbsp; by **josh-hemphill** [<samp>(6621d)</samp>](https://github.com/josh-hemphill/maxminddb-wasm/commit/6621d95)
67

8+
### &nbsp;&nbsp;&nbsp;🧰 Miscellaneous
79

8-
# Release [v2.1.0](https://github.com/josh-hemphill/maxminddb-wasm/releases/tag/v2.1.0)
10+
- Release v2.1.1 &nbsp;-&nbsp; by **josh-hemphill** [<samp>(fe840)</samp>](https://github.com/josh-hemphill/maxminddb-wasm/commit/fe84035)
911

10-
undefined
12+
##### &nbsp;&nbsp;&nbsp;&nbsp;[View changes on GitHub](https://github.com/josh-hemphill/maxminddb-wasm/compare/v2.1.1...v2.1.0)
1113

14+
# Release [v2.0.3](https://github.com/josh-hemphill/maxminddb-wasm/releases/tag/v2.0.3)
1215

16+
### &nbsp;&nbsp;&nbsp;🚀 Features
1317

14-
# Release [v2.0.3](https://github.com/josh-hemphill/maxminddb-wasm/releases/tag/v2.0.3)
18+
- Add subdivisions support &nbsp;-&nbsp; by **josh-hemphill** [<samp>(edce3)</samp>](https://github.com/josh-hemphill/maxminddb-wasm/commit/edce377)
1519

16-
undefined
20+
### &nbsp;&nbsp;&nbsp;🧰 Miscellaneous
1721

22+
- Upgrade maxminddb to 0.26.0 &nbsp;-&nbsp; by **josh-hemphill** [<samp>(6bca5)</samp>](https://github.com/josh-hemphill/maxminddb-wasm/commit/6bca5e7)
23+
- ⬆️ update serde & spin and fix text formatting &nbsp;-&nbsp; by **josh-hemphill** [<samp>(24fd8)</samp>](https://github.com/josh-hemphill/maxminddb-wasm/commit/24fd87c)
24+
- Test dependency fix &nbsp;-&nbsp; by **josh-hemphill** [<samp>(879f8)</samp>](https://github.com/josh-hemphill/maxminddb-wasm/commit/879f8ad)
25+
- Release v2.1.0 &nbsp;-&nbsp; by **josh-hemphill** [<samp>(89cf4)</samp>](https://github.com/josh-hemphill/maxminddb-wasm/commit/89cf469)
1826

27+
##### &nbsp;&nbsp;&nbsp;&nbsp;[View changes on GitHub](https://github.com/josh-hemphill/maxminddb-wasm/compare/v2.1.0...v2.0.3)
1928

2029
# Release [v2.0.2](https://github.com/josh-hemphill/maxminddb-wasm/releases/tag/v2.0.2)
2130

22-
undefined
31+
### &nbsp;&nbsp;&nbsp;🧰 Miscellaneous
2332

33+
- Another release fix &nbsp;-&nbsp; by **josh-hemphill** [<samp>(3899e)</samp>](https://github.com/josh-hemphill/maxminddb-wasm/commit/3899eed)
34+
- Release v2.0.3 &nbsp;-&nbsp; by **josh-hemphill** [<samp>(2f24f)</samp>](https://github.com/josh-hemphill/maxminddb-wasm/commit/2f24f96)
2435

36+
##### &nbsp;&nbsp;&nbsp;&nbsp;[View changes on GitHub](https://github.com/josh-hemphill/maxminddb-wasm/compare/v2.0.3...v2.0.2)
2537

2638
# Release [v2.0.1](https://github.com/josh-hemphill/maxminddb-wasm/releases/tag/v2.0.1)
2739

28-
undefined
40+
### &nbsp;&nbsp;&nbsp;🧰 Miscellaneous
2941

42+
- 🚀 fix release automation &nbsp;-&nbsp; by **josh-hemphill** [<samp>(f4fd3)</samp>](https://github.com/josh-hemphill/maxminddb-wasm/commit/f4fd370)
43+
- Release v2.0.2 &nbsp;-&nbsp; by **josh-hemphill** [<samp>(3c9b8)</samp>](https://github.com/josh-hemphill/maxminddb-wasm/commit/3c9b87a)
3044

45+
##### &nbsp;&nbsp;&nbsp;&nbsp;[View changes on GitHub](https://github.com/josh-hemphill/maxminddb-wasm/compare/v2.0.2...v2.0.1)
3146

3247
# Release [v2.0.0](https://github.com/josh-hemphill/maxminddb-wasm/releases/tag/v2.0.0)
3348

34-
undefined
49+
### &nbsp;&nbsp;&nbsp;🧰 Miscellaneous
3550

51+
- Fix release files &nbsp;-&nbsp; by **josh-hemphill** [<samp>(feb90)</samp>](https://github.com/josh-hemphill/maxminddb-wasm/commit/feb9059)
52+
- Release v2.0.1 &nbsp;-&nbsp; by **josh-hemphill** [<samp>(034b8)</samp>](https://github.com/josh-hemphill/maxminddb-wasm/commit/034b8be)
3653

54+
##### &nbsp;&nbsp;&nbsp;&nbsp;[View changes on GitHub](https://github.com/josh-hemphill/maxminddb-wasm/compare/v2.0.1...v2.0.0)
3755

3856
# Release [v1.2.0](https://github.com/josh-hemphill/maxminddb-wasm/releases/tag/v1.2.0)
3957

40-
undefined
58+
### &nbsp;&nbsp;&nbsp;🚨 Breaking Changes
59+
60+
- ✨ rework build and ci &nbsp;-&nbsp; by **josh-hemphill** [<samp>(d7028)</samp>](https://github.com/josh-hemphill/maxminddb-wasm/commit/d7028df)
61+
62+
### &nbsp;&nbsp;&nbsp;🚀 Features
63+
64+
- ✨ major rework &nbsp;-&nbsp; by **josh-hemphill** [<samp>(a7bdc)</samp>](https://github.com/josh-hemphill/maxminddb-wasm/commit/a7bdcfc)
65+
66+
### &nbsp;&nbsp;&nbsp;🔄 Refactor
67+
68+
- 🏷️ clean up unused types and fix ci &nbsp;-&nbsp; by **josh-hemphill** [<samp>(d998d)</samp>](https://github.com/josh-hemphill/maxminddb-wasm/commit/d998dc6)
4169

70+
### &nbsp;&nbsp;&nbsp;🔄 Build
4271

72+
- 🐛 lockfile should be committed &nbsp;-&nbsp; by **josh-hemphill** [<samp>(56f3a)</samp>](https://github.com/josh-hemphill/maxminddb-wasm/commit/56f3a35)
73+
- JSR type annotation &nbsp;-&nbsp; by **josh-hemphill** [<samp>(71087)</samp>](https://github.com/josh-hemphill/maxminddb-wasm/commit/71087b5)
74+
75+
### &nbsp;&nbsp;&nbsp;🧰 Miscellaneous
76+
77+
- Release v2.0.0 &nbsp;-&nbsp; by **josh-hemphill** [<samp>(ec8f2)</samp>](https://github.com/josh-hemphill/maxminddb-wasm/commit/ec8f2e5)
78+
79+
##### &nbsp;&nbsp;&nbsp;&nbsp;[View changes on GitHub](https://github.com/josh-hemphill/maxminddb-wasm/compare/v2.0.0...v1.2.0)
4380

4481
# Release [v1.1.0](https://github.com/josh-hemphill/maxminddb-wasm/releases/tag/v1.1.0)
4582

46-
undefined
83+
### &nbsp;&nbsp;&nbsp;🚀 Features
84+
85+
- ♻️ Changing to JSON serialization &nbsp;-&nbsp; by **josh-hemphill** [<samp>(7b154)</samp>](https://github.com/josh-hemphill/maxminddb-wasm/commit/7b1543a)
86+
87+
### &nbsp;&nbsp;&nbsp;📚 Documentation
4788

89+
- 📝 fix readme link &nbsp;-&nbsp; by **josh-hemphill** [<samp>(bcc47)</samp>](https://github.com/josh-hemphill/maxminddb-wasm/commit/bcc47e1)
4890

91+
### &nbsp;&nbsp;&nbsp;🧰 Miscellaneous
92+
93+
- **release**: 1.2.0 [skip ci] &nbsp;-&nbsp; by **semantic-release-bot** [<samp>(31902)</samp>](https://github.com/josh-hemphill/maxminddb-wasm/commit/319021a)
94+
95+
##### &nbsp;&nbsp;&nbsp;&nbsp;[View changes on GitHub](https://github.com/josh-hemphill/maxminddb-wasm/compare/v1.2.0...v1.1.0)
4996

5097
# Release [v1.0.0](https://github.com/josh-hemphill/maxminddb-wasm/releases/tag/v1.0.0)
5198

52-
undefined
99+
### &nbsp;&nbsp;&nbsp;🚀 Features
100+
101+
- ✨ Get Metadata from database &nbsp;-&nbsp; by **josh-hemphill** [<samp>(ef3df)</samp>](https://github.com/josh-hemphill/maxminddb-wasm/commit/ef3dfe8)
102+
103+
### &nbsp;&nbsp;&nbsp;🧰 Miscellaneous
53104

105+
- Minor ci and readme changes &nbsp;-&nbsp; by **josh-hemphill** [<samp>(781d7)</samp>](https://github.com/josh-hemphill/maxminddb-wasm/commit/781d788)
106+
- **release**: 1.1.0 [skip ci] &nbsp;-&nbsp; by **semantic-release-bot** [<samp>(ed2f2)</samp>](https://github.com/josh-hemphill/maxminddb-wasm/commit/ed2f290)
54107

108+
##### &nbsp;&nbsp;&nbsp;&nbsp;[View changes on GitHub](https://github.com/josh-hemphill/maxminddb-wasm/compare/v1.1.0...v1.0.0)

scripts/changelog.ts

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env zx
22

33
import 'zx/globals'
4-
import { generate } from 'changelogithub'
4+
import { generate, generateMarkdown, resolveConfig } from 'changelogithub'
55
const args = minimist(process.argv.slice(2), {
66
boolean: [
77
'recreateChangelog',
@@ -11,37 +11,56 @@ const args = minimist(process.argv.slice(2), {
1111
},
1212
})
1313

14+
async function _generateChangelog(from: string, to: string) {
15+
try {
16+
const { commits } = await generate({ from, to })
17+
const config = await resolveConfig({ from, to })
18+
const md = generateMarkdown(commits, config)
19+
return md
20+
}
21+
catch (err) {
22+
console.error(err)
23+
return ''
24+
}
25+
}
26+
27+
async function getTags() {
28+
const tags = await $`git tag --sort=-version:refname -l v*`.nothrow()
29+
if (tags.exitCode !== 0) {
30+
console.error('No tags found')
31+
process.exit(1)
32+
}
33+
return tags.stdout
34+
.trim()
35+
.split('\n')
36+
.map((version, i, arr) => ({ version, i, prev: arr[i - 1] }))
37+
.filter(({ version, prev }) => prev && version !== prev);
38+
}
39+
1440
const run = async () => {
1541
try {
1642
if (!(args.recreateChangelog || args.r)) {
1743
console.log('Updating changelog')
18-
const { md } = await generate({})
44+
const [to] = await getTags();
45+
const md = await _generateChangelog(to.prev, to.version)
1946
const changelog = await fs.readFile('CHANGELOG.md', 'utf8')
2047
await fs.writeFile('CHANGELOG.md', `${md}\n\n${changelog}`)
2148
return;
2249
}
2350

2451
console.log('Recreating changelog')
25-
const tags = await $`git tag --sort=-version:refname -l v*`.nothrow()
26-
if (tags.exitCode !== 0) {
27-
console.error('No tags found')
28-
process.exit(1)
29-
}
52+
3053
let changelog = ''
31-
for (const tag of tags.stdout
32-
.trim()
33-
.split('\n')
34-
.map((version, i, arr) => ({ version, i, prev: arr[i - 1] }))
35-
.filter(({ version, prev }) => prev && version !== prev)) {
54+
for (const tag of await getTags()) {
3655
console.log(`Generating changelog between ${tag.prev} and ${tag.version}`)
37-
const { md } = await generate({ from: tag.version, to: tag.prev })
38-
changelog += `
56+
const md = await _generateChangelog(tag.prev, tag.version)
57+
if (md) {
58+
changelog += `
3959
# Release [${tag.version}](https://github.com/josh-hemphill/maxminddb-wasm/releases/tag/${tag.version})
4060
4161
${md}
42-
43-
4462
`
63+
}
4564
}
4665
await fs.writeFile('CHANGELOG.md', changelog)
4766
}

0 commit comments

Comments
 (0)