aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRhys Arkins <[email protected]>2024-02-18 09:52:03 +0100
committerGitHub <[email protected]>2024-02-18 08:52:03 +0000
commit2f1f11a872b9b6ff06c627b3ff0199e97911a6ff (patch)
treee62b37abb8d1486f4004a214715e1a56710b2e09
parent7b7a0b1ee90b0bd40993210879c8a88d5f448299 (diff)
downloadrenovate-2f1f11a872b9b6ff06c627b3ff0199e97911a6ff.tar.gz
renovate-2f1f11a872b9b6ff06c627b3ff0199e97911a6ff.zip
fix(lookup): try to match against allVersions first (#27383)37.194.4
-rw-r--r--lib/workers/repository/process/lookup/current.ts23
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;
}