mirror of
https://github.com/renovatebot/renovate.git
synced 2024-12-22 13:38:32 +00:00
40721cd0a8
Co-authored-by: Simon Žlender <pub.git@zlender.si> Co-authored-by: Simon Žlender <szlend@users.noreply.github.com> Co-authored-by: Rhys Arkins <rhys@arkins.net> Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
24 lines
854 B
TypeScript
24 lines
854 B
TypeScript
import { logger } from '../../../logger';
|
|
import type { UpdateLockedConfig, UpdateLockedResult } from '../types';
|
|
import { extractLockFileContentVersions } from './locked-version';
|
|
|
|
export function updateLockedDependency(
|
|
config: UpdateLockedConfig,
|
|
): UpdateLockedResult {
|
|
const { depName, currentVersion, newVersion, lockFile, lockFileContent } =
|
|
config;
|
|
logger.debug(
|
|
`cargo.updateLockedDependency: ${depName}@${currentVersion} -> ${newVersion} [${lockFile}]`,
|
|
);
|
|
try {
|
|
const locked = extractLockFileContentVersions(lockFileContent!);
|
|
if (locked?.get(depName)?.find((version) => version === newVersion)) {
|
|
return { status: 'already-updated' };
|
|
}
|
|
return { status: 'unsupported' };
|
|
} catch (err) {
|
|
logger.debug({ err }, 'cargo.updateLockedDependency() error');
|
|
return { status: 'update-failed' };
|
|
}
|
|
}
|