UNPKG

renovate

Version:

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

58 lines (57 loc) 1.77 kB
import api$1, { isVersion } from "../npm/index.js"; import { findScheduleForCodename, findScheduleForVersion } from "./schedule.js"; import { DateTime } from "luxon"; import { valid } from "semver"; //#region lib/modules/versioning/node/index.ts const id = "node"; function normalizeValue(value) { const schedule = findScheduleForCodename(value); if (schedule) return `^${schedule.version.replace("v", "")}`; return value; } function getNewValue({ currentValue, rangeStrategy, currentVersion, newVersion }) { if (rangeStrategy !== "pin" && findScheduleForCodename(currentValue)) { const newSchedule = findScheduleForVersion(newVersion); if (newSchedule?.codename) return newSchedule.codename.toLowerCase(); } const res = api$1.getNewValue({ currentValue: normalizeValue(currentValue), rangeStrategy, currentVersion, newVersion }); if (res && isVersion(res)) return valid(res); return res; } function isValid(version) { return api$1.isValid(normalizeValue(version)); } function isStable(version) { if (api$1.isStable(version)) { const schedule = findScheduleForVersion(version); if (schedule?.lts) return DateTime.local() > DateTime.fromISO(schedule.lts); } return false; } function matches(version, range) { return api$1.matches(version, normalizeValue(range)); } function getSatisfyingVersion(versions, range) { return api$1.getSatisfyingVersion(versions, normalizeValue(range)); } function minSatisfyingVersion(versions, range) { return api$1.minSatisfyingVersion(versions, normalizeValue(range)); } const api = { ...api$1, isStable, getNewValue, isValid, matches, getSatisfyingVersion, minSatisfyingVersion, allowUnstableMajorUpgrades: true }; //#endregion export { api as default, id, isStable }; //# sourceMappingURL=index.js.map