mirror of
https://github.com/renovatebot/renovate.git
synced 2026-10-31 01:37:24 +00:00
930cf6633c
fix: Additional vi.mock path corrections and prettier formatting
24 lines
692 B
TypeScript
24 lines
692 B
TypeScript
import { parseRange } from 'semver-utils';
|
|
import { logger } from '../../../logger/index.ts';
|
|
import type { RangeStrategy } from '../../../types/index.ts';
|
|
import type { RangeConfig } from '../types.ts';
|
|
|
|
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!;
|
|
}
|
|
return 'widen';
|
|
}
|