fix: check currentValue before generating newValue

This commit is contained in:
Rhys Arkins 2021-11-24 14:28:50 +01:00
parent f6454ba1a7
commit bb64598d6a

View file

@ -32,19 +32,21 @@ export function generateUpdate(
}
}
const { currentValue } = config;
try {
update.newValue = versioning.getNewValue({
currentValue,
rangeStrategy,
currentVersion,
newVersion,
});
} catch (err) /* istanbul ignore next */ {
logger.warn(
{ err, currentValue, rangeStrategy, currentVersion, newVersion },
'getNewValue error'
);
update.newValue = currentValue;
if (currentValue) {
try {
update.newValue = versioning.getNewValue({
currentValue,
rangeStrategy,
currentVersion,
newVersion,
});
} catch (err) /* istanbul ignore next */ {
logger.warn(
{ err, currentValue, rangeStrategy, currentVersion, newVersion },
'getNewValue error'
);
update.newValue = currentValue;
}
}
update.newMajor = versioning.getMajor(newVersion);
update.newMinor = versioning.getMinor(newVersion);