0
0
Fork 0
mirror of https://github.com/renovatebot/renovate.git synced 2025-01-12 22:29:06 +00:00
renovatebot_renovate/lib/modules/manager/mix/range.ts
2025-01-09 14:54:48 +00:00

26 lines
728 B
TypeScript

import { parseRange } from 'semver-utils';
import { logger } from '../../../logger';
import type { RangeStrategy } from '../../../types';
import type { RangeConfig } from '../types';
export function getRangeStrategy(config: RangeConfig): RangeStrategy {
const { currentValue, rangeStrategy } = config;
const isComplexRange = currentValue
? parseRange(currentValue).length > 1
: false;
if (rangeStrategy === 'bump' && isComplexRange) {
logger.debug(
{ currentValue },
'Replacing bump strategy for complex range with widen',
);
return 'widen';
}
if (rangeStrategy !== 'auto') {
return rangeStrategy;
}
if (isComplexRange) {
return 'widen';
}
return 'update-lockfile';
}