diff options
author | Rhys Arkins <[email protected]> | 2024-02-18 09:52:03 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2024-02-18 08:52:03 +0000 |
commit | 2f1f11a872b9b6ff06c627b3ff0199e97911a6ff (patch) | |
tree | e62b37abb8d1486f4004a214715e1a56710b2e09 | |
parent | 7b7a0b1ee90b0bd40993210879c8a88d5f448299 (diff) | |
download | renovate-37.194.4.tar.gz renovate-37.194.4.zip |
fix(lookup): try to match against allVersions first (#27383)37.194.4
-rw-r--r-- | lib/workers/repository/process/lookup/current.ts | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/lib/workers/repository/process/lookup/current.ts b/lib/workers/repository/process/lookup/current.ts index 96fa560d51a..31de0bbdbe7 100644 --- a/lib/workers/repository/process/lookup/current.ts +++ b/lib/workers/repository/process/lookup/current.ts @@ -15,12 +15,6 @@ export function getCurrentVersion( if (!is.string(currentValue)) { return null; } - if (versioning.isVersion(currentValue)) { - return currentValue; - } - if (versioning.isSingleVersion(currentValue)) { - return currentValue.replace(regEx(/=/g), '').trim(); - } logger.trace(`currentValue ${currentValue} is range`); let useVersions = allVersions.filter((v) => versioning.matches(v, currentValue), @@ -41,5 +35,20 @@ export function getCurrentVersion( return versioning.minSatisfyingVersion(useVersions, currentValue); } // Use the highest version in the current range - return versioning.getSatisfyingVersion(useVersions, currentValue); + const satisfyingVersion = versioning.getSatisfyingVersion( + useVersions, + currentValue, + ); + if (satisfyingVersion) { + return satisfyingVersion; + } + + if (versioning.isVersion(currentValue)) { + return currentValue; + } + if (versioning.isSingleVersion(currentValue)) { + return currentValue.replace(regEx(/=/g), '').trim(); + } + + return null; } |