diff --git a/run-ios-simulator/dist/index.js b/run-ios-simulator/dist/index.js index aa7d701..dc2471a 100644 --- a/run-ios-simulator/dist/index.js +++ b/run-ios-simulator/dist/index.js @@ -7495,14 +7495,13 @@ function getNewestRuntime(runtimes, os) { } function isRuntimeNewer(first, second) { const extractVersion = (runtime) => { - if (semver.valid(runtime)) { - return runtime; - } - const extractedSemver = runtime.split(" ").pop(); - if (!semver.valid(extractedSemver)) { + let extractedVersion = runtime.split(" ").pop(); + const components = extractedVersion.split(".").length; + extractedVersion = extractedVersion.concat(...Array.from({ length: 3 - components }, _ => ".0")); + if (!semver.valid(extractedVersion)) { throw new Error(`Couldn't extract version for runtime ${runtime}`); } - return extractedSemver; + return extractedVersion; }; return semver.gt(extractVersion(first), extractVersion(second)); } diff --git a/run-ios-simulator/src/main.ts b/run-ios-simulator/src/main.ts index 376febf..06117aa 100644 --- a/run-ios-simulator/src/main.ts +++ b/run-ios-simulator/src/main.ts @@ -71,16 +71,15 @@ function getNewestRuntime(runtimes: string, os: string): { runtime: string; runt function isRuntimeNewer(first: string, second: string): boolean { const extractVersion = (runtime: string): string => { - if (semver.valid(runtime)) { - return runtime; - } + let extractedVersion = runtime.split(" ").pop()!; + const components = extractedVersion.split(".").length; + extractedVersion = extractedVersion.concat(...Array.from({ length: 3 - components}, _ => ".0")); - const extractedSemver = runtime.split(" ").pop(); - if (!semver.valid(extractedSemver)) { + if (!semver.valid(extractedVersion)) { throw new Error(`Couldn't extract version for runtime ${runtime}`); } - return extractedSemver!; + return extractedVersion; }; return semver.gt(extractVersion(first), extractVersion(second));