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

refactor: newValue => toVersions

parent 7bc255cc
No related merge requests found
......@@ -13,22 +13,22 @@ function generateBranchConfig(branchUpgrades) {
logger.debug(`hasGroupName: ${hasGroupName}`);
// Use group settings only if multiple upgrades or lazy grouping is disabled
const depNames = [];
const newValue = [];
const toVersions = [];
branchUpgrades.forEach(upg => {
if (!depNames.includes(upg.depName)) {
depNames.push(upg.depName);
}
if (!newValue.includes(upg.toVersion)) {
newValue.push(upg.toVersion);
if (!toVersions.includes(upg.toVersion)) {
toVersions.push(upg.toVersion);
}
});
const groupEligible =
depNames.length > 1 ||
newValue.length > 1 ||
toVersions.length > 1 ||
branchUpgrades[0].lazyGrouping === false;
if (branchUpgrades.length > 1 && !groupEligible) {
// eslint-disable-next-line no-param-reassign
branchUpgrades[0].commitMessageExtra = `to v${newValue[0]}`;
branchUpgrades[0].commitMessageExtra = `to v${toVersions[0]}`;
}
logger.debug(`groupEligible: ${groupEligible}`);
const useGroupSettings = hasGroupName && groupEligible;
......@@ -56,11 +56,11 @@ function generateBranchConfig(branchUpgrades) {
(branchUpgrades[1].depName.startsWith('@types/') &&
branchUpgrades[1].depName.endsWith(branchUpgrades[0].depName)));
// istanbul ignore else
if (newValue.length > 1 && !isTypesGroup) {
logger.debug({ newValue });
if (toVersions.length > 1 && !isTypesGroup) {
logger.debug({ toVersions });
delete upgrade.commitMessageExtra;
upgrade.recreateClosed = true;
} else if (semver.valid(newValue[0])) {
} else if (semver.valid(toVersions[0])) {
upgrade.isRange = false;
}
// Use templates to generate strings
......
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