UNPKG

renovate

Version:

Automated dependency updates. Flexible so you don't need to be.

78 lines (77 loc) 2.83 kB
import "../../../../constants/error-messages.js"; import { GlobalConfig } from "../../../../config/global.js"; import { logger } from "../../../../logger/index.js"; import { deleteLocalFile, ensureCacheDir, getSiblingFileName, localPathExists, readLocalFile } from "../../../../util/fs/index.js"; import { exec } from "../../../../util/exec/index.js"; import { BasePyProjectProcessor } from "./abstract.js"; import { isNonEmptyArray } from "@sindresorhus/is"; //#region lib/modules/manager/pep621/processors/pixi.ts const commandLock = "pixi lock --no-progress --color=never --quiet"; var PixiProcessor = class extends BasePyProjectProcessor { process(_project, deps) { return deps; } extractLockedVersions(_project, deps, _packageFile) { return Promise.resolve(deps); } async getLockfiles(_project, packageFile) { const lockfileName = getSiblingFileName(packageFile, "pixi.lock"); if (await localPathExists(lockfileName)) return [lockfileName]; logger.debug({ packageFile }, "No pixi.lock found"); return []; } async updateArtifacts({ config, updatedDeps, packageFileName }, project) { const { isLockFileMaintenance } = config; if (!isNonEmptyArray(updatedDeps) && !isLockFileMaintenance) { logger.debug("No updated pixi deps - returning null"); return null; } const lockFileName = getSiblingFileName(packageFileName, "pixi.lock"); const existingLockFileContent = await readLocalFile(lockFileName, "utf8"); if (!existingLockFileContent) { logger.debug("No pixi.lock found"); return null; } if (!GlobalConfig.get("allowedUnsafeExecutions").includes("pixi")) { logger.once.warn("`pixi lock` was requested to run, but `pixi` is not permitted in the allowedUnsafeExecutions"); return null; } const constraint = config.constraints?.pixi ?? project.tool?.pixi?.["requires-pixi"]; try { if (isLockFileMaintenance) await deleteLocalFile(lockFileName); const PIXI_CACHE_DIR = await ensureCacheDir("pixi"); await exec([commandLock], { cwdFile: packageFileName, extraEnv: { PIXI_CACHE_DIR, RATTLER_CACHE_DIR: PIXI_CACHE_DIR }, docker: {}, toolConstraints: [{ toolName: "pixi", constraint }] }); const newPixiLockContent = await readLocalFile(lockFileName, "utf8"); if (existingLockFileContent === newPixiLockContent) { logger.debug(`${lockFileName} is unchanged`); return null; } return [{ file: { type: "addition", path: lockFileName, contents: newPixiLockContent } }]; } catch (err) { if (err.message === "temporary-error") throw err; logger.debug({ err }, `Failed to update ${lockFileName} file`); return [{ artifactError: { fileName: lockFileName, stderr: `${err}` } }]; } } }; //#endregion export { PixiProcessor, commandLock }; //# sourceMappingURL=pixi.js.map