mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 06:56:24 +00:00
refactor: generateBranchConfig -> ifTypesGroup
This commit is contained in:
parent
634c6d9433
commit
c52ac258e8
1 changed files with 14 additions and 7 deletions
|
@ -3,6 +3,17 @@ const { DateTime } = require('luxon');
|
|||
const semver = require('semver');
|
||||
const { mergeChildConfig } = require('../../../config');
|
||||
|
||||
function ifTypesGroup(depNames, hasGroupName, branchUpgrades) {
|
||||
return (
|
||||
depNames.length === 2 &&
|
||||
!hasGroupName &&
|
||||
((branchUpgrades[0].depName.startsWith('@types/') &&
|
||||
branchUpgrades[0].depName.endsWith(branchUpgrades[1].depName)) ||
|
||||
(branchUpgrades[1].depName.startsWith('@types/') &&
|
||||
branchUpgrades[1].depName.endsWith(branchUpgrades[0].depName)))
|
||||
);
|
||||
}
|
||||
|
||||
function generateBranchConfig(branchUpgrades) {
|
||||
logger.debug(`generateBranchConfig(${branchUpgrades.length})`);
|
||||
logger.trace({ config: branchUpgrades });
|
||||
|
@ -56,13 +67,9 @@ function generateBranchConfig(branchUpgrades) {
|
|||
// Delete group config regardless of whether it was applied
|
||||
delete upgrade.group;
|
||||
delete upgrade.lazyGrouping;
|
||||
const isTypesGroup =
|
||||
depNames.length === 2 &&
|
||||
!hasGroupName &&
|
||||
((branchUpgrades[0].depName.startsWith('@types/') &&
|
||||
branchUpgrades[0].depName.endsWith(branchUpgrades[1].depName)) ||
|
||||
(branchUpgrades[1].depName.startsWith('@types/') &&
|
||||
branchUpgrades[1].depName.endsWith(branchUpgrades[0].depName)));
|
||||
|
||||
const isTypesGroup = ifTypesGroup(depNames, hasGroupName, branchUpgrades);
|
||||
|
||||
// istanbul ignore else
|
||||
if (toVersions.length > 1 && !isTypesGroup) {
|
||||
logger.debug({ toVersions });
|
||||
|
|
Loading…
Reference in a new issue