UNPKG

renovate

Version:

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

135 lines 4.16 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CommunityActions = void 0; const tslib_1 = require("tslib"); const zod_1 = require("zod"); const regex_1 = require("../../../util/regex"); const github_releases_1 = require("../../datasource/github-releases"); const npm_1 = require("../../datasource/npm"); const pypi_1 = require("../../datasource/pypi"); const condaVersioning = tslib_1.__importStar(require("../../versioning/conda")); const npmVersioning = tslib_1.__importStar(require("../../versioning/npm")); const pep440versioning = tslib_1.__importStar(require("../../versioning/pep440")); function matchAction(action) { return zod_1.z .string() .regex((0, regex_1.regEx)(`(?:https?://[^/]+/)?${(0, regex_1.escapeRegExp)(action)}(?:@.+)?$`)); } const SetupUV = zod_1.z .object({ // https://github.com/astral-sh/setup-uv uses: matchAction('astral-sh/setup-uv'), with: zod_1.z.object({ version: zod_1.z.string().optional() }), }) .transform(({ with: val }) => { let skipStage; let skipReason; if (!val.version) { skipStage = 'extract'; skipReason = 'unspecified-version'; } return { datasource: github_releases_1.GithubReleasesDatasource.id, depName: 'astral-sh/uv', versioning: npmVersioning.id, packageName: 'astral-sh/uv', ...(skipStage && { skipStage }), ...(skipReason && { skipReason }), currentValue: val.version, depType: 'uses-with', }; }); const SetupPnpm = zod_1.z .object({ uses: matchAction('pnpm/action-setup'), with: zod_1.z.object({ version: zod_1.z.string().optional(), }), }) .transform(({ with: val }) => { let skipStage; let skipReason; if (!val.version) { skipStage = 'extract'; skipReason = 'unspecified-version'; } return { datasource: npm_1.NpmDatasource.id, depName: 'pnpm', versioning: npmVersioning.id, packageName: 'pnpm', ...(skipStage && { skipStage }), ...(skipReason && { skipReason }), currentValue: val.version, depType: 'uses-with', }; }); const SetupPDM = zod_1.z .object({ uses: matchAction('pdm-project/setup-pdm'), with: zod_1.z.object({ version: zod_1.z.string().optional() }), }) .transform(({ with: val }) => { let skipStage; let skipReason; if (!val.version) { skipStage = 'extract'; skipReason = 'unspecified-version'; } return { datasource: pypi_1.PypiDatasource.id, depName: 'pdm', versioning: pep440versioning.id, packageName: 'pdm', currentValue: val.version, ...(skipStage && { skipStage }), ...(skipReason && { skipReason }), depType: 'uses-with', }; }); const InstallBinary = zod_1.z .object({ uses: zod_1.z.union([ matchAction('jaxxstorm/action-install-gh-release'), matchAction('sigoden/install-binary'), ]), with: zod_1.z.object({ repo: zod_1.z.string(), tag: zod_1.z.string() }), }) .transform(({ with: val }) => { return { datasource: github_releases_1.GithubReleasesDatasource.id, depName: val.repo, packageName: val.repo, currentValue: val.tag, depType: 'uses-with', }; }); const SetupPixi = zod_1.z .object({ uses: matchAction('prefix-dev/setup-pixi'), with: zod_1.z.object({ 'pixi-version': zod_1.z.string() }), }) .transform(({ with: val }) => { return { datasource: github_releases_1.GithubReleasesDatasource.id, versioning: condaVersioning.id, depName: 'prefix-dev/pixi', packageName: 'prefix-dev/pixi', currentValue: val['pixi-version'], depType: 'uses-with', }; }); /** * schema here should match the whole step, * there may be some actions use env as arguments version. * * each type should return `PackageDependency | undefined` */ exports.CommunityActions = zod_1.z.union([ InstallBinary, SetupPDM, SetupPixi, SetupPnpm, SetupUV, ]); //# sourceMappingURL=community.js.map