mirror of
https://github.com/renovatebot/renovate.git
synced 2026-10-27 07:50:47 +00:00
98b7710df5
updateLockedDependency() only searched the packages section of composer.lock, so updates to packages-dev dependencies were never recognized as already committed to the branch. Every Renovate run then fell back to a full artifact update and rebuilt the branch from a clean base, force-pushing grouped composer PRs containing dev dependencies whenever the base branch had moved - even with identical content.
31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
import { logger } from '../../../logger/index.ts';
|
|
import { Json } from '../../../util/schema-utils/index.ts';
|
|
import { api as composer } from '../../versioning/composer/index.ts';
|
|
import type { UpdateLockedConfig, UpdateLockedResult } from '../types.ts';
|
|
import { Lockfile } from './schema.ts';
|
|
|
|
export function updateLockedDependency(
|
|
config: UpdateLockedConfig,
|
|
): UpdateLockedResult {
|
|
const { depName, currentVersion, newVersion, lockFile, lockFileContent } =
|
|
config;
|
|
logger.debug(
|
|
`composer.updateLockedDependency: ${depName}@${currentVersion} -> ${newVersion} [${lockFile}]`,
|
|
);
|
|
try {
|
|
const lockfile = Json.pipe(Lockfile).parse(lockFileContent);
|
|
if (
|
|
[...lockfile.packages, ...lockfile.packagesDev].find(
|
|
({ name, version }) =>
|
|
name === depName && composer.equals(version, newVersion),
|
|
)
|
|
) {
|
|
return { status: 'already-updated' };
|
|
}
|
|
return { status: 'unsupported' };
|
|
} catch (err) /* istanbul ignore next */ {
|
|
logger.debug({ err }, 'composer.updateLockedDependency() error');
|
|
return { status: 'update-failed' };
|
|
}
|
|
}
|