Skip to content

Commit 4a57df7

Browse files
committed
Treat suffixed version numbers ass pre release and less than unsuffixed version numbers
1 parent b8b455b commit 4a57df7

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/util/version.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ describe('Compare', () => {
4141
['v1.0', '1', 0],
4242
['v1.0', '1.0', 0],
4343
['1.01-beta', '1.1-beta', 0],
44-
['1.1', '1.1-beta', -1],
44+
['1.1', '1.1-beta', 1],
45+
['1.1-pre-release', '1.1', -1],
4546
['1.10', '1.10.3', -1],
4647
['1.2', '1.10', -1],
4748
['1.5', '1.2', 1],

src/util/version.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ export default class Version {
4747
return 1;
4848
} else if ((a.build || 0) < (b.build || 0)) {
4949
return -1;
50+
} else if (!a.suffix && b.suffix) {
51+
return 1;
52+
} else if (a.suffix && !b.suffix) {
53+
return -1;
5054
} else if ((a.suffix || '') > (b.suffix || '')) {
5155
return 1;
5256
} else if ((a.suffix || '') < (b.suffix || '')) {

0 commit comments

Comments
 (0)