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

refactor: rename upgrades to updates in branchify

parent abebabb9
Branches
Tags 12.19.11
No related merge requests found
......@@ -27,39 +27,39 @@ function branchifyUpgrades(config) {
const branchUpgrades = {};
const branches = [];
for (const upg of config.upgrades) {
const upgrade = { ...upg };
// Split out errors and wrnings first
if (upgrade.type === 'error') {
errors.push(upgrade);
} else if (upgrade.type === 'warning') {
warnings.push(upgrade);
const update = { ...upg };
// Split out errors and warnings first
if (update.type === 'error') {
errors.push(update);
} else if (update.type === 'warning') {
warnings.push(update);
} else {
// Check whether to use a group name
if (upgrade.groupName) {
if (update.groupName) {
logger.debug('Using group branchName template');
logger.debug(
`Dependency ${upgrade.depName} is part of group ${upgrade.groupName}`
`Dependency ${update.depName} is part of group ${update.groupName}`
);
upgrade.groupSlug = slugify(upgrade.groupSlug || upgrade.groupName, {
update.groupSlug = slugify(update.groupSlug || update.groupName, {
lower: true,
});
upgrade.branchTopic = upgrade.group.branchTopic || upgrade.branchTopic;
upgrade.branchName = handlebars.compile(
upgrade.group.branchName || upgrade.branchName
)(upgrade);
update.branchTopic = update.group.branchTopic || update.branchTopic;
update.branchName = handlebars.compile(
update.group.branchName || update.branchName
)(update);
} else {
upgrade.branchName = handlebars.compile(upgrade.branchName)(upgrade);
update.branchName = handlebars.compile(update.branchName)(update);
}
// Compile extra times in case of nested handlebars templates
upgrade.branchName = handlebars.compile(upgrade.branchName)(upgrade);
upgrade.branchName = cleanBranchName(
handlebars.compile(upgrade.branchName)(upgrade)
update.branchName = handlebars.compile(update.branchName)(update);
update.branchName = cleanBranchName(
handlebars.compile(update.branchName)(update)
);
branchUpgrades[upgrade.branchName] =
branchUpgrades[upgrade.branchName] || [];
branchUpgrades[upgrade.branchName] = [upgrade].concat(
branchUpgrades[upgrade.branchName]
branchUpgrades[update.branchName] =
branchUpgrades[update.branchName] || [];
branchUpgrades[update.branchName] = [update].concat(
branchUpgrades[update.branchName]
);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment