Skip to content

Commit 60012d6

Browse files
jelmore1674Gitea
authored andcommitted
fix version sorting (#64)
Cloes #63 Reviewed-on: https://git.justinelmore.dev/jelmore1674/build-changelog/pulls/64 Co-authored-by: Justin Elmore <[email protected]> Co-committed-by: Justin Elmore <[email protected]>
1 parent 0002d29 commit 60012d6

File tree

6 files changed

+18
-5
lines changed

6 files changed

+18
-5
lines changed

changelog/sort.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: 1.4.1
2+
release_date: 2025-01-02
3+
author: Justin Elmore
4+
5+
fixed:
6+
bug:
7+
- Resolve sorting versions when minor or patch version is greater than single digits.
8+
9+
references:
10+
- type: issue
11+
reference: 63
12+
- type: pull_request
13+
reference: 64

generate/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

notes/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jelmore1674/build-changelog",
3-
"version": "1.4.0",
3+
"version": "1.4.1",
44
"description": "",
55
"main": "dist/index.js",
66
"files": [

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const program = new Command();
1010
program
1111
.name("build-changelog")
1212
.description("cli tool to generate changelogs")
13-
.version("1.4.0");
13+
.version("1.4.1");
1414

1515
program
1616
.command("init")

src/lib/generate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ function generateCommand() {
228228
}
229229

230230
// Sort the changelog by the version.
231-
return acc.sort((a, b) => b.version.localeCompare(a.version));
231+
return acc.sort((a, b) => b.version.localeCompare(a.version, "en-US", { ignorePunctuation: true, numeric: true }));
232232
}, changelogArchive);
233233

234234
if (config.changelog_archive) {

0 commit comments

Comments
 (0)