Files
Sergei Zharinov 930cf6633c refactor: Rewrite imports with .ts extensions (#40700)
fix: Additional vi.mock path corrections and prettier formatting
2026-01-26 22:48:17 +00:00

28 lines
907 B
TypeScript

import { logger } from '../../../logger/index.ts';
import type { RangeStrategy } from '../../../types/index.ts';
import type { RangeConfig } from '../types.ts';
import type { ComposerManagerData } from './types.ts';
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';
}