Skip to content

Commit f806141

Browse files
authored
Add support for matching -ea version formats
This will support specifying EA versions in the following format examples. E.g.: 14-ea 14.0.0-ea 14.0.0-ea.28 Notes: - For the last form above, which is needed for requesting a specific ea build, we must only add '.x' if there are less than 3 dots in the version, hence the change from != 3 to < 3 - The prior parsing logic for e.g. 14.0.0-ea "spelling" will ignore precedence between build numbers in the form of e.g. 14.0.0-ea+b27 vs. 14.0.0-ea+b27 (so it will end up with the earliest rather than the latest ea build in the cdn), and does not allow specifying an ea build number (it will match 14.0.0-ea+b29 to a cdn 14.0.0-ea+b2). The new logic [copupled with the CDN populating EA builds in the form 14.0.0-ea.28) will resolve that.
1 parent d8ada52 commit f806141

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

src/installer.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,12 +266,21 @@ function normalizeVersion(version: string): string {
266266
}
267267
}
268268

269-
// Add trailing .x if it is missing
270-
if (version.split('.').length != 3) {
269+
if (version.endsWith('-ea')) {
270+
// convert e.g. 14-ea to 14.0.0-ea
271+
if (version.indexOf('.') == -1) {
272+
version = version.slice(0, version.length - 3) + '.0.0-ea';
273+
}
274+
// match anything in -ea.X (semver won't do .x matching on pre-release versions)
275+
if (version[0] >= '0' && version[0] <= '9') {
276+
version = '>=' + version;
277+
}
278+
} else if (version.split('.').length < 3) {
279+
// For non-ea versions, add trailing .x if it is missing
271280
if (version[version.length - 1] != 'x') {
272281
version = version + '.x';
273282
}
274283
}
275-
284+
276285
return version;
277286
}

0 commit comments

Comments
 (0)