File tree 3 files changed +27
-1
lines changed
3 files changed +27
-1
lines changed Original file line number Diff line number Diff line change 1
1
# Changelog
2
2
3
+ ## [ 16.1.3] (melonJS 2) - _ 2024-02-13_
4
+
5
+ ### Fixed
6
+ - Loader: fix a regression with TMX map loading related to a semver version comparaison (` compare() ` requires a "x.y.z" version format)
7
+
3
8
## [ 16.1.2] (melonJS 2) - _ 2024-02-12_
4
9
5
10
### Fixed
747
752
748
753
-------------------------------------------------------------------------------
749
754
750
- [ 16.1.0 ] : https://github.com/melonjs/melonJS/compare/16.1.1...16.1.2
755
+ [ 16.1.3 ] : https://github.com/melonjs/melonJS/compare/16.1.2...16.1.3
756
+ [ 16.1.2 ] : https://github.com/melonjs/melonJS/compare/16.1.1...16.1.2
751
757
[ 16.1.1 ] : https://github.com/melonjs/melonJS/compare/16.2.0...16.1.1
752
758
[ 16.1.0 ] : https://github.com/melonjs/melonJS/compare/16.0.0...16.1.0
753
759
[ 16.0.0 ] : https://github.com/melonjs/melonJS/compare/15.15.0...16.0.0
Original file line number Diff line number Diff line change @@ -33,6 +33,17 @@ let GUID_index = 0;
33
33
* }
34
34
*/
35
35
export function checkVersion ( v1 , v2 ) {
36
+ // Convert to proper "x.y.z" format if necessary
37
+ if ( / ^ \d + $ / . test ( v1 ) ) {
38
+ v1 += ".0.0" ;
39
+ } else if ( / ^ \d + \. \d + $ / . test ( v1 ) ) {
40
+ v1 += ".0" ;
41
+ }
42
+ if ( / ^ \d + $ / . test ( v2 ) ) {
43
+ v2 += ".0.0" ;
44
+ } else if ( / ^ \d + \. \d + $ / . test ( v2 ) ) {
45
+ v2 += ".0" ;
46
+ }
36
47
return compare ( v1 , v2 ) ;
37
48
}
38
49
Original file line number Diff line number Diff line change @@ -165,9 +165,18 @@ describe("utils", function () {
165
165
// < 0 if the second string is greater
166
166
// === 0 if the strings are equal
167
167
expect ( me . utils . checkVersion ( "15.13.0" , "15.12.0" ) > 0 ) . toEqual ( true ) ;
168
+ expect ( me . utils . checkVersion ( "15.13" , "15.12.0" ) > 0 ) . toEqual ( true ) ;
169
+ expect ( me . utils . checkVersion ( "16" , "15.12.0" ) > 0 ) . toEqual ( true ) ;
170
+ expect ( me . utils . checkVersion ( "16" , "15" ) > 0 ) . toEqual ( true ) ;
168
171
expect ( me . utils . checkVersion ( "7.0.0" , "15.5.0" ) < 0 ) . toEqual ( true ) ;
169
172
expect ( me . utils . checkVersion ( "15.12.0" , "15.12.0" ) === 0 ) . toEqual ( true ) ;
173
+ expect ( me . utils . checkVersion ( "15.12.0" , "15.12" ) === 0 ) . toEqual ( true ) ;
174
+ expect ( me . utils . checkVersion ( "15.0.0" , "15.0" ) === 0 ) . toEqual ( true ) ;
175
+ expect ( me . utils . checkVersion ( "15.0.0" , "15" ) === 0 ) . toEqual ( true ) ;
170
176
expect ( me . utils . checkVersion ( "15.12.1" , "16.1.1" ) < 0 ) . toEqual ( true ) ;
177
+ expect ( me . utils . checkVersion ( "15.12.1" , "16.1" ) < 0 ) . toEqual ( true ) ;
178
+ expect ( me . utils . checkVersion ( "15.12.1" , "16" ) < 0 ) . toEqual ( true ) ;
179
+ expect ( me . utils . checkVersion ( "15" , "16" ) < 0 ) . toEqual ( true ) ;
171
180
} ) ;
172
181
} ) ;
173
182
} ) ;
You can’t perform that action at this time.
0 commit comments