mirror of
https://github.com/renovatebot/renovate.git
synced 2026-11-07 04:30:38 +00:00
533bc62eb4
* refactor(manager/pixi): extract shared pixi.lock update helper * test(manager/pixi): cover shared pixi.lock helper directly Add a dedicated lockfile.spec.ts that exercises updatePixiLockfile directly (gate, package-file write branch, lockfile maintenance, unchanged, constraint pass-through, and error handling), and slim the pixi and pep621 call-site specs down to their own behavior: how each derives the pixi constraint and that they delegate to the shared helper.
57 lines
1.6 KiB
TypeScript
57 lines
1.6 KiB
TypeScript
import { logger } from '../../../../logger/index.ts';
|
|
import {
|
|
getSiblingFileName,
|
|
localPathExists,
|
|
} from '../../../../util/fs/index.ts';
|
|
import { updatePixiLockfile } from '../../pixi/lockfile.ts';
|
|
import type {
|
|
PackageDependency,
|
|
UpdateArtifact,
|
|
UpdateArtifactsResult,
|
|
} from '../../types.ts';
|
|
import type { PyProject } from '../schema.ts';
|
|
import { BasePyProjectProcessor } from './abstract.ts';
|
|
|
|
export class PixiProcessor extends BasePyProjectProcessor {
|
|
process(_project: PyProject, deps: PackageDependency[]): PackageDependency[] {
|
|
return deps;
|
|
}
|
|
|
|
extractLockedVersions(
|
|
_project: PyProject,
|
|
deps: PackageDependency[],
|
|
_packageFile: string,
|
|
): Promise<PackageDependency[]> {
|
|
return Promise.resolve(deps);
|
|
}
|
|
|
|
override async getLockfiles(
|
|
_project: PyProject,
|
|
packageFile: string,
|
|
): Promise<string[]> {
|
|
const lockfileName = getSiblingFileName(packageFile, 'pixi.lock');
|
|
if (await localPathExists(lockfileName)) {
|
|
return [lockfileName];
|
|
}
|
|
logger.debug({ packageFile }, 'No pixi.lock found');
|
|
return [];
|
|
}
|
|
|
|
updateArtifacts(
|
|
{ config, updatedDeps, packageFileName }: UpdateArtifact,
|
|
project: PyProject,
|
|
): Promise<UpdateArtifactsResult[] | null> {
|
|
const constraint =
|
|
config.constraints?.pixi ?? project.tool?.pixi?.['requires-pixi'];
|
|
|
|
// The `pep621` manager has already written the updated package file, so
|
|
// `newPackageFileContent` is intentionally left unset here.
|
|
return updatePixiLockfile({
|
|
packageFileName,
|
|
updatedDeps,
|
|
isLockFileMaintenance: config.isLockFileMaintenance,
|
|
constraint,
|
|
});
|
|
}
|
|
}
|