mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-21 03:56:25 +00:00
7e2e0b3f18
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
23 lines
837 B
TypeScript
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' };
|
|
}
|
|
}
|