mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 15:06:27 +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 semver = require('semver');
|
||||||
const { mergeChildConfig } = require('../../../config');
|
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) {
|
function generateBranchConfig(branchUpgrades) {
|
||||||
logger.debug(`generateBranchConfig(${branchUpgrades.length})`);
|
logger.debug(`generateBranchConfig(${branchUpgrades.length})`);
|
||||||
logger.trace({ config: branchUpgrades });
|
logger.trace({ config: branchUpgrades });
|
||||||
|
@ -56,13 +67,9 @@ function generateBranchConfig(branchUpgrades) {
|
||||||
// Delete group config regardless of whether it was applied
|
// Delete group config regardless of whether it was applied
|
||||||
delete upgrade.group;
|
delete upgrade.group;
|
||||||
delete upgrade.lazyGrouping;
|
delete upgrade.lazyGrouping;
|
||||||
const isTypesGroup =
|
|
||||||
depNames.length === 2 &&
|
const isTypesGroup = ifTypesGroup(depNames, hasGroupName, branchUpgrades);
|
||||||
!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)));
|
|
||||||
// istanbul ignore else
|
// istanbul ignore else
|
||||||
if (toVersions.length > 1 && !isTypesGroup) {
|
if (toVersions.length > 1 && !isTypesGroup) {
|
||||||
logger.debug({ toVersions });
|
logger.debug({ toVersions });
|
||||||
|
|
Loading…
Reference in a new issue