updated regex to support early version

This commit is contained in:
mahabaleshwars 2024-03-07 22:03:52 +05:30
parent c2eed4c7f8
commit d6dce30547
3 changed files with 3 additions and 3 deletions

View File

@ -87891,7 +87891,7 @@ function getVersionFromFileContent(content, distributionName, versionFile) {
var _a, _b, _c, _d, _e;
let javaVersionRegExp;
if (versionFile == '.tool-versions') {
javaVersionRegExp = /^java\s+(?:\S+-)?v?(?<version>[^\s]+)$/m;
javaVersionRegExp = /^java\s+(?:\S+-)?v?(?<version>[^\s]+(?:[-+]\S+)?)$/m;
}
else if (versionFile == '.java-version') {
javaVersionRegExp = /(?<version>(?<=(^|\s|-))(\d+\S*))(\s|$)/;

2
dist/setup/index.js vendored
View File

@ -125265,7 +125265,7 @@ function getVersionFromFileContent(content, distributionName, versionFile) {
var _a, _b, _c, _d, _e;
let javaVersionRegExp;
if (versionFile == '.tool-versions') {
javaVersionRegExp = /^java\s+(?:\S+-)?v?(?<version>[^\s]+)$/m;
javaVersionRegExp = /^java\s+(?:\S+-)?v?(?<version>[^\s]+(?:[-+]\S+)?)$/m;
}
else if (versionFile == '.java-version') {
javaVersionRegExp = /(?<version>(?<=(^|\s|-))(\d+\S*))(\s|$)/;

View File

@ -120,7 +120,7 @@ export function getVersionFromFileContent(
): string | null {
let javaVersionRegExp: RegExp;
if (versionFile == '.tool-versions') {
javaVersionRegExp = /^java\s+(?:\S+-)?v?(?<version>[^\s]+)$/m;
javaVersionRegExp = /^java\s+(?:\S+-)?v?(?<version>[^\s]+(?:[-+]\S+)?)$/m;
} else if (versionFile == '.java-version') {
javaVersionRegExp = /(?<version>(?<=(^|\s|-))(\d+\S*))(\s|$)/;
} else {