Skip to content

Commit 40f6acb

Browse files
committed
fix(changelog-parser): tolerate lazy people who omit the patch number from some versions in the changelog
1 parent a45d628 commit 40f6acb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/changelog-parser.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// @flow
22

3-
const versionRx = `v?\\d+\\.\\d+\\.\\d+(-[-a-z0-9.]+)?`
3+
const versionRx = `v?\\d+\\.\\d+(\\.\\d+(-[-a-z0-9.]+)?)?`
44

55
export type Release = {
66
version: string,
@@ -20,7 +20,8 @@ export default function parseChangelog(text: string): { [string]: Release } {
2020
let release: ?Release
2121
while ((match = versionHeaderRx.exec(text))) {
2222
// console.log(match)
23-
const version = match[1] || match[4]
23+
let version = match[1] || match[5]
24+
if (!match[2] && !match[6]) version += '.0'
2425
if (release) release.body = text.substring(start, match.index).trim()
2526
release = { version }
2627
result[version] = release

0 commit comments

Comments
 (0)