Skip to content
Snippets Groups Projects
Commit bc652673 authored by Rhys Arkins's avatar Rhys Arkins
Browse files

fix: properly handle null rollback

parent c2c50222
No related merge requests found
......@@ -77,7 +77,16 @@ async function lookupUpdates(config) {
);
const updates = [];
if (!allSatisfyingVersions.length) {
updates.push(getRollbackUpdate(config, allVersions));
const rollback = getRollbackUpdate(config, allVersions);
if (!rollback) {
return [
{
type: 'warning',
message: `Can't find version matching ${currentValue} for ${depName}`,
},
];
}
updates.push(rollback);
}
const rangeStrategy = getRangeStrategy(config);
const fromVersion = getFromVersion(config, rangeStrategy, allVersions);
......
......@@ -15,7 +15,7 @@ function getRollbackUpdate(config, versions) {
{ versionScheme },
'Current version scheme does not support isLessThanRange()'
);
return [];
return null;
}
const lessThanVersions = versions.filter(version =>
isLessThanRange(version, currentValue)
......@@ -26,7 +26,7 @@ function getRollbackUpdate(config, versions) {
{ packageFile, depName, currentValue },
'Missing version has nothing to roll back to'
);
return [];
return null;
}
logger.info(
{ packageFile, depName, currentValue },
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment