mirror of
https://github.com/renovatebot/renovate.git
synced 2026-11-07 12:40:49 +00:00
fe739befbf
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
28 lines
881 B
TypeScript
28 lines
881 B
TypeScript
import { logger } from '../../../logger';
|
|
import type { RangeStrategy } from '../../../types';
|
|
import type { RangeConfig } from '../types';
|
|
import type { ComposerManagerData } from './types';
|
|
|
|
export function getRangeStrategy(config: RangeConfig): RangeStrategy {
|
|
const { managerData = {}, currentValue, rangeStrategy } = config;
|
|
const { composerJsonType } = managerData as ComposerManagerData;
|
|
const isComplexRange = currentValue?.includes(' || ') ?? 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 ||
|
|
(composerJsonType && ['typo3-cms-extension'].includes(composerJsonType))
|
|
) {
|
|
return 'widen';
|
|
}
|
|
return 'update-lockfile';
|
|
}
|