renovate/lib/modules/manager/bundler/update-locked.ts
Rhys Arkins 7e2e0b3f18
feat(poetry): updateLockedDependency() ()
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2022-03-14 17:56:09 +01:00

23 lines
837 B
TypeScript

import { logger } from '../../../logger';
import type { UpdateLockedConfig, UpdateLockedResult } from '../types';
import { extractLockFileEntries } from './locked-version';
export function updateLockedDependency(
config: UpdateLockedConfig
): UpdateLockedResult {
const { depName, currentVersion, newVersion, lockFile, lockFileContent } =
config;
logger.debug(
`bundler.updateLockedDependency: ${depName}@${currentVersion} -> ${newVersion} [${lockFile}]`
);
try {
const locked = extractLockFileEntries(lockFileContent);
if (locked.get(depName) === newVersion) {
return { status: 'already-updated' };
}
return { status: 'unsupported' };
} catch (err) /* istanbul ignore next */ {
logger.debug({ err }, 'bundler.updateLockedDependency() error');
return { status: 'update-failed' };
}
}