Skip to content

Commit 81ebfa3

Browse files
committed
Always apply aliasing
1 parent 67da4d6 commit 81ebfa3

3 files changed

Lines changed: 12 additions & 6 deletions

File tree

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Next
44
- Updated resource pack format to `34`.
55
- Updated data pack format to `48`.
6+
- Fixed special case checking not being applied to full version names leading to no result for certain versions.
67

78
## 1.3.15
89
*2024-05-12*

src/index.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,16 @@ const LATEST = { resource: maxFormat('resource'), data: maxFormat('data') };
106106
*/
107107
function getPackFormat(version: string, type: PackType = 'resource'): FormatResult {
108108
if (!version) return undefined
109-
version = version.toString().toLowerCase().trim()
109+
110+
// Prepare version string for comparison
111+
version = version
112+
.toString()
113+
.trim()
114+
.toLowerCase()
115+
// Aliasing
116+
.replace(/-? *pre[- ]?(release)? */, '-pre')
117+
.replace(/ *release candidate */, '-rc')
118+
.replace(/ *experimental *snapshot|-es/, '-exp')
110119

111120
// Special //
112121
for (const format in SPECIAL[type]) {
@@ -126,11 +135,6 @@ function getPackFormat(version: string, type: PackType = 'resource'): FormatResu
126135

127136
// Release //
128137

129-
version = version
130-
.replace(/-? *pre[- ]?(release)? */, '-pre')
131-
.replace(/ *release candidate */, '-rc')
132-
.replace(/ *experimental *snapshot|-es/, '-exp')
133-
134138
if (version.includes('-')) {
135139
// Special cases for specific development versions
136140
if (version.includes('1.16.2-pre')) return 5

test/pack-formats-tests.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ Types:
7171
"1.20.5-rc1" (r) 32
7272
"1.20.5-rc1" (d) 41
7373
"1.21-pre1" (r) 34
74+
"1.21 pre-release 1" (r) 34
7475
"1.21-pre1" (d) 46
7576
"1.21-pre2" (d) 47
7677
"1.21-pre3" (d) 48

0 commit comments

Comments
 (0)