From e811461ea8124d54a3e35f7a21e3e2b2671e8572 Mon Sep 17 00:00:00 2001 From: Risu <79110363+risu729@users.noreply.github.com> Date: Sat, 14 Dec 2024 22:28:51 +0900 Subject: [PATCH 01/30] feat(manager): support mise backends --- lib/modules/manager/mise/extract.spec.ts | 275 +++++++++++++++++++++++ lib/modules/manager/mise/extract.ts | 250 ++++++++++++++++++++- lib/modules/manager/mise/index.ts | 36 ++- lib/modules/manager/mise/readme.md | 37 ++- lib/modules/manager/mise/schema.ts | 10 +- 5 files changed, 591 insertions(+), 17 deletions(-) diff --git a/lib/modules/manager/mise/extract.spec.ts b/lib/modules/manager/mise/extract.spec.ts index 67e2edea5303e1..c4532263f967eb 100644 --- a/lib/modules/manager/mise/extract.spec.ts +++ b/lib/modules/manager/mise/extract.spec.ts @@ -103,6 +103,281 @@ describe('modules/manager/mise/extract', () => { }); }); + it('extracts tools in the default registry with backends', () => { + const content = codeBlock` + [tools] + "core:node" = "16" + "asdf:rust" = "1.82.0" + "vfox:scala" = "3.5.2" + "aqua:act" = "0.2.70" + `; + const result = extractPackageFile(content, miseFilename); + expect(result).toMatchObject({ + deps: [ + { + depName: 'core:node', + currentValue: '16', + packageName: 'nodejs', + datasource: 'node-version', + }, + { + depName: 'asdf:rust', + currentValue: '1.82.0', + packageName: 'rust-lang/rust', + datasource: 'github-tags', + }, + { + depName: 'vfox:scala', + currentValue: '3.5.2', + packageName: 'lampepfl/dotty', + datasource: 'github-tags', + }, + { + depName: 'aqua:act', + currentValue: '0.2.70', + packageName: 'nektos/act', + datasource: 'github-releases', + }, + ], + }); + }); + + it('extracts aqua backend tool', () => { + const content = codeBlock` + [tools] + "aqua:BurntSushi/ripgrep" = "14.1.0" + `; + const result = extractPackageFile(content, miseFilename); + expect(result).toMatchObject({ + deps: [ + { + depName: 'aqua:BurntSushi/ripgrep', + currentValue: '14.1.0', + packageName: 'BurntSushi/ripgrep', + datasource: 'github-tags', + }, + ], + }); + }); + + it('extracts cargo backend tools', () => { + const content = codeBlock` + [tools] + "cargo:eza" = "0.18.21" + "cargo:https://github.com/username/demo1" = "tag:v0.1.0" + "cargo:https://github.com/username/demo2" = "branch:main" + "cargo:https://github.com/username/demo3" = "rev:abcdef" + `; + const result = extractPackageFile(content, miseFilename); + expect(result).toMatchObject({ + deps: [ + { + depName: 'cargo:eza', + currentValue: '0.18.21', + packageName: 'eza', + datasource: 'crate', + }, + { + depName: 'cargo:https://github.com/username/demo1', + packageName: 'https://github.com/username/demo1', + skipReason: 'unsupported-url', + }, + { + depName: 'cargo:https://github.com/username/demo2', + packageName: 'https://github.com/username/demo2', + skipReason: 'unsupported-url', + }, + { + depName: 'cargo:https://github.com/username/demo3', + packageName: 'https://github.com/username/demo3', + skipReason: 'unsupported-url', + }, + ], + }); + }); + + it('extracts go backend tool', () => { + const content = codeBlock` + [tools] + "go:github.com/DarthSim/hivemind" = "1.0.6" + `; + const result = extractPackageFile(content, miseFilename); + expect(result).toMatchObject({ + deps: [ + { + depName: 'go:github.com/DarthSim/hivemind', + currentValue: '1.0.6', + packageName: 'github.com/DarthSim/hivemind', + datasource: 'go', + }, + ], + }); + }); + + it('extracts npm backend tool', () => { + const content = codeBlock` + [tools] + "npm:prettier" = "3.3.2" + `; + const result = extractPackageFile(content, miseFilename); + expect(result).toMatchObject({ + deps: [ + { + depName: 'npm:prettier', + currentValue: '3.3.2', + packageName: 'prettier', + datasource: 'npm', + }, + ], + }); + }); + + it('extracts pipx backend tools', () => { + const content = codeBlock` + [tools] + "pipx:yamllint" = "1.35.0" + "pipx:psf/black" = "24.4.1" + "pipx:git+https://github.com/psf/black.git" = "24.4.1" + "pipx:git+https://gitlab.com/user/repo.git" = "0.1.0" + # Does not work but the mise docs says supporting + "pipx:https://github.com/psf/black/archive/18.9b0.zip" = "latest" + `; + const result = extractPackageFile(content, miseFilename); + expect(result).toMatchObject({ + deps: [ + { + depName: 'pipx:yamllint', + currentValue: '1.35.0', + packageName: 'yamllint', + datasource: 'pypi', + }, + { + depName: 'pipx:psf/black', + currentValue: '24.4.1', + packageName: 'psf/black', + datasource: 'github-tags', + }, + { + depName: 'pipx:git+https://github.com/psf/black.git', + currentValue: '24.4.1', + packageName: 'psf/black', + datasource: 'github-tags', + }, + { + depName: 'pipx:git+https://gitlab.com/user/repo.git', + packageName: 'git+https://gitlab.com/user/repo.git', + skipReason: 'unsupported-url', + }, + { + depName: 'pipx:https://github.com/psf/black/archive/18.9b0.zip', + packageName: 'https://github.com/psf/black/archive/18.9b0.zip', + skipReason: 'unsupported-url', + }, + ], + }); + }); + + it('extracts spm backend tools', () => { + const content = codeBlock` + [tools] + "spm:tuist/tuist" = "4.15.0" + "spm:https://github.com/tuist/tuist.git" = "4.13.0" + "spm:https://gitlab.com/user/repo.git" = "0.1.0" + `; + const result = extractPackageFile(content, miseFilename); + expect(result).toMatchObject({ + deps: [ + { + depName: 'spm:tuist/tuist', + currentValue: '4.15.0', + packageName: 'tuist/tuist', + datasource: 'github-releases', + }, + { + depName: 'spm:https://github.com/tuist/tuist.git', + currentValue: '4.13.0', + packageName: 'tuist/tuist', + datasource: 'github-releases', + }, + { + depName: 'spm:https://gitlab.com/user/repo.git', + packageName: 'https://gitlab.com/user/repo.git', + skipReason: 'unsupported-url', + }, + ], + }); + }); + + it('extracts ubi backend tools', () => { + const content = codeBlock` + [tools] + "ubi:nekto/act" = "0.2.70" + "ubi:cli/cli" = { exe = "gh", version = "1.14.0" } + "ubi:cli/cli[exe=gh]" = "1.14.0" + "ubi:tamasfe/taplo" = { matching = "full", version = "0.1.0" } + "ubi:tamasfe/taplo[matching=full]" = "0.1.0" + "ubi:cargo-bins/cargo-binstall" = { tag_regex = "^\\d+\\.\\d+\\.", version = "1.0.0" } + "ubi:cargo-bins/cargo-binstall[tag_regex=^\\d+\\.]" = "1.0.0" + "ubi:cargo-bins/cargo-binstall[tag_regex=^\\d+\\.\\d+\\.]" = { tag_regex = "^\\d+\\.", version = "1.0.0" } + `; + const result = extractPackageFile(content, miseFilename); + expect(result).toMatchObject({ + deps: [ + { + depName: 'ubi:nekto/act', + currentValue: '0.2.70', + packageName: 'nekto/act', + datasource: 'github-releases', + }, + { + depName: 'ubi:cli/cli', + currentValue: '1.14.0', + packageName: 'cli/cli', + datasource: 'github-releases', + }, + { + depName: 'ubi:cli/cli', + currentValue: '1.14.0', + packageName: 'cli/cli', + datasource: 'github-releases', + }, + { + depName: 'ubi:tamasfe/taplo', + currentValue: '0.1.0', + packageName: 'tamasfe/taplo', + datasource: 'github-releases', + }, + { + depName: 'ubi:tamasfe/taplo', + currentValue: '0.1.0', + packageName: 'tamasfe/taplo', + datasource: 'github-releases', + }, + { + depName: 'ubi:cargo-bins/cargo-binstall', + currentValue: '1.0.0', + packageName: 'cargo-bins/cargo-binstall', + datasource: 'github-releases', + extractVersion: '(?\\d+\\.\\d+\\.)', + }, + { + depName: 'ubi:cargo-bins/cargo-binstall', + currentValue: '1.0.0', + packageName: 'cargo-bins/cargo-binstall', + datasource: 'github-releases', + extractVersion: '(?\\d+\\.)', + }, + { + depName: 'ubi:cargo-bins/cargo-binstall', + currentValue: '1.0.0', + packageName: 'cargo-bins/cargo-binstall', + datasource: 'github-releases', + extractVersion: '(?\\d+\\.)', + }, + ], + }); + }); + it('provides skipReason for lines with unsupported tooling', () => { const content = codeBlock` [tools] diff --git a/lib/modules/manager/mise/extract.ts b/lib/modules/manager/mise/extract.ts index 9aa41b16c1ae06..8d757bd36e026c 100644 --- a/lib/modules/manager/mise/extract.ts +++ b/lib/modules/manager/mise/extract.ts @@ -1,12 +1,24 @@ import is from '@sindresorhus/is'; import { logger } from '../../../logger'; +import { regEx } from '../../../util/regex'; +import { CrateDatasource } from '../../datasource/crate'; +import { GithubReleasesDatasource } from '../../datasource/github-releases'; +import { GithubTagsDatasource } from '../../datasource/github-tags'; +import { GoDatasource } from '../../datasource/go'; +import { NpmDatasource } from '../../datasource/npm'; +import { PypiDatasource } from '../../datasource/pypi'; +import { normalizePythonDepName } from '../../datasource/pypi/common'; import type { ToolingConfig } from '../asdf/upgradeable-tooling'; import type { PackageDependency, PackageFileContent } from '../types'; -import type { MiseToolSchema } from './schema'; +import type { MiseToolOptionsSchema, MiseToolSchema } from './schema'; import type { ToolingDefinition } from './upgradeable-tooling'; import { asdfTooling, miseTooling } from './upgradeable-tooling'; import { parseTomlFile } from './utils'; +// Tool names can have options in the tool name +// e.g. ubi:tamasfe/taplo[matching=full,exe=taplo] +const optionInToolNameRegex = regEx(/^(?.+)(?:\[(?.+)\])?$/); + export function extractPackageFile( content: string, packageFile: string, @@ -24,8 +36,16 @@ export function extractPackageFile( if (tools) { for (const [name, toolData] of Object.entries(tools)) { const version = parseVersion(toolData); - const depName = name.trim(); - const toolConfig = getToolConfig(depName, version); + // Parse the tool options in the tool name + const { name: depName, options: optionsInName } = + optionInToolNameRegex.exec(name.trim())?.groups ?? { + name: name.trim(), + }; + const options = parseOptions( + optionsInName, + is.nonEmptyObject(toolData) ? toolData : {}, + ); + const toolConfig = getToolConfig(depName, version, options); const dep = createDependency(depName, version, toolConfig); deps.push(dep); } @@ -53,18 +73,86 @@ function parseVersion(toolData: MiseToolSchema): string | null { return null; // Return null if no version is found } +function parseOptions( + optionsInName: string, + toolOptions: MiseToolOptionsSchema, +): MiseToolOptionsSchema { + const options = is.nonEmptyString(optionsInName) + ? Object.fromEntries( + optionsInName.split(',').map((option) => option.split('=', 2)), + ) + : {}; + // Options in toolOptions will override options in the tool name + return { + ...options, + ...toolOptions, + }; +} + +type SkippedToolingConfig = Partial & + Required>; + function getToolConfig( name: string, version: string | null, -): ToolingConfig | null { + toolOptions: MiseToolOptionsSchema, +): ToolingConfig | SkippedToolingConfig | null { if (version === null) { return null; // Early return if version is null } + // If the tool name does not specify a backend, it should be a short name or an alias defined by users + const delimiterIndex = name.indexOf(':'); + if (delimiterIndex === -1) { + return getRegistryToolConfig(name, version); + } + + const backend = name.substring(0, delimiterIndex); + const toolName = name.substring(delimiterIndex + 1); + switch (backend) { + // We can specify core, asdf, vfox, aqua backends for tools in the default registry + // e.g. 'core:rust', 'asdf:rust', 'vfox:clang', 'aqua:act' + case 'core': + return getConfigFromTooling(miseTooling, toolName, version); + case 'asdf': + return getConfigFromTooling(asdfTooling, toolName, version); + case 'vfox': + return getRegistryToolConfig(toolName, version); + case 'aqua': + return ( + getRegistryToolConfig(toolName, version) ?? + createAquaToolConfig(toolName) + ); + case 'cargo': + return createCargoToolConfig(toolName); + case 'go': + return createGoToolConfig(toolName); + case 'npm': + return createNpmToolConfig(toolName); + case 'pipx': + return createPipxToolConfig(toolName); + case 'spm': + return createSpmToolConfig(toolName); + case 'ubi': + return createUbiToolConfig(toolName, toolOptions); + default: + // Unsupported backend + return null; + } +} + +/** + * Get the tooling config for a short name defined in the default registry + * @link https://mise.jdx.dev/registry.html + */ +function getRegistryToolConfig( + short: string, + version: string, +): ToolingConfig | null { // Try to get the config from miseTooling first, then asdfTooling return ( - getConfigFromTooling(miseTooling, name, version) ?? - getConfigFromTooling(asdfTooling, name, version) + getConfigFromTooling(miseTooling, short, version) ?? + getConfigFromTooling(asdfTooling, short, version) ); } @@ -85,10 +173,158 @@ function getConfigFromTooling( ); // Ensure null is returned instead of undefined } +/** + * Create a tooling config for aqua backend + * @link https://mise.jdx.dev/dev-tools/backends/aqua.html + */ +function createAquaToolConfig(name: string): ToolingConfig { + // mise supports http aqua package type but we cannot determine it from the tool name + // An error will be thrown afterwards if the package type is http + // ref: https://github.com/jdx/mise/blob/d1b9749d8f3e13ef705c1ea471d96c5935b79136/src/aqua/aqua_registry.rs#L39-L45 + return { + packageName: name, + datasource: GithubTagsDatasource.id, + }; +} + +/** + * Create a tooling config for cargo backend + * @link https://mise.jdx.dev/dev-tools/backends/cargo.html + */ +function createCargoToolConfig( + name: string, +): ToolingConfig | SkippedToolingConfig { + // TODO: support url syntax + // Avoid type narrowing to prevent type error + if ((is.urlString as (value: unknown) => boolean)(name)) { + return { + packageName: name, + skipReason: 'unsupported-url', + }; + } + return { + packageName: name, + datasource: CrateDatasource.id, + }; +} + +/** + * Create a tooling config for go backend + * @link https://mise.jdx.dev/dev-tools/backends/go.html + */ +function createGoToolConfig(name: string): ToolingConfig { + return { + packageName: name, + datasource: GoDatasource.id, + }; +} + +/** + * Create a tooling config for npm backend + * @link https://mise.jdx.dev/dev-tools/backends/npm.html + */ +function createNpmToolConfig(name: string): ToolingConfig { + return { + packageName: name, + datasource: NpmDatasource.id, + }; +} + +const pipxGitHubRegex = regEx(/^git\+https:\/\/github\.com\/(?.+)\.git$/); + +/** + * Create a tooling config for pipx backend + * @link https://mise.jdx.dev/dev-tools/backends/pipx.html + */ +function createPipxToolConfig( + name: string, +): ToolingConfig | SkippedToolingConfig { + const isGitSyntax = name.startsWith('git+'); + // Does not support zip file url + // Avoid type narrowing to prevent type error + if (!isGitSyntax && (is.urlString as (value: unknown) => boolean)(name)) { + return { + packageName: name, + skipReason: 'unsupported-url', + }; + } + if (isGitSyntax || name.includes('/')) { + let repoName: string | undefined; + if (isGitSyntax) { + repoName = pipxGitHubRegex.exec(name)?.groups?.repo; + // mise only supports specifying the version tag for github repos + if (is.undefined(repoName)) { + return { + packageName: name, + skipReason: 'unsupported-url', + }; + } + } else { + repoName = name; + } + return { + packageName: repoName, + datasource: GithubTagsDatasource.id, + }; + } + return { + packageName: normalizePythonDepName(name), + datasource: PypiDatasource.id, + }; +} + +const spmGitHubRegex = regEx(/^https:\/\/github.com\/(?.+).git$/); + +/** + * Create a tooling config for spm backend + * @link https://mise.jdx.dev/dev-tools/backends/spm.html + */ +function createSpmToolConfig( + name: string, +): ToolingConfig | SkippedToolingConfig { + let repoName: string | undefined; + // Avoid type narrowing to prevent type error + if ((is.urlString as (value: unknown) => boolean)(name)) { + repoName = spmGitHubRegex.exec(name)?.groups?.repo; + // spm backend only supports github repos + if (!repoName) { + return { + packageName: name, + skipReason: 'unsupported-url', + }; + } + } + return { + packageName: repoName ?? name, + datasource: GithubReleasesDatasource.id, + }; +} + +/** + * Create a tooling config for ubi backend + * @link https://mise.jdx.dev/dev-tools/backends/ubi.html + */ +function createUbiToolConfig( + name: string, + toolOptions: MiseToolOptionsSchema, +): ToolingConfig { + return { + packageName: name, + datasource: GithubReleasesDatasource.id, + ...(toolOptions.tag_regex + ? { + // Filter versions by tag_regex if it is specified + // ref: https://mise.jdx.dev/dev-tools/backends/ubi.html#ubi-uses-weird-versions + extractVersion: `(?${toolOptions.tag_regex})`, + } + : {}), + }; +} + function createDependency( name: string, version: string | null, - config: ToolingConfig | null, + config: ToolingConfig | SkippedToolingConfig | null, ): PackageDependency { if (version === null) { return { depName: name, skipReason: 'unspecified-version' }; diff --git a/lib/modules/manager/mise/index.ts b/lib/modules/manager/mise/index.ts index 6396a47dec96ce..c7e625dca68639 100644 --- a/lib/modules/manager/mise/index.ts +++ b/lib/modules/manager/mise/index.ts @@ -1,3 +1,13 @@ +import { deduplicateArray } from '../../../util/array'; +import { CrateDatasource } from '../../datasource/crate'; +import { GithubReleasesDatasource } from '../../datasource/github-releases'; +import { GithubTagsDatasource } from '../../datasource/github-tags'; +import { GoDatasource } from '../../datasource/go'; +import { JavaVersionDatasource } from '../../datasource/java-version'; +import { NodeVersionDatasource } from '../../datasource/node-version'; +import { NpmDatasource } from '../../datasource/npm'; +import { PypiDatasource } from '../../datasource/pypi'; +import { RubyVersionDatasource } from '../../datasource/ruby-version'; import { supportedDatasources as asdfSupportedDatasources } from '../asdf'; export { extractPackageFile } from './extract'; @@ -9,5 +19,27 @@ export const defaultConfig = { fileMatch: ['(^|/)\\.?mise\\.toml$', '(^|/)\\.?mise/config\\.toml$'], }; -// Re-use the asdf datasources, as mise and asdf support the same plugins. -export const supportedDatasources = asdfSupportedDatasources; +const backendDatasources = { + core: [ + GithubReleasesDatasource.id, + GithubTagsDatasource.id, + JavaVersionDatasource.id, + NodeVersionDatasource.id, + RubyVersionDatasource.id, + ], + // Re-use the asdf datasources, as mise and asdf support the same plugins. + asdf: asdfSupportedDatasources, + aqua: [GithubTagsDatasource.id], + cargo: [CrateDatasource.id], + go: [GoDatasource.id], + npm: [NpmDatasource.id], + pipx: [PypiDatasource.id, GithubTagsDatasource.id], + spm: [GithubReleasesDatasource.id], + ubi: [GithubReleasesDatasource.id], + // not supported + vfox: [], +}; + +export const supportedDatasources = deduplicateArray( + Object.values(backendDatasources).flat(), +); diff --git a/lib/modules/manager/mise/readme.md b/lib/modules/manager/mise/readme.md index 4def797b88ad3f..33a4034e03df51 100644 --- a/lib/modules/manager/mise/readme.md +++ b/lib/modules/manager/mise/readme.md @@ -1,9 +1,4 @@ -Renovate can update the [mise](https://mise.jdx.dev/configuration.html#mise-toml) `.mise.toml` file. - -Renovate's `mise` manager can version these tools: - - - +Renovate can update the [mise](https://mise.jdx.dev/configuration.html#mise-toml) `mise.toml` file. ### Renovate only updates primary versions @@ -34,7 +29,7 @@ This follows the same workflow that Renovate's `asdf` manager uses. Renovate uses: -- [mise's plugins](https://github.com/jdx/mise/tree/main/src/plugins/core) +- [mise's core tools](https://github.com/jdx/mise/tree/main/src/plugins/core) - [asdf's plugins](https://mise.jdx.dev/registry.html) to understand and manage tool versioning. @@ -53,3 +48,31 @@ If `mise` adds support for more tools via its own [core plugins](https://mise.jd You may be able to add support for new tooling upstream in the core plugins - create an issue and see if the community agrees whether it belongs there, or if it would be better as an `asdf-` plugin. If you are wanting to add support for an existing `asdf-x` plugin to `mise`, you can create a PR to extend Renovate's `asdf` manager, which indirectly helps Renovate's `mise` manager as well. + +### Unsupported tools + +- `core`, `asdf`, and `vfox` backended tools are only supported if they are in the default registry of `mise`. + +- asdf and vfox plugins are not supported unless they are in the default registry of mise. + +- Non-GitHub aqua backend package types. +mise only supports http now (2024/12/07) + +// ref: + + +- aqua versions filter is not supported. use extractVersion manually. + +- ubi tag_regex is supported but not perfectly compatible, as re2 and rust regex engines are different. + +- cargo backend supports github installation but doesn't support it + + +- strips leading v from version + +### Supported default registry short tool names + +Renovate's `mise` manager can only version these tools in the default registry: + + + diff --git a/lib/modules/manager/mise/schema.ts b/lib/modules/manager/mise/schema.ts index b4614ebff9ca83..2e264fd92791be 100644 --- a/lib/modules/manager/mise/schema.ts +++ b/lib/modules/manager/mise/schema.ts @@ -1,9 +1,17 @@ import { z } from 'zod'; import { Toml } from '../../../util/schema-utils'; +const MiseToolOptionsSchema = z.object({ + // ubi backend only + tag_regex: z.string().optional(), +}); +export type MiseToolOptionsSchema = z.infer; + const MiseToolSchema = z.union([ z.string(), - z.object({ version: z.string().optional() }), + MiseToolOptionsSchema.extend({ + version: z.string().optional(), + }), z.array(z.string()), ]); export type MiseToolSchema = z.infer; From cbdb797ee66247da9abfbff6b93d2f1fb95ffb83 Mon Sep 17 00:00:00 2001 From: Risu <79110363+risu729@users.noreply.github.com> Date: Sun, 15 Dec 2024 10:53:05 +0900 Subject: [PATCH 02/30] refactor: split backends to new file --- lib/modules/manager/mise/backends.spec.ts | 143 ++++++++++++++++++ lib/modules/manager/mise/backends.ts | 163 +++++++++++++++++++++ lib/modules/manager/mise/extract.spec.ts | 33 ----- lib/modules/manager/mise/extract.ts | 168 ++-------------------- lib/modules/manager/mise/readme.md | 10 +- 5 files changed, 321 insertions(+), 196 deletions(-) create mode 100644 lib/modules/manager/mise/backends.spec.ts create mode 100644 lib/modules/manager/mise/backends.ts diff --git a/lib/modules/manager/mise/backends.spec.ts b/lib/modules/manager/mise/backends.spec.ts new file mode 100644 index 00000000000000..ac8954e867e582 --- /dev/null +++ b/lib/modules/manager/mise/backends.spec.ts @@ -0,0 +1,143 @@ +import { + createAquaToolConfig, + createCargoToolConfig, + createGoToolConfig, + createNpmToolConfig, + createPipxToolConfig, + createSpmToolConfig, + createUbiToolConfig, +} from './backends'; + +describe('modules/manager/mise/backends', () => { + describe('createAquaToolConfig()', () => { + it('should create a tooling config', () => { + expect(createAquaToolConfig('BurntSushi/ripgrep')).toEqual({ + packageName: 'BurntSushi/ripgrep', + datasource: 'github-tags', + }); + }); + }); + + describe('createCargoToolConfig()', () => { + it('should create a tooling config for crate', () => { + expect(createCargoToolConfig('eza')).toEqual({ + packageName: 'eza', + datasource: 'crate', + }); + }); + + it('provides skipReason for git repository url', () => { + expect( + createCargoToolConfig('https://github.com/username/demo1'), + ).toEqual({ + packageName: 'https://github.com/username/demo1', + skipReason: 'unsupported-url', + }); + }); + }); + + describe('createGoToolConfig()', () => { + it('should create a tooling config', () => { + expect(createGoToolConfig('github.com/DarthSim/hivemind')).toEqual({ + packageName: 'github.com/DarthSim/hivemind', + datasource: 'go', + }); + }); + }); + + describe('createNpmToolConfig()', () => { + it('should create a tooling config', () => { + expect(createNpmToolConfig('prettier')).toEqual({ + packageName: 'prettier', + datasource: 'npm', + }); + }); + }); + + describe('createPipxToolConfig()', () => { + it('should create a tooling config for pypi package', () => { + expect(createPipxToolConfig('yamllint')).toEqual({ + packageName: 'yamllint', + datasource: 'pypi', + }); + }); + + it('should create a tooling config for github shorthand', () => { + expect(createPipxToolConfig('psf/black')).toEqual({ + packageName: 'psf/black', + datasource: 'github-tags', + }); + }); + + it('should create a tooling config for github url', () => { + expect( + createPipxToolConfig('git+https://github.com/psf/black.git'), + ).toEqual({ + packageName: 'psf/black', + datasource: 'github-tags', + }); + }); + + it('provides skipReason for zip file url', () => { + expect( + createPipxToolConfig('https://github.com/psf/black/archive/18.9b0.zip'), + ).toEqual({ + packageName: 'https://github.com/psf/black/archive/18.9b0.zip', + skipReason: 'unsupported-url', + }); + }); + }); + + describe('createSpmToolConfig()', () => { + it('should create a tooling config for github shorthand', () => { + expect(createSpmToolConfig('tuist/tuist')).toEqual({ + packageName: 'tuist/tuist', + datasource: 'github-releases', + }); + }); + + it('should create a tooling config for github url', () => { + expect(createSpmToolConfig('https://github.com/tuist/tuist.git')).toEqual( + { + packageName: 'tuist/tuist', + datasource: 'github-releases', + }, + ); + }); + + it('provides skipReason for other url', () => { + expect(createSpmToolConfig('https://gitlab.com/user/repo.git')).toEqual({ + packageName: 'https://gitlab.com/user/repo.git', + skipReason: 'unsupported-url', + }); + }); + }); + + describe('createUbiToolConfig()', () => { + it('should create a tooling config with empty options', () => { + expect(createUbiToolConfig('nekto/act', {})).toEqual({ + packageName: 'nekto/act', + datasource: 'github-releases', + }); + + it('should ignore options unless tag_regex is provided', () => { + expect(createUbiToolConfig('cli/cli', { exe: 'gh' } as any)).toEqual({ + packageName: 'cli/cli', + datasource: 'github-releases', + }); + }); + + it('should set extractVersion if tag_regex is provided', () => { + expect( + createUbiToolConfig('cargo-bins/cargo-binstall', { + tag_regex: '^\\d+\\.\\d+\\.', + }), + ).toEqual({ + packageName: 'cargo-bins/cargo-binstall', + datasource: 'github-releases', + extractVersion: '(?^\\d+\\.\\d+\\.)', + }); + }); + }); + }); +}); diff --git a/lib/modules/manager/mise/backends.ts b/lib/modules/manager/mise/backends.ts new file mode 100644 index 00000000000000..e37c0debae5b10 --- /dev/null +++ b/lib/modules/manager/mise/backends.ts @@ -0,0 +1,163 @@ +import is from '@sindresorhus/is'; +import { regEx } from '../../../util/regex'; +import { CrateDatasource } from '../../datasource/crate'; +import { GithubReleasesDatasource } from '../../datasource/github-releases'; +import { GithubTagsDatasource } from '../../datasource/github-tags'; +import { GoDatasource } from '../../datasource/go'; +import { NpmDatasource } from '../../datasource/npm'; +import { PypiDatasource } from '../../datasource/pypi'; +import { normalizePythonDepName } from '../../datasource/pypi/common'; +import type { ToolingConfig } from '../asdf/upgradeable-tooling'; +import type { PackageDependency } from '../types'; +import type { MiseToolOptionsSchema } from './schema'; + +export type SkippedToolingConfig = Partial & + Required>; + +/** + * Create a tooling config for aqua backend + * @link https://mise.jdx.dev/dev-tools/backends/aqua.html + */ +export function createAquaToolConfig(name: string): ToolingConfig { + // mise supports http aqua package type but we cannot determine it from the tool name + // An error will be thrown afterwards if the package type is http + // ref: https://github.com/jdx/mise/blob/d1b9749d8f3e13ef705c1ea471d96c5935b79136/src/aqua/aqua_registry.rs#L39-L45 + return { + packageName: name, + datasource: GithubTagsDatasource.id, + }; +} + +/** + * Create a tooling config for cargo backend + * @link https://mise.jdx.dev/dev-tools/backends/cargo.html + */ +export function createCargoToolConfig( + name: string, +): ToolingConfig | SkippedToolingConfig { + // TODO: support url syntax + // Avoid type narrowing to prevent type error + if ((is.urlString as (value: unknown) => boolean)(name)) { + return { + packageName: name, + skipReason: 'unsupported-url', + }; + } + return { + packageName: name, + datasource: CrateDatasource.id, + }; +} + +/** + * Create a tooling config for go backend + * @link https://mise.jdx.dev/dev-tools/backends/go.html + */ +export function createGoToolConfig(name: string): ToolingConfig { + return { + packageName: name, + datasource: GoDatasource.id, + }; +} + +/** + * Create a tooling config for npm backend + * @link https://mise.jdx.dev/dev-tools/backends/npm.html + */ +export function createNpmToolConfig(name: string): ToolingConfig { + return { + packageName: name, + datasource: NpmDatasource.id, + }; +} + +const pipxGitHubRegex = regEx(/^git\+https:\/\/github\.com\/(?.+)\.git$/); + +/** + * Create a tooling config for pipx backend + * @link https://mise.jdx.dev/dev-tools/backends/pipx.html + */ +export function createPipxToolConfig( + name: string, +): ToolingConfig | SkippedToolingConfig { + const isGitSyntax = name.startsWith('git+'); + // Does not support zip file url + // Avoid type narrowing to prevent type error + if (!isGitSyntax && (is.urlString as (value: unknown) => boolean)(name)) { + return { + packageName: name, + skipReason: 'unsupported-url', + }; + } + if (isGitSyntax || name.includes('/')) { + let repoName: string | undefined; + if (isGitSyntax) { + repoName = pipxGitHubRegex.exec(name)?.groups?.repo; + // mise only supports specifying the version tag for github repos + if (is.undefined(repoName)) { + return { + packageName: name, + skipReason: 'unsupported-url', + }; + } + } else { + repoName = name; + } + return { + packageName: repoName, + datasource: GithubTagsDatasource.id, + }; + } + return { + packageName: normalizePythonDepName(name), + datasource: PypiDatasource.id, + }; +} + +const spmGitHubRegex = regEx(/^https:\/\/github.com\/(?.+).git$/); + +/** + * Create a tooling config for spm backend + * @link https://mise.jdx.dev/dev-tools/backends/spm.html + */ +export function createSpmToolConfig( + name: string, +): ToolingConfig | SkippedToolingConfig { + let repoName: string | undefined; + // Avoid type narrowing to prevent type error + if ((is.urlString as (value: unknown) => boolean)(name)) { + repoName = spmGitHubRegex.exec(name)?.groups?.repo; + // spm backend only supports github repos + if (!repoName) { + return { + packageName: name, + skipReason: 'unsupported-url', + }; + } + } + return { + packageName: repoName ?? name, + datasource: GithubReleasesDatasource.id, + }; +} + +/** + * Create a tooling config for ubi backend + * @link https://mise.jdx.dev/dev-tools/backends/ubi.html + */ +export function createUbiToolConfig( + name: string, + toolOptions: MiseToolOptionsSchema, +): ToolingConfig { + return { + packageName: name, + datasource: GithubReleasesDatasource.id, + ...(toolOptions.tag_regex + ? { + // Filter versions by tag_regex if it is specified + // ref: https://mise.jdx.dev/dev-tools/backends/ubi.html#ubi-uses-weird-versions + extractVersion: `(?${toolOptions.tag_regex})`, + } + : {}), + }; +} diff --git a/lib/modules/manager/mise/extract.spec.ts b/lib/modules/manager/mise/extract.spec.ts index c4532263f967eb..18cb7378858d07 100644 --- a/lib/modules/manager/mise/extract.spec.ts +++ b/lib/modules/manager/mise/extract.spec.ts @@ -238,9 +238,6 @@ describe('modules/manager/mise/extract', () => { "pipx:yamllint" = "1.35.0" "pipx:psf/black" = "24.4.1" "pipx:git+https://github.com/psf/black.git" = "24.4.1" - "pipx:git+https://gitlab.com/user/repo.git" = "0.1.0" - # Does not work but the mise docs says supporting - "pipx:https://github.com/psf/black/archive/18.9b0.zip" = "latest" `; const result = extractPackageFile(content, miseFilename); expect(result).toMatchObject({ @@ -263,16 +260,6 @@ describe('modules/manager/mise/extract', () => { packageName: 'psf/black', datasource: 'github-tags', }, - { - depName: 'pipx:git+https://gitlab.com/user/repo.git', - packageName: 'git+https://gitlab.com/user/repo.git', - skipReason: 'unsupported-url', - }, - { - depName: 'pipx:https://github.com/psf/black/archive/18.9b0.zip', - packageName: 'https://github.com/psf/black/archive/18.9b0.zip', - skipReason: 'unsupported-url', - }, ], }); }); @@ -282,7 +269,6 @@ describe('modules/manager/mise/extract', () => { [tools] "spm:tuist/tuist" = "4.15.0" "spm:https://github.com/tuist/tuist.git" = "4.13.0" - "spm:https://gitlab.com/user/repo.git" = "0.1.0" `; const result = extractPackageFile(content, miseFilename); expect(result).toMatchObject({ @@ -299,11 +285,6 @@ describe('modules/manager/mise/extract', () => { packageName: 'tuist/tuist', datasource: 'github-releases', }, - { - depName: 'spm:https://gitlab.com/user/repo.git', - packageName: 'https://gitlab.com/user/repo.git', - skipReason: 'unsupported-url', - }, ], }); }); @@ -314,8 +295,6 @@ describe('modules/manager/mise/extract', () => { "ubi:nekto/act" = "0.2.70" "ubi:cli/cli" = { exe = "gh", version = "1.14.0" } "ubi:cli/cli[exe=gh]" = "1.14.0" - "ubi:tamasfe/taplo" = { matching = "full", version = "0.1.0" } - "ubi:tamasfe/taplo[matching=full]" = "0.1.0" "ubi:cargo-bins/cargo-binstall" = { tag_regex = "^\\d+\\.\\d+\\.", version = "1.0.0" } "ubi:cargo-bins/cargo-binstall[tag_regex=^\\d+\\.]" = "1.0.0" "ubi:cargo-bins/cargo-binstall[tag_regex=^\\d+\\.\\d+\\.]" = { tag_regex = "^\\d+\\.", version = "1.0.0" } @@ -341,18 +320,6 @@ describe('modules/manager/mise/extract', () => { packageName: 'cli/cli', datasource: 'github-releases', }, - { - depName: 'ubi:tamasfe/taplo', - currentValue: '0.1.0', - packageName: 'tamasfe/taplo', - datasource: 'github-releases', - }, - { - depName: 'ubi:tamasfe/taplo', - currentValue: '0.1.0', - packageName: 'tamasfe/taplo', - datasource: 'github-releases', - }, { depName: 'ubi:cargo-bins/cargo-binstall', currentValue: '1.0.0', diff --git a/lib/modules/manager/mise/extract.ts b/lib/modules/manager/mise/extract.ts index 8d757bd36e026c..77458bcf4271a4 100644 --- a/lib/modules/manager/mise/extract.ts +++ b/lib/modules/manager/mise/extract.ts @@ -1,15 +1,18 @@ import is from '@sindresorhus/is'; import { logger } from '../../../logger'; import { regEx } from '../../../util/regex'; -import { CrateDatasource } from '../../datasource/crate'; -import { GithubReleasesDatasource } from '../../datasource/github-releases'; -import { GithubTagsDatasource } from '../../datasource/github-tags'; -import { GoDatasource } from '../../datasource/go'; -import { NpmDatasource } from '../../datasource/npm'; -import { PypiDatasource } from '../../datasource/pypi'; -import { normalizePythonDepName } from '../../datasource/pypi/common'; import type { ToolingConfig } from '../asdf/upgradeable-tooling'; import type { PackageDependency, PackageFileContent } from '../types'; +import { + createAquaToolConfig, + createCargoToolConfig, + createGoToolConfig, + createNpmToolConfig, + createPipxToolConfig, + createSpmToolConfig, + createUbiToolConfig, +} from './backends'; +import type { SkippedToolingConfig } from './backends'; import type { MiseToolOptionsSchema, MiseToolSchema } from './schema'; import type { ToolingDefinition } from './upgradeable-tooling'; import { asdfTooling, miseTooling } from './upgradeable-tooling'; @@ -89,9 +92,6 @@ function parseOptions( }; } -type SkippedToolingConfig = Partial & - Required>; - function getToolConfig( name: string, version: string | null, @@ -173,154 +173,6 @@ function getConfigFromTooling( ); // Ensure null is returned instead of undefined } -/** - * Create a tooling config for aqua backend - * @link https://mise.jdx.dev/dev-tools/backends/aqua.html - */ -function createAquaToolConfig(name: string): ToolingConfig { - // mise supports http aqua package type but we cannot determine it from the tool name - // An error will be thrown afterwards if the package type is http - // ref: https://github.com/jdx/mise/blob/d1b9749d8f3e13ef705c1ea471d96c5935b79136/src/aqua/aqua_registry.rs#L39-L45 - return { - packageName: name, - datasource: GithubTagsDatasource.id, - }; -} - -/** - * Create a tooling config for cargo backend - * @link https://mise.jdx.dev/dev-tools/backends/cargo.html - */ -function createCargoToolConfig( - name: string, -): ToolingConfig | SkippedToolingConfig { - // TODO: support url syntax - // Avoid type narrowing to prevent type error - if ((is.urlString as (value: unknown) => boolean)(name)) { - return { - packageName: name, - skipReason: 'unsupported-url', - }; - } - return { - packageName: name, - datasource: CrateDatasource.id, - }; -} - -/** - * Create a tooling config for go backend - * @link https://mise.jdx.dev/dev-tools/backends/go.html - */ -function createGoToolConfig(name: string): ToolingConfig { - return { - packageName: name, - datasource: GoDatasource.id, - }; -} - -/** - * Create a tooling config for npm backend - * @link https://mise.jdx.dev/dev-tools/backends/npm.html - */ -function createNpmToolConfig(name: string): ToolingConfig { - return { - packageName: name, - datasource: NpmDatasource.id, - }; -} - -const pipxGitHubRegex = regEx(/^git\+https:\/\/github\.com\/(?.+)\.git$/); - -/** - * Create a tooling config for pipx backend - * @link https://mise.jdx.dev/dev-tools/backends/pipx.html - */ -function createPipxToolConfig( - name: string, -): ToolingConfig | SkippedToolingConfig { - const isGitSyntax = name.startsWith('git+'); - // Does not support zip file url - // Avoid type narrowing to prevent type error - if (!isGitSyntax && (is.urlString as (value: unknown) => boolean)(name)) { - return { - packageName: name, - skipReason: 'unsupported-url', - }; - } - if (isGitSyntax || name.includes('/')) { - let repoName: string | undefined; - if (isGitSyntax) { - repoName = pipxGitHubRegex.exec(name)?.groups?.repo; - // mise only supports specifying the version tag for github repos - if (is.undefined(repoName)) { - return { - packageName: name, - skipReason: 'unsupported-url', - }; - } - } else { - repoName = name; - } - return { - packageName: repoName, - datasource: GithubTagsDatasource.id, - }; - } - return { - packageName: normalizePythonDepName(name), - datasource: PypiDatasource.id, - }; -} - -const spmGitHubRegex = regEx(/^https:\/\/github.com\/(?.+).git$/); - -/** - * Create a tooling config for spm backend - * @link https://mise.jdx.dev/dev-tools/backends/spm.html - */ -function createSpmToolConfig( - name: string, -): ToolingConfig | SkippedToolingConfig { - let repoName: string | undefined; - // Avoid type narrowing to prevent type error - if ((is.urlString as (value: unknown) => boolean)(name)) { - repoName = spmGitHubRegex.exec(name)?.groups?.repo; - // spm backend only supports github repos - if (!repoName) { - return { - packageName: name, - skipReason: 'unsupported-url', - }; - } - } - return { - packageName: repoName ?? name, - datasource: GithubReleasesDatasource.id, - }; -} - -/** - * Create a tooling config for ubi backend - * @link https://mise.jdx.dev/dev-tools/backends/ubi.html - */ -function createUbiToolConfig( - name: string, - toolOptions: MiseToolOptionsSchema, -): ToolingConfig { - return { - packageName: name, - datasource: GithubReleasesDatasource.id, - ...(toolOptions.tag_regex - ? { - // Filter versions by tag_regex if it is specified - // ref: https://mise.jdx.dev/dev-tools/backends/ubi.html#ubi-uses-weird-versions - extractVersion: `(?${toolOptions.tag_regex})`, - } - : {}), - }; -} - function createDependency( name: string, version: string | null, diff --git a/lib/modules/manager/mise/readme.md b/lib/modules/manager/mise/readme.md index 33a4034e03df51..6845111cdc68f9 100644 --- a/lib/modules/manager/mise/readme.md +++ b/lib/modules/manager/mise/readme.md @@ -56,17 +56,17 @@ If you are wanting to add support for an existing `asdf-x` plugin to `mise`, you - asdf and vfox plugins are not supported unless they are in the default registry of mise. - Non-GitHub aqua backend package types. -mise only supports http now (2024/12/07) - -// ref: - + mise only supports http now (2024/12/07) + + // ref: + - aqua versions filter is not supported. use extractVersion manually. - ubi tag_regex is supported but not perfectly compatible, as re2 and rust regex engines are different. - cargo backend supports github installation but doesn't support it - + - strips leading v from version From b6886a9a3fc3eb3f60ed0eb127fce9482fa6dc3e Mon Sep 17 00:00:00 2001 From: Risu <79110363+risu729@users.noreply.github.com> Date: Sun, 15 Dec 2024 10:54:52 +0900 Subject: [PATCH 03/30] test: fix nested tests --- lib/modules/manager/mise/backends.spec.ts | 30 +++++++++++------------ 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/modules/manager/mise/backends.spec.ts b/lib/modules/manager/mise/backends.spec.ts index ac8954e867e582..188aeaba4d06b9 100644 --- a/lib/modules/manager/mise/backends.spec.ts +++ b/lib/modules/manager/mise/backends.spec.ts @@ -119,24 +119,24 @@ describe('modules/manager/mise/backends', () => { packageName: 'nekto/act', datasource: 'github-releases', }); + }); - it('should ignore options unless tag_regex is provided', () => { - expect(createUbiToolConfig('cli/cli', { exe: 'gh' } as any)).toEqual({ - packageName: 'cli/cli', - datasource: 'github-releases', - }); + it('should ignore options unless tag_regex is provided', () => { + expect(createUbiToolConfig('cli/cli', { exe: 'gh' } as any)).toEqual({ + packageName: 'cli/cli', + datasource: 'github-releases', }); + }); - it('should set extractVersion if tag_regex is provided', () => { - expect( - createUbiToolConfig('cargo-bins/cargo-binstall', { - tag_regex: '^\\d+\\.\\d+\\.', - }), - ).toEqual({ - packageName: 'cargo-bins/cargo-binstall', - datasource: 'github-releases', - extractVersion: '(?^\\d+\\.\\d+\\.)', - }); + it('should set extractVersion if tag_regex is provided', () => { + expect( + createUbiToolConfig('cargo-bins/cargo-binstall', { + tag_regex: '^\\d+\\.\\d+\\.', + }), + ).toEqual({ + packageName: 'cargo-bins/cargo-binstall', + datasource: 'github-releases', + extractVersion: '(?^\\d+\\.\\d+\\.)', }); }); }); From 8b6c6aa8ccec35319490a3d4c29f8188ebb0ba74 Mon Sep 17 00:00:00 2001 From: Risu <79110363+risu729@users.noreply.github.com> Date: Sun, 15 Dec 2024 11:00:59 +0900 Subject: [PATCH 04/30] test: remove tests with escapes --- lib/modules/manager/mise/extract.spec.ts | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/lib/modules/manager/mise/extract.spec.ts b/lib/modules/manager/mise/extract.spec.ts index 18cb7378858d07..3ff235f3814885 100644 --- a/lib/modules/manager/mise/extract.spec.ts +++ b/lib/modules/manager/mise/extract.spec.ts @@ -295,9 +295,6 @@ describe('modules/manager/mise/extract', () => { "ubi:nekto/act" = "0.2.70" "ubi:cli/cli" = { exe = "gh", version = "1.14.0" } "ubi:cli/cli[exe=gh]" = "1.14.0" - "ubi:cargo-bins/cargo-binstall" = { tag_regex = "^\\d+\\.\\d+\\.", version = "1.0.0" } - "ubi:cargo-bins/cargo-binstall[tag_regex=^\\d+\\.]" = "1.0.0" - "ubi:cargo-bins/cargo-binstall[tag_regex=^\\d+\\.\\d+\\.]" = { tag_regex = "^\\d+\\.", version = "1.0.0" } `; const result = extractPackageFile(content, miseFilename); expect(result).toMatchObject({ @@ -320,27 +317,6 @@ describe('modules/manager/mise/extract', () => { packageName: 'cli/cli', datasource: 'github-releases', }, - { - depName: 'ubi:cargo-bins/cargo-binstall', - currentValue: '1.0.0', - packageName: 'cargo-bins/cargo-binstall', - datasource: 'github-releases', - extractVersion: '(?\\d+\\.\\d+\\.)', - }, - { - depName: 'ubi:cargo-bins/cargo-binstall', - currentValue: '1.0.0', - packageName: 'cargo-bins/cargo-binstall', - datasource: 'github-releases', - extractVersion: '(?\\d+\\.)', - }, - { - depName: 'ubi:cargo-bins/cargo-binstall', - currentValue: '1.0.0', - packageName: 'cargo-bins/cargo-binstall', - datasource: 'github-releases', - extractVersion: '(?\\d+\\.)', - }, ], }); }); From 27d6b1d0b3aeee003f2431795be948d79cdcdaf2 Mon Sep 17 00:00:00 2001 From: Risu <79110363+risu729@users.noreply.github.com> Date: Sun, 15 Dec 2024 11:34:56 +0900 Subject: [PATCH 05/30] test: fix toml escapes in fixtures --- lib/modules/manager/mise/extract.spec.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/lib/modules/manager/mise/extract.spec.ts b/lib/modules/manager/mise/extract.spec.ts index 3ff235f3814885..2a899ebc9918e4 100644 --- a/lib/modules/manager/mise/extract.spec.ts +++ b/lib/modules/manager/mise/extract.spec.ts @@ -295,6 +295,9 @@ describe('modules/manager/mise/extract', () => { "ubi:nekto/act" = "0.2.70" "ubi:cli/cli" = { exe = "gh", version = "1.14.0" } "ubi:cli/cli[exe=gh]" = "1.14.0" + "ubi:cargo-bins/cargo-binstall" = { tag_regex = "^\\\\d+\\\\.\\\\d+\\\\.", version = "1.0.0" } + "ubi:cargo-bins/cargo-binstall[tag_regex=^\\\\d+\\\\.]" = "1.0.0" + 'ubi:cargo-bins/cargo-binstall[tag_regex=^\\d+\\.\\d+\\.]' = { tag_regex = '^\\d+\\.', version = "1.0.0" } `; const result = extractPackageFile(content, miseFilename); expect(result).toMatchObject({ @@ -317,6 +320,27 @@ describe('modules/manager/mise/extract', () => { packageName: 'cli/cli', datasource: 'github-releases', }, + { + depName: 'ubi:cargo-bins/cargo-binstall', + currentValue: '1.0.0', + packageName: 'cargo-bins/cargo-binstall', + datasource: 'github-releases', + extractVersion: '(?\\d+\\.\\d+\\.)', + }, + { + depName: 'ubi:cargo-bins/cargo-binstall', + currentValue: '1.0.0', + packageName: 'cargo-bins/cargo-binstall', + datasource: 'github-releases', + extractVersion: '(?\\d+\\.)', + }, + { + depName: 'ubi:cargo-bins/cargo-binstall', + currentValue: '1.0.0', + packageName: 'cargo-bins/cargo-binstall', + datasource: 'github-releases', + extractVersion: '(?\\d+\\.)', + }, ], }); }); From 01e306f022824490229484da0bd71d1b32cf12ed Mon Sep 17 00:00:00 2001 From: Risu <79110363+risu729@users.noreply.github.com> Date: Sun, 15 Dec 2024 11:45:09 +0900 Subject: [PATCH 06/30] fix: fix regex --- lib/modules/manager/mise/extract.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/modules/manager/mise/extract.ts b/lib/modules/manager/mise/extract.ts index 77458bcf4271a4..0276370a5fb9a7 100644 --- a/lib/modules/manager/mise/extract.ts +++ b/lib/modules/manager/mise/extract.ts @@ -20,7 +20,7 @@ import { parseTomlFile } from './utils'; // Tool names can have options in the tool name // e.g. ubi:tamasfe/taplo[matching=full,exe=taplo] -const optionInToolNameRegex = regEx(/^(?.+)(?:\[(?.+)\])?$/); +const optionInToolNameRegex = regEx(/^(?.+?)(?:\[(?.+)\])?$/); export function extractPackageFile( content: string, From fd9118e7a0e0b39e508d1e5b2ecfd3169a484994 Mon Sep 17 00:00:00 2001 From: Risu <79110363+risu729@users.noreply.github.com> Date: Sun, 15 Dec 2024 11:48:44 +0900 Subject: [PATCH 07/30] test: add missing caret --- lib/modules/manager/mise/extract.spec.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/modules/manager/mise/extract.spec.ts b/lib/modules/manager/mise/extract.spec.ts index 2a899ebc9918e4..c3d99699a6c6e3 100644 --- a/lib/modules/manager/mise/extract.spec.ts +++ b/lib/modules/manager/mise/extract.spec.ts @@ -325,21 +325,21 @@ describe('modules/manager/mise/extract', () => { currentValue: '1.0.0', packageName: 'cargo-bins/cargo-binstall', datasource: 'github-releases', - extractVersion: '(?\\d+\\.\\d+\\.)', + extractVersion: '(?^\\d+\\.\\d+\\.)', }, { depName: 'ubi:cargo-bins/cargo-binstall', currentValue: '1.0.0', packageName: 'cargo-bins/cargo-binstall', datasource: 'github-releases', - extractVersion: '(?\\d+\\.)', + extractVersion: '(?^\\d+\\.)', }, { depName: 'ubi:cargo-bins/cargo-binstall', currentValue: '1.0.0', packageName: 'cargo-bins/cargo-binstall', datasource: 'github-releases', - extractVersion: '(?\\d+\\.)', + extractVersion: '(?^\\d+\\.)', }, ], }); From 68af992b7b93185ae7927391592d0a21b07566aa Mon Sep 17 00:00:00 2001 From: Risu <79110363+risu729@users.noreply.github.com> Date: Sun, 15 Dec 2024 20:30:41 +0900 Subject: [PATCH 08/30] feat: support git url syntax of cargo backended tools --- lib/modules/manager/mise/backends.spec.ts | 42 ++++++++++++++++++--- lib/modules/manager/mise/backends.ts | 45 +++++++++++++++++++---- lib/modules/manager/mise/extract.spec.ts | 8 ++-- lib/modules/manager/mise/extract.ts | 14 ++++--- lib/modules/manager/mise/index.ts | 4 +- 5 files changed, 91 insertions(+), 22 deletions(-) diff --git a/lib/modules/manager/mise/backends.spec.ts b/lib/modules/manager/mise/backends.spec.ts index 188aeaba4d06b9..37aa7e5f5c582e 100644 --- a/lib/modules/manager/mise/backends.spec.ts +++ b/lib/modules/manager/mise/backends.spec.ts @@ -20,18 +20,50 @@ describe('modules/manager/mise/backends', () => { describe('createCargoToolConfig()', () => { it('should create a tooling config for crate', () => { - expect(createCargoToolConfig('eza')).toEqual({ + expect(createCargoToolConfig('eza', '')).toEqual({ packageName: 'eza', datasource: 'crate', }); }); - it('provides skipReason for git repository url', () => { + it('should create a tooling config for git tag', () => { expect( - createCargoToolConfig('https://github.com/username/demo1'), + createCargoToolConfig('https://github.com/username/demo', 'tag:v0.1.0'), ).toEqual({ - packageName: 'https://github.com/username/demo1', - skipReason: 'unsupported-url', + packageName: 'https://github.com/username/demo', + currentValue: 'v0.1.0', + datasource: 'git-tags', + }); + }); + + it('should provide skipReason for git branch', () => { + expect( + createCargoToolConfig( + 'https://github.com/username/demo', + 'branch:main', + ), + ).toEqual({ + packageName: 'https://github.com/username/demo', + skipReason: 'unsupported-version', + }); + }); + + it('should create a tooling config for git rev', () => { + expect( + createCargoToolConfig('https://github.com/username/demo', 'rev:abcdef'), + ).toEqual({ + packageName: 'https://github.com/username/demo', + currentValue: 'abcdef', + datasource: 'git-refs', + }); + }); + + it('should provide skipReason for invalid version', () => { + expect( + createCargoToolConfig('https://github.com/username/demo', 'v0.1.0'), + ).toEqual({ + packageName: 'https://github.com/username/demo', + skipReason: 'invalid-version', }); }); }); diff --git a/lib/modules/manager/mise/backends.ts b/lib/modules/manager/mise/backends.ts index e37c0debae5b10..c6080bb47c75ed 100644 --- a/lib/modules/manager/mise/backends.ts +++ b/lib/modules/manager/mise/backends.ts @@ -1,6 +1,8 @@ import is from '@sindresorhus/is'; import { regEx } from '../../../util/regex'; import { CrateDatasource } from '../../datasource/crate'; +import { GitRefsDatasource } from '../../datasource/git-refs'; +import { GitTagsDatasource } from '../../datasource/git-tags'; import { GithubReleasesDatasource } from '../../datasource/github-releases'; import { GithubTagsDatasource } from '../../datasource/github-tags'; import { GoDatasource } from '../../datasource/go'; @@ -28,25 +30,52 @@ export function createAquaToolConfig(name: string): ToolingConfig { }; } +const cargoGitVersionRegex = regEx(/^(?tag|branch|rev):(?.+)$/); + /** * Create a tooling config for cargo backend * @link https://mise.jdx.dev/dev-tools/backends/cargo.html */ export function createCargoToolConfig( name: string, + version: string, ): ToolingConfig | SkippedToolingConfig { - // TODO: support url syntax - // Avoid type narrowing to prevent type error - if ((is.urlString as (value: unknown) => boolean)(name)) { + // Avoid narrowing the type of name to never + if (!(is.urlString as (value: unknown) => boolean)(name)) { return { packageName: name, - skipReason: 'unsupported-url', + datasource: CrateDatasource.id, }; } - return { - packageName: name, - datasource: CrateDatasource.id, - }; + // tag: branch: or rev: is required for git repository url + // e.g. branch:main, tag:0.1.0, rev:abcdef + const matchGroups = cargoGitVersionRegex.exec(version)?.groups; + if (is.undefined(matchGroups)) { + return { + packageName: name, + skipReason: 'invalid-version', + }; + } + const { type, version: gitVersion } = matchGroups; + switch (type as 'tag' | 'branch' | 'rev') { + case 'tag': + return { + packageName: name, + datasource: GitTagsDatasource.id, + currentValue: gitVersion, + }; + case 'branch': + return { + packageName: name, + skipReason: 'unsupported-version', + }; + case 'rev': + return { + packageName: name, + datasource: GitRefsDatasource.id, + currentValue: gitVersion, + }; + } } /** diff --git a/lib/modules/manager/mise/extract.spec.ts b/lib/modules/manager/mise/extract.spec.ts index c3d99699a6c6e3..4561a8c0fb3073 100644 --- a/lib/modules/manager/mise/extract.spec.ts +++ b/lib/modules/manager/mise/extract.spec.ts @@ -179,18 +179,20 @@ describe('modules/manager/mise/extract', () => { }, { depName: 'cargo:https://github.com/username/demo1', + currentValue: 'v0.1.0', packageName: 'https://github.com/username/demo1', - skipReason: 'unsupported-url', + datasource: 'git-tags', }, { depName: 'cargo:https://github.com/username/demo2', packageName: 'https://github.com/username/demo2', - skipReason: 'unsupported-url', + skipReason: 'unsupported-version', }, { depName: 'cargo:https://github.com/username/demo3', + currentValue: 'abcdef', packageName: 'https://github.com/username/demo3', - skipReason: 'unsupported-url', + datasource: 'git-refs', }, ], }); diff --git a/lib/modules/manager/mise/extract.ts b/lib/modules/manager/mise/extract.ts index 0276370a5fb9a7..6d218117162f2f 100644 --- a/lib/modules/manager/mise/extract.ts +++ b/lib/modules/manager/mise/extract.ts @@ -1,5 +1,6 @@ import is from '@sindresorhus/is'; import { logger } from '../../../logger'; +import type { SkipReason } from '../../../types'; import { regEx } from '../../../util/regex'; import type { ToolingConfig } from '../asdf/upgradeable-tooling'; import type { PackageDependency, PackageFileContent } from '../types'; @@ -124,7 +125,7 @@ function getToolConfig( createAquaToolConfig(toolName) ); case 'cargo': - return createCargoToolConfig(toolName); + return createCargoToolConfig(toolName, version); case 'go': return createGoToolConfig(toolName); case 'npm': @@ -178,15 +179,18 @@ function createDependency( version: string | null, config: ToolingConfig | SkippedToolingConfig | null, ): PackageDependency { - if (version === null) { - return { depName: name, skipReason: 'unspecified-version' }; - } + let skipReason: SkipReason | undefined; if (config === null) { - return { depName: name, skipReason: 'unsupported-datasource' }; + skipReason = 'unsupported-datasource'; + } + if (version === null) { + skipReason = 'unspecified-version'; } return { depName: name, currentValue: version, + ...(skipReason ? { skipReason } : {}), + // Spread the config last to override other properties ...config, }; } diff --git a/lib/modules/manager/mise/index.ts b/lib/modules/manager/mise/index.ts index c7e625dca68639..8412ce32d534af 100644 --- a/lib/modules/manager/mise/index.ts +++ b/lib/modules/manager/mise/index.ts @@ -1,5 +1,7 @@ import { deduplicateArray } from '../../../util/array'; import { CrateDatasource } from '../../datasource/crate'; +import { GitRefsDatasource } from '../../datasource/git-refs'; +import { GitTagsDatasource } from '../../datasource/git-tags'; import { GithubReleasesDatasource } from '../../datasource/github-releases'; import { GithubTagsDatasource } from '../../datasource/github-tags'; import { GoDatasource } from '../../datasource/go'; @@ -30,7 +32,7 @@ const backendDatasources = { // Re-use the asdf datasources, as mise and asdf support the same plugins. asdf: asdfSupportedDatasources, aqua: [GithubTagsDatasource.id], - cargo: [CrateDatasource.id], + cargo: [CrateDatasource.id, GitTagsDatasource.id, GitRefsDatasource.id], go: [GoDatasource.id], npm: [NpmDatasource.id], pipx: [PypiDatasource.id, GithubTagsDatasource.id], From e303e6ae239918480c0cf6cbfa804545f3a73d7f Mon Sep 17 00:00:00 2001 From: Risu <79110363+risu729@users.noreply.github.com> Date: Sun, 15 Dec 2024 22:46:03 +0900 Subject: [PATCH 09/30] docs: update readme --- lib/modules/manager/mise/readme.md | 78 ++++++++++++++++++++---------- 1 file changed, 52 insertions(+), 26 deletions(-) diff --git a/lib/modules/manager/mise/readme.md b/lib/modules/manager/mise/readme.md index 6845111cdc68f9..c0c53354117f79 100644 --- a/lib/modules/manager/mise/readme.md +++ b/lib/modules/manager/mise/readme.md @@ -25,16 +25,11 @@ To maintain consistency and reliability, Renovate opts to only manage the _first This follows the same workflow that Renovate's `asdf` manager uses. -### Plugin/tool support +### Short names support -Renovate uses: +Renovate uses [mise registry](https://mise.jdx.dev/registry.html) to understand tools short names. -- [mise's core tools](https://github.com/jdx/mise/tree/main/src/plugins/core) -- [asdf's plugins](https://mise.jdx.dev/registry.html) - -to understand and manage tool versioning. - -Support for new tools/plugins needs to be _manually_ added to Renovate's logic. +Support for new tool short names needs to be _manually_ added to Renovate's logic. #### Adding new tool support @@ -43,36 +38,67 @@ There are 2 ways to integrate versioning for a new tool: - Renovate's `mise` manager: ensure upstream `mise` supports the tool, then add support to the `mise` manager in Renovate - Renovate's `asdf` manager: improve the `asdf` manager in Renovate, which automatically extends support to `mise` -If `mise` adds support for more tools via its own [core plugins](https://mise.jdx.dev/plugins.html#core-plugins), you can create a PR to extend Renovate's `mise` manager to add support for the new tooling. +If `mise` adds support for more tools via its own [core tools](https://mise.jdx.dev/core-tools.html), you can create a PR to extend Renovate's `mise` manager to add support for the new core tools. + +If you are wanting to add support for an other tools' short names to `mise`, you can create a PR to extend Renovate's `asdf` manager, which indirectly helps Renovate's `mise` manager as well. + +Note that some tools in the registry are not using the `asdf` backend. We are currently not supporting those tool short names. + +TODO: Change the registry lookup. + +### Backends support -You may be able to add support for new tooling upstream in the core plugins - create an issue and see if the community agrees whether it belongs there, or if it would be better as an `asdf-` plugin. +Renovate's `mise` manager supports the following [backends](https://mise.jdx.dev/dev-tools/backends/): -If you are wanting to add support for an existing `asdf-x` plugin to `mise`, you can create a PR to extend Renovate's `asdf` manager, which indirectly helps Renovate's `mise` manager as well. +- [`core`](https://mise.jdx.dev/core-tools.html) +- [`asdf`](https://mise.jdx.dev/dev-tools/backends/asdf.html) +- [`aqua`](https://mise.jdx.dev/dev-tools/backends/aqua.html) +- [`cargo`](https://mise.jdx.dev/dev-tools/backends/cargo.html) +- [`go`](https://mise.jdx.dev/dev-tools/backends/go.html) +- [`npm`](https://mise.jdx.dev/dev-tools/backends/npm.html) +- [`pipx`](https://mise.jdx.dev/dev-tools/backends/pipx.html) +- [`spm`](https://mise.jdx.dev/dev-tools/backends/spm.html) +- [`ubi`](https://mise.jdx.dev/dev-tools/backends/ubi.html) +- [`vfox`](https://mise.jdx.dev/dev-tools/backends/vfox.html) -### Unsupported tools +#### Limitations -- `core`, `asdf`, and `vfox` backended tools are only supported if they are in the default registry of `mise`. +Renovate's `mise` manager does not support the following tool syntax: -- asdf and vfox plugins are not supported unless they are in the default registry of mise. +- `asdf` and `vfox` plugins + e.g. `asdf:asdf:mise-plugins/asdf-yarn` or `vfox:vfox:version-fox/vfox-elixir` + Short names with backends like `asdf:yarn` or `vfox:elixir` are supported if the short names are supported. -- Non-GitHub aqua backend package types. - mise only supports http now (2024/12/07) - - // ref: - +- `aqua` packages with `http` [package type](https://aquaproj.github.io/docs/reference/registry-config/#package-types). + However if the short name using `aqua` backend is supported by Renovate, it will be updated. + e.g. [`aqua:helm/helm`](https://github.com/aquaproj/aqua-registry/blob/main/pkgs/helm/helm/registry.yaml) is not supported, but `helm` or `aqua:helm` is supported. -- aqua versions filter is not supported. use extractVersion manually. +- `aqua` packages with [`version_filter`](https://aquaproj.github.io/docs/reference/registry-config/version-prefix). + We don't read the aqua registry itself, so we can't support this feature. + If some packages using `version_filter` like [`aqua:biomejs/biome`](https://github.com/aquaproj/aqua-registry/blob/main/pkgs/biomejs/biome/registry.yaml) are not updated or updated incorrectly, set `extractVersion` in the Renovate config manually like below. -- ubi tag_regex is supported but not perfectly compatible, as re2 and rust regex engines are different. + ```json + { + "packageRules": [ + { + "depNames": ["aqua:biomejs/biome"], + "extractVersion": "cli/(?.+)" + } + ] + } + ``` -- cargo backend supports github installation but doesn't support it - +- `ubi` backend tools with [`tag_regex`](https://mise.jdx.dev/dev-tools/backends/ubi.html#ubi-uses-weird-versions) option. + The `tag_regex` option is used as `extractVersion`, but the regex engines are not the same between mise and Renovate. + If the version is not updated or updated incorrectly, override `extractVersion` manually in the renovate config. -- strips leading v from version +- Versions with `v` prefix. + mise automatically strips the `v` prefix from versions, but Renovate does not. + If the version is not updated or updated incorrectly, set `extractVersion` to `v(?.+)` in the Renovate config. -### Supported default registry short tool names +### Supported default registry tool short names -Renovate's `mise` manager can only version these tools in the default registry: +Renovate's `mise` manager can only version these tool short names: From 95be7f439d60b7657f38ebe12c5ff3b1c1db151f Mon Sep 17 00:00:00 2001 From: Risu <79110363+risu729@users.noreply.github.com> Date: Sun, 15 Dec 2024 22:52:28 +0900 Subject: [PATCH 10/30] feat: support pipx git hash syntax --- lib/modules/manager/mise/backends.ts | 6 +++--- lib/modules/manager/mise/index.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/modules/manager/mise/backends.ts b/lib/modules/manager/mise/backends.ts index c6080bb47c75ed..218b23cf2b72ae 100644 --- a/lib/modules/manager/mise/backends.ts +++ b/lib/modules/manager/mise/backends.ts @@ -122,11 +122,11 @@ export function createPipxToolConfig( let repoName: string | undefined; if (isGitSyntax) { repoName = pipxGitHubRegex.exec(name)?.groups?.repo; - // mise only supports specifying the version tag for github repos + // If the url is not a github repo, treat the version as a git ref if (is.undefined(repoName)) { return { - packageName: name, - skipReason: 'unsupported-url', + packageName: name.replace(/^git\+/, '').replaceAll(/\.git$/, ''), + datasource: GitRefsDatasource.id, }; } } else { diff --git a/lib/modules/manager/mise/index.ts b/lib/modules/manager/mise/index.ts index 8412ce32d534af..9534bbbe87dda2 100644 --- a/lib/modules/manager/mise/index.ts +++ b/lib/modules/manager/mise/index.ts @@ -35,7 +35,7 @@ const backendDatasources = { cargo: [CrateDatasource.id, GitTagsDatasource.id, GitRefsDatasource.id], go: [GoDatasource.id], npm: [NpmDatasource.id], - pipx: [PypiDatasource.id, GithubTagsDatasource.id], + pipx: [PypiDatasource.id, GithubTagsDatasource.id, GitRefsDatasource.id], spm: [GithubReleasesDatasource.id], ubi: [GithubReleasesDatasource.id], // not supported From c6e0cfc55e2fd263a0ea7f3ffbc472088f595ed7 Mon Sep 17 00:00:00 2001 From: Risu <79110363+risu729@users.noreply.github.com> Date: Sun, 15 Dec 2024 22:53:33 +0900 Subject: [PATCH 11/30] test: add test for pipx git url --- lib/modules/manager/mise/backends.spec.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/modules/manager/mise/backends.spec.ts b/lib/modules/manager/mise/backends.spec.ts index 37aa7e5f5c582e..cb33172aa2b67f 100644 --- a/lib/modules/manager/mise/backends.spec.ts +++ b/lib/modules/manager/mise/backends.spec.ts @@ -110,6 +110,15 @@ describe('modules/manager/mise/backends', () => { }); }); + it('should create a tooling config for git url', () => { + expect( + createPipxToolConfig('git+https://gitlab.com/user/repo.git'), + ).toEqual({ + packageName: 'https://gitlab.com/user/repo.git', + datasource: 'git-refs', + }); + }); + it('provides skipReason for zip file url', () => { expect( createPipxToolConfig('https://github.com/psf/black/archive/18.9b0.zip'), From 0b47a6b42c2d9e0a48be131d77c20173278e9936 Mon Sep 17 00:00:00 2001 From: Risu <79110363+risu729@users.noreply.github.com> Date: Sun, 15 Dec 2024 22:57:50 +0900 Subject: [PATCH 12/30] fix: use g flag for regexes in replaceAll --- lib/modules/manager/mise/backends.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/modules/manager/mise/backends.ts b/lib/modules/manager/mise/backends.ts index 218b23cf2b72ae..06561c9375591b 100644 --- a/lib/modules/manager/mise/backends.ts +++ b/lib/modules/manager/mise/backends.ts @@ -125,7 +125,7 @@ export function createPipxToolConfig( // If the url is not a github repo, treat the version as a git ref if (is.undefined(repoName)) { return { - packageName: name.replace(/^git\+/, '').replaceAll(/\.git$/, ''), + packageName: name.replace(/^git\+/g, '').replaceAll(/\.git$/g, ''), datasource: GitRefsDatasource.id, }; } From 3ef030532bc517fa40ef9163b02c190f4f9bd2df Mon Sep 17 00:00:00 2001 From: Risu <79110363+risu729@users.noreply.github.com> Date: Sun, 15 Dec 2024 23:04:07 +0900 Subject: [PATCH 13/30] test: fix packageName in pipx test --- lib/modules/manager/mise/backends.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/modules/manager/mise/backends.spec.ts b/lib/modules/manager/mise/backends.spec.ts index cb33172aa2b67f..97c8a0f1dd1acd 100644 --- a/lib/modules/manager/mise/backends.spec.ts +++ b/lib/modules/manager/mise/backends.spec.ts @@ -114,7 +114,7 @@ describe('modules/manager/mise/backends', () => { expect( createPipxToolConfig('git+https://gitlab.com/user/repo.git'), ).toEqual({ - packageName: 'https://gitlab.com/user/repo.git', + packageName: 'https://gitlab.com/user/repo', datasource: 'git-refs', }); }); From af40debfb8ebf9b568a3ab204dd3c0dc5bc86f38 Mon Sep 17 00:00:00 2001 From: Risu <79110363+risu729@users.noreply.github.com> Date: Sun, 15 Dec 2024 23:06:12 +0900 Subject: [PATCH 14/30] test: add test for unsupported backends --- lib/modules/manager/mise/extract.spec.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/modules/manager/mise/extract.spec.ts b/lib/modules/manager/mise/extract.spec.ts index 4561a8c0fb3073..4e9297563d7b53 100644 --- a/lib/modules/manager/mise/extract.spec.ts +++ b/lib/modules/manager/mise/extract.spec.ts @@ -347,6 +347,14 @@ describe('modules/manager/mise/extract', () => { }); }); + it('return null for unsupported backends', () => { + const content = codeBlock` + [tools] + "fake:tool" = "1.0.0" + `; + expect(extractPackageFile(content, miseFilename)).toBeNull(); + }); + it('provides skipReason for lines with unsupported tooling', () => { const content = codeBlock` [tools] From 02e8ce5ad14057fa7cf0fa9a6ab45aeccccb13d9 Mon Sep 17 00:00:00 2001 From: Risu <79110363+risu729@users.noreply.github.com> Date: Sun, 15 Dec 2024 23:28:55 +0900 Subject: [PATCH 15/30] test: fix unsupported backend test --- lib/modules/manager/mise/extract.spec.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/lib/modules/manager/mise/extract.spec.ts b/lib/modules/manager/mise/extract.spec.ts index 4e9297563d7b53..1316cded5dfcfd 100644 --- a/lib/modules/manager/mise/extract.spec.ts +++ b/lib/modules/manager/mise/extract.spec.ts @@ -347,18 +347,11 @@ describe('modules/manager/mise/extract', () => { }); }); - it('return null for unsupported backends', () => { - const content = codeBlock` - [tools] - "fake:tool" = "1.0.0" - `; - expect(extractPackageFile(content, miseFilename)).toBeNull(); - }); - it('provides skipReason for lines with unsupported tooling', () => { const content = codeBlock` [tools] fake-tool = '1.0.0' + 'fake:tool' = '1.0.0' `; const result = extractPackageFile(content, miseFilename); expect(result).toMatchObject({ @@ -367,6 +360,10 @@ describe('modules/manager/mise/extract', () => { depName: 'fake-tool', skipReason: 'unsupported-datasource', }, + { + depName: 'fake:tool', + skipReason: 'unsupported-datasource', + }, ], }); }); From f26b4d120c82e9885a8f092620fa9b3142bc71be Mon Sep 17 00:00:00 2001 From: Risu <79110363+risu729@users.noreply.github.com> Date: Mon, 23 Dec 2024 23:44:24 +0900 Subject: [PATCH 16/30] fix: trim leading v prefix automatically --- lib/modules/manager/mise/backends.spec.ts | 111 +++++++++++++++++----- lib/modules/manager/mise/backends.ts | 49 ++++++---- lib/modules/manager/mise/extract.spec.ts | 24 +++-- lib/modules/manager/mise/extract.ts | 59 ++++++------ 4 files changed, 161 insertions(+), 82 deletions(-) diff --git a/lib/modules/manager/mise/backends.spec.ts b/lib/modules/manager/mise/backends.spec.ts index 97c8a0f1dd1acd..42585bbf8ebc3f 100644 --- a/lib/modules/manager/mise/backends.spec.ts +++ b/lib/modules/manager/mise/backends.spec.ts @@ -11,16 +11,31 @@ import { describe('modules/manager/mise/backends', () => { describe('createAquaToolConfig()', () => { it('should create a tooling config', () => { - expect(createAquaToolConfig('BurntSushi/ripgrep')).toEqual({ + expect( + createAquaToolConfig('BurntSushi/ripgrep', '14.1.1'), + ).toStrictEqual({ + packageName: 'BurntSushi/ripgrep', + datasource: 'github-tags', + currentValue: '14.1.1', + extractVersion: '^v?(?.+)', + }); + }); + + it('should trim the leading v from version', () => { + expect( + createAquaToolConfig('BurntSushi/ripgrep', 'v14.1.1'), + ).toStrictEqual({ packageName: 'BurntSushi/ripgrep', datasource: 'github-tags', + currentValue: '14.1.1', + extractVersion: '^v?(?.+)', }); }); }); describe('createCargoToolConfig()', () => { it('should create a tooling config for crate', () => { - expect(createCargoToolConfig('eza', '')).toEqual({ + expect(createCargoToolConfig('eza', '')).toStrictEqual({ packageName: 'eza', datasource: 'crate', }); @@ -29,7 +44,7 @@ describe('modules/manager/mise/backends', () => { it('should create a tooling config for git tag', () => { expect( createCargoToolConfig('https://github.com/username/demo', 'tag:v0.1.0'), - ).toEqual({ + ).toStrictEqual({ packageName: 'https://github.com/username/demo', currentValue: 'v0.1.0', datasource: 'git-tags', @@ -42,7 +57,7 @@ describe('modules/manager/mise/backends', () => { 'https://github.com/username/demo', 'branch:main', ), - ).toEqual({ + ).toStrictEqual({ packageName: 'https://github.com/username/demo', skipReason: 'unsupported-version', }); @@ -51,7 +66,7 @@ describe('modules/manager/mise/backends', () => { it('should create a tooling config for git rev', () => { expect( createCargoToolConfig('https://github.com/username/demo', 'rev:abcdef'), - ).toEqual({ + ).toStrictEqual({ packageName: 'https://github.com/username/demo', currentValue: 'abcdef', datasource: 'git-refs', @@ -61,7 +76,7 @@ describe('modules/manager/mise/backends', () => { it('should provide skipReason for invalid version', () => { expect( createCargoToolConfig('https://github.com/username/demo', 'v0.1.0'), - ).toEqual({ + ).toStrictEqual({ packageName: 'https://github.com/username/demo', skipReason: 'invalid-version', }); @@ -70,7 +85,7 @@ describe('modules/manager/mise/backends', () => { describe('createGoToolConfig()', () => { it('should create a tooling config', () => { - expect(createGoToolConfig('github.com/DarthSim/hivemind')).toEqual({ + expect(createGoToolConfig('github.com/DarthSim/hivemind')).toStrictEqual({ packageName: 'github.com/DarthSim/hivemind', datasource: 'go', }); @@ -79,7 +94,7 @@ describe('modules/manager/mise/backends', () => { describe('createNpmToolConfig()', () => { it('should create a tooling config', () => { - expect(createNpmToolConfig('prettier')).toEqual({ + expect(createNpmToolConfig('prettier')).toStrictEqual({ packageName: 'prettier', datasource: 'npm', }); @@ -88,14 +103,14 @@ describe('modules/manager/mise/backends', () => { describe('createPipxToolConfig()', () => { it('should create a tooling config for pypi package', () => { - expect(createPipxToolConfig('yamllint')).toEqual({ + expect(createPipxToolConfig('yamllint')).toStrictEqual({ packageName: 'yamllint', datasource: 'pypi', }); }); it('should create a tooling config for github shorthand', () => { - expect(createPipxToolConfig('psf/black')).toEqual({ + expect(createPipxToolConfig('psf/black')).toStrictEqual({ packageName: 'psf/black', datasource: 'github-tags', }); @@ -104,7 +119,7 @@ describe('modules/manager/mise/backends', () => { it('should create a tooling config for github url', () => { expect( createPipxToolConfig('git+https://github.com/psf/black.git'), - ).toEqual({ + ).toStrictEqual({ packageName: 'psf/black', datasource: 'github-tags', }); @@ -113,7 +128,7 @@ describe('modules/manager/mise/backends', () => { it('should create a tooling config for git url', () => { expect( createPipxToolConfig('git+https://gitlab.com/user/repo.git'), - ).toEqual({ + ).toStrictEqual({ packageName: 'https://gitlab.com/user/repo', datasource: 'git-refs', }); @@ -122,7 +137,7 @@ describe('modules/manager/mise/backends', () => { it('provides skipReason for zip file url', () => { expect( createPipxToolConfig('https://github.com/psf/black/archive/18.9b0.zip'), - ).toEqual({ + ).toStrictEqual({ packageName: 'https://github.com/psf/black/archive/18.9b0.zip', skipReason: 'unsupported-url', }); @@ -131,23 +146,25 @@ describe('modules/manager/mise/backends', () => { describe('createSpmToolConfig()', () => { it('should create a tooling config for github shorthand', () => { - expect(createSpmToolConfig('tuist/tuist')).toEqual({ + expect(createSpmToolConfig('tuist/tuist')).toStrictEqual({ packageName: 'tuist/tuist', datasource: 'github-releases', }); }); it('should create a tooling config for github url', () => { - expect(createSpmToolConfig('https://github.com/tuist/tuist.git')).toEqual( - { - packageName: 'tuist/tuist', - datasource: 'github-releases', - }, - ); + expect( + createSpmToolConfig('https://github.com/tuist/tuist.git'), + ).toStrictEqual({ + packageName: 'tuist/tuist', + datasource: 'github-releases', + }); }); it('provides skipReason for other url', () => { - expect(createSpmToolConfig('https://gitlab.com/user/repo.git')).toEqual({ + expect( + createSpmToolConfig('https://gitlab.com/user/repo.git'), + ).toStrictEqual({ packageName: 'https://gitlab.com/user/repo.git', skipReason: 'unsupported-url', }); @@ -156,28 +173,70 @@ describe('modules/manager/mise/backends', () => { describe('createUbiToolConfig()', () => { it('should create a tooling config with empty options', () => { - expect(createUbiToolConfig('nekto/act', {})).toEqual({ + expect(createUbiToolConfig('nekto/act', '0.2.70', {})).toStrictEqual({ packageName: 'nekto/act', datasource: 'github-releases', + currentvalue: '0.2.70', + extractVersion: '^v?(?.+)', + }); + }); + + it('should trim the leading v from version', () => { + expect(createUbiToolConfig('cli/cli', 'v2.64.0', {})).toStrictEqual({ + packageName: 'cli/cli', + datasource: 'github-releases', + currentvalue: '2.64.0', + extractVersion: '^v?(?.+)', }); }); it('should ignore options unless tag_regex is provided', () => { - expect(createUbiToolConfig('cli/cli', { exe: 'gh' } as any)).toEqual({ + expect( + createUbiToolConfig('cli/cli', '2.64.0', { exe: 'gh' } as any), + ).toStrictEqual({ packageName: 'cli/cli', datasource: 'github-releases', + currentvalue: '2.64.0', + extractVersion: '^v?(?.+)', }); }); it('should set extractVersion if tag_regex is provided', () => { expect( - createUbiToolConfig('cargo-bins/cargo-binstall', { + createUbiToolConfig('cargo-bins/cargo-binstall', '1.10.17', { tag_regex: '^\\d+\\.\\d+\\.', }), - ).toEqual({ + ).toStrictEqual({ + packageName: 'cargo-bins/cargo-binstall', + datasource: 'github-releases', + currentvalue: '1.10.17', + extractVersion: '^v?(?\\d+\\.\\d+\\.)', + }); + }); + + it('should trim the leading ^v from tag_regex', () => { + expect( + createUbiToolConfig('cargo-bins/cargo-binstall', '1.10.17', { + tag_regex: '^v\\d+\\.\\d+\\.', + }), + ).toStrictEqual({ + packageName: 'cargo-bins/cargo-binstall', + datasource: 'github-releases', + currentvalue: '1.10.17', + extractVersion: '^v?(?\\d+\\.\\d+\\.)', + }); + }); + + it('should trim the leading ^v? from tag_regex', () => { + expect( + createUbiToolConfig('cargo-bins/cargo-binstall', '1.10.17', { + tag_regex: '^v?\\d+\\.\\d+\\.', + }), + ).toStrictEqual({ packageName: 'cargo-bins/cargo-binstall', datasource: 'github-releases', - extractVersion: '(?^\\d+\\.\\d+\\.)', + currentvalue: '1.10.17', + extractVersion: '^v?(?\\d+\\.\\d+\\.)', }); }); }); diff --git a/lib/modules/manager/mise/backends.ts b/lib/modules/manager/mise/backends.ts index 06561c9375591b..195fc72937c6ae 100644 --- a/lib/modules/manager/mise/backends.ts +++ b/lib/modules/manager/mise/backends.ts @@ -9,24 +9,32 @@ import { GoDatasource } from '../../datasource/go'; import { NpmDatasource } from '../../datasource/npm'; import { PypiDatasource } from '../../datasource/pypi'; import { normalizePythonDepName } from '../../datasource/pypi/common'; -import type { ToolingConfig } from '../asdf/upgradeable-tooling'; import type { PackageDependency } from '../types'; import type { MiseToolOptionsSchema } from './schema'; -export type SkippedToolingConfig = Partial & - Required>; +export type BackendToolingConfig = Omit & + Required< + | Pick + | Pick + >; /** * Create a tooling config for aqua backend * @link https://mise.jdx.dev/dev-tools/backends/aqua.html */ -export function createAquaToolConfig(name: string): ToolingConfig { +export function createAquaToolConfig( + name: string, + version: string, +): BackendToolingConfig { // mise supports http aqua package type but we cannot determine it from the tool name // An error will be thrown afterwards if the package type is http // ref: https://github.com/jdx/mise/blob/d1b9749d8f3e13ef705c1ea471d96c5935b79136/src/aqua/aqua_registry.rs#L39-L45 return { packageName: name, datasource: GithubTagsDatasource.id, + // Trim the leading 'v' from both the current and extracted version + currentValue: version.replace(/^v/, ''), + extractVersion: '^v?(?.+)', }; } @@ -39,7 +47,7 @@ const cargoGitVersionRegex = regEx(/^(?tag|branch|rev):(?.+)$/); export function createCargoToolConfig( name: string, version: string, -): ToolingConfig | SkippedToolingConfig { +): BackendToolingConfig { // Avoid narrowing the type of name to never if (!(is.urlString as (value: unknown) => boolean)(name)) { return { @@ -82,7 +90,7 @@ export function createCargoToolConfig( * Create a tooling config for go backend * @link https://mise.jdx.dev/dev-tools/backends/go.html */ -export function createGoToolConfig(name: string): ToolingConfig { +export function createGoToolConfig(name: string): BackendToolingConfig { return { packageName: name, datasource: GoDatasource.id, @@ -93,7 +101,7 @@ export function createGoToolConfig(name: string): ToolingConfig { * Create a tooling config for npm backend * @link https://mise.jdx.dev/dev-tools/backends/npm.html */ -export function createNpmToolConfig(name: string): ToolingConfig { +export function createNpmToolConfig(name: string): BackendToolingConfig { return { packageName: name, datasource: NpmDatasource.id, @@ -106,9 +114,7 @@ const pipxGitHubRegex = regEx(/^git\+https:\/\/github\.com\/(?.+)\.git$/); * Create a tooling config for pipx backend * @link https://mise.jdx.dev/dev-tools/backends/pipx.html */ -export function createPipxToolConfig( - name: string, -): ToolingConfig | SkippedToolingConfig { +export function createPipxToolConfig(name: string): BackendToolingConfig { const isGitSyntax = name.startsWith('git+'); // Does not support zip file url // Avoid type narrowing to prevent type error @@ -149,9 +155,7 @@ const spmGitHubRegex = regEx(/^https:\/\/github.com\/(?.+).git$/); * Create a tooling config for spm backend * @link https://mise.jdx.dev/dev-tools/backends/spm.html */ -export function createSpmToolConfig( - name: string, -): ToolingConfig | SkippedToolingConfig { +export function createSpmToolConfig(name: string): BackendToolingConfig { let repoName: string | undefined; // Avoid type narrowing to prevent type error if ((is.urlString as (value: unknown) => boolean)(name)) { @@ -176,17 +180,20 @@ export function createSpmToolConfig( */ export function createUbiToolConfig( name: string, + version: string, toolOptions: MiseToolOptionsSchema, -): ToolingConfig { +): BackendToolingConfig { return { packageName: name, datasource: GithubReleasesDatasource.id, - ...(toolOptions.tag_regex - ? { - // Filter versions by tag_regex if it is specified - // ref: https://mise.jdx.dev/dev-tools/backends/ubi.html#ubi-uses-weird-versions - extractVersion: `(?${toolOptions.tag_regex})`, - } - : {}), + // Trim the leading 'v' from both the current and extracted version + currentValue: version.replace(/^v/, ''), + // Filter versions by tag_regex if it is specified + // ref: https://mise.jdx.dev/dev-tools/backends/ubi.html#ubi-uses-weird-versions + extractVersion: `^v?(?${ + is.string(toolOptions.tag_regex) + ? toolOptions.tag_regex.replace(/^\^?v?\??/, '') + : '.+' + })`, }; } diff --git a/lib/modules/manager/mise/extract.spec.ts b/lib/modules/manager/mise/extract.spec.ts index 1316cded5dfcfd..40ec664269fe6d 100644 --- a/lib/modules/manager/mise/extract.spec.ts +++ b/lib/modules/manager/mise/extract.spec.ts @@ -4,7 +4,7 @@ import { extractPackageFile } from '.'; jest.mock('../../../util/fs'); -const miseFilename = '.mise.toml'; +const miseFilename = 'mise.toml'; const mise1toml = Fixtures.get('Mise.1.toml'); @@ -146,6 +146,7 @@ describe('modules/manager/mise/extract', () => { const content = codeBlock` [tools] "aqua:BurntSushi/ripgrep" = "14.1.0" + "aqua:cli/cli" = "v2.64.0" `; const result = extractPackageFile(content, miseFilename); expect(result).toMatchObject({ @@ -155,6 +156,14 @@ describe('modules/manager/mise/extract', () => { currentValue: '14.1.0', packageName: 'BurntSushi/ripgrep', datasource: 'github-tags', + extractVersion: '^v?(?.+)', + }, + { + depName: 'aqua:cli/cli', + currentValue: '2.64.0', + packageName: 'cli/cli', + datasource: 'github-tags', + extractVersion: '^v?(?.+)', }, ], }); @@ -294,7 +303,7 @@ describe('modules/manager/mise/extract', () => { it('extracts ubi backend tools', () => { const content = codeBlock` [tools] - "ubi:nekto/act" = "0.2.70" + "ubi:nekto/act" = "v0.2.70" "ubi:cli/cli" = { exe = "gh", version = "1.14.0" } "ubi:cli/cli[exe=gh]" = "1.14.0" "ubi:cargo-bins/cargo-binstall" = { tag_regex = "^\\\\d+\\\\.\\\\d+\\\\.", version = "1.0.0" } @@ -309,39 +318,42 @@ describe('modules/manager/mise/extract', () => { currentValue: '0.2.70', packageName: 'nekto/act', datasource: 'github-releases', + extractVersion: '^v?(?.+)', }, { depName: 'ubi:cli/cli', currentValue: '1.14.0', packageName: 'cli/cli', datasource: 'github-releases', + extractVersion: '^v?(?.+)', }, { depName: 'ubi:cli/cli', currentValue: '1.14.0', packageName: 'cli/cli', datasource: 'github-releases', + extractVersion: '^v?(?.+)', }, { depName: 'ubi:cargo-bins/cargo-binstall', currentValue: '1.0.0', packageName: 'cargo-bins/cargo-binstall', datasource: 'github-releases', - extractVersion: '(?^\\d+\\.\\d+\\.)', + extractVersion: '^v?(?^\\d+\\.\\d+\\.)', }, { depName: 'ubi:cargo-bins/cargo-binstall', currentValue: '1.0.0', packageName: 'cargo-bins/cargo-binstall', datasource: 'github-releases', - extractVersion: '(?^\\d+\\.)', + extractVersion: '^v?(?^\\d+\\.)', }, { depName: 'ubi:cargo-bins/cargo-binstall', currentValue: '1.0.0', packageName: 'cargo-bins/cargo-binstall', datasource: 'github-releases', - extractVersion: '(?^\\d+\\.)', + extractVersion: '^v?(?^\\d+\\.)', }, ], }); @@ -421,7 +433,7 @@ describe('modules/manager/mise/extract', () => { }); }); - it('complete .mise.toml example', () => { + it('complete mise.toml example', () => { const result = extractPackageFile(mise1toml, miseFilename); expect(result).toMatchObject({ deps: [ diff --git a/lib/modules/manager/mise/extract.ts b/lib/modules/manager/mise/extract.ts index 6d218117162f2f..da8a9d895905f2 100644 --- a/lib/modules/manager/mise/extract.ts +++ b/lib/modules/manager/mise/extract.ts @@ -1,9 +1,9 @@ import is from '@sindresorhus/is'; import { logger } from '../../../logger'; -import type { SkipReason } from '../../../types'; import { regEx } from '../../../util/regex'; import type { ToolingConfig } from '../asdf/upgradeable-tooling'; import type { PackageDependency, PackageFileContent } from '../types'; +import type { BackendToolingConfig } from './backends'; import { createAquaToolConfig, createCargoToolConfig, @@ -13,7 +13,6 @@ import { createSpmToolConfig, createUbiToolConfig, } from './backends'; -import type { SkippedToolingConfig } from './backends'; import type { MiseToolOptionsSchema, MiseToolSchema } from './schema'; import type { ToolingDefinition } from './upgradeable-tooling'; import { asdfTooling, miseTooling } from './upgradeable-tooling'; @@ -45,11 +44,16 @@ export function extractPackageFile( optionInToolNameRegex.exec(name.trim())?.groups ?? { name: name.trim(), }; + const delimiterIndex = name.indexOf(':'); + const backend = name.substring(0, delimiterIndex); + const toolName = name.substring(delimiterIndex + 1); const options = parseOptions( optionsInName, is.nonEmptyObject(toolData) ? toolData : {}, ); - const toolConfig = getToolConfig(depName, version, options); + const toolConfig = is.null_(version) + ? null + : getToolConfig(backend, toolName, version, options); const dep = createDependency(depName, version, toolConfig); deps.push(dep); } @@ -94,23 +98,15 @@ function parseOptions( } function getToolConfig( - name: string, - version: string | null, + backend: string, + toolName: string, + version: string, toolOptions: MiseToolOptionsSchema, -): ToolingConfig | SkippedToolingConfig | null { - if (version === null) { - return null; // Early return if version is null - } - - // If the tool name does not specify a backend, it should be a short name or an alias defined by users - const delimiterIndex = name.indexOf(':'); - if (delimiterIndex === -1) { - return getRegistryToolConfig(name, version); - } - - const backend = name.substring(0, delimiterIndex); - const toolName = name.substring(delimiterIndex + 1); +): ToolingConfig | BackendToolingConfig | null { switch (backend) { + case '': + // If the tool name does not specify a backend, it should be a short name or an alias defined by users + return getRegistryToolConfig(toolName, version); // We can specify core, asdf, vfox, aqua backends for tools in the default registry // e.g. 'core:rust', 'asdf:rust', 'vfox:clang', 'aqua:act' case 'core': @@ -122,7 +118,7 @@ function getToolConfig( case 'aqua': return ( getRegistryToolConfig(toolName, version) ?? - createAquaToolConfig(toolName) + createAquaToolConfig(toolName, version) ); case 'cargo': return createCargoToolConfig(toolName, version); @@ -135,7 +131,7 @@ function getToolConfig( case 'spm': return createSpmToolConfig(toolName); case 'ubi': - return createUbiToolConfig(toolName, toolOptions); + return createUbiToolConfig(toolName, version, toolOptions); default: // Unsupported backend return null; @@ -168,28 +164,33 @@ function getConfigFromTooling( } // Return null if no toolDefinition is found return ( - (typeof toolDefinition.config === 'function' + (is.function_(toolDefinition.config) ? toolDefinition.config(version) : toolDefinition.config) ?? null - ); // Ensure null is returned instead of undefined + ); } function createDependency( name: string, version: string | null, - config: ToolingConfig | SkippedToolingConfig | null, + config: ToolingConfig | BackendToolingConfig | null, ): PackageDependency { - let skipReason: SkipReason | undefined; - if (config === null) { - skipReason = 'unsupported-datasource'; + if (is.null_(config)) { + return { + depName: name, + skipReason: 'unsupported-datasource', + }; } - if (version === null) { - skipReason = 'unspecified-version'; + if (is.null_(version)) { + return { + depName: name, + skipReason: 'unspecified-version', + }; } + return { depName: name, currentValue: version, - ...(skipReason ? { skipReason } : {}), // Spread the config last to override other properties ...config, }; From 5e042cbc301d180a9dd73daa1395021033961b0d Mon Sep 17 00:00:00 2001 From: Risu <79110363+risu729@users.noreply.github.com> Date: Sat, 28 Dec 2024 01:37:15 +0900 Subject: [PATCH 17/30] fix: do not include options in packageName --- lib/modules/manager/mise/extract.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/modules/manager/mise/extract.ts b/lib/modules/manager/mise/extract.ts index da8a9d895905f2..ff753231d43d68 100644 --- a/lib/modules/manager/mise/extract.ts +++ b/lib/modules/manager/mise/extract.ts @@ -45,8 +45,8 @@ export function extractPackageFile( name: name.trim(), }; const delimiterIndex = name.indexOf(':'); - const backend = name.substring(0, delimiterIndex); - const toolName = name.substring(delimiterIndex + 1); + const backend = depName.substring(0, delimiterIndex); + const toolName = depName.substring(delimiterIndex + 1); const options = parseOptions( optionsInName, is.nonEmptyObject(toolData) ? toolData : {}, From 63265b81d8be70626c618de5a2e47a2f1fd7068d Mon Sep 17 00:00:00 2001 From: Risu <79110363+risu729@users.noreply.github.com> Date: Sat, 28 Dec 2024 01:38:20 +0900 Subject: [PATCH 18/30] test: fix typo --- lib/modules/manager/mise/backends.spec.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/modules/manager/mise/backends.spec.ts b/lib/modules/manager/mise/backends.spec.ts index 42585bbf8ebc3f..6a8aaec12380a4 100644 --- a/lib/modules/manager/mise/backends.spec.ts +++ b/lib/modules/manager/mise/backends.spec.ts @@ -176,7 +176,7 @@ describe('modules/manager/mise/backends', () => { expect(createUbiToolConfig('nekto/act', '0.2.70', {})).toStrictEqual({ packageName: 'nekto/act', datasource: 'github-releases', - currentvalue: '0.2.70', + currentValue: '0.2.70', extractVersion: '^v?(?.+)', }); }); @@ -185,7 +185,7 @@ describe('modules/manager/mise/backends', () => { expect(createUbiToolConfig('cli/cli', 'v2.64.0', {})).toStrictEqual({ packageName: 'cli/cli', datasource: 'github-releases', - currentvalue: '2.64.0', + currentValue: '2.64.0', extractVersion: '^v?(?.+)', }); }); @@ -196,7 +196,7 @@ describe('modules/manager/mise/backends', () => { ).toStrictEqual({ packageName: 'cli/cli', datasource: 'github-releases', - currentvalue: '2.64.0', + currentValue: '2.64.0', extractVersion: '^v?(?.+)', }); }); @@ -209,7 +209,7 @@ describe('modules/manager/mise/backends', () => { ).toStrictEqual({ packageName: 'cargo-bins/cargo-binstall', datasource: 'github-releases', - currentvalue: '1.10.17', + currentValue: '1.10.17', extractVersion: '^v?(?\\d+\\.\\d+\\.)', }); }); @@ -222,7 +222,7 @@ describe('modules/manager/mise/backends', () => { ).toStrictEqual({ packageName: 'cargo-bins/cargo-binstall', datasource: 'github-releases', - currentvalue: '1.10.17', + currentValue: '1.10.17', extractVersion: '^v?(?\\d+\\.\\d+\\.)', }); }); @@ -235,7 +235,7 @@ describe('modules/manager/mise/backends', () => { ).toStrictEqual({ packageName: 'cargo-bins/cargo-binstall', datasource: 'github-releases', - currentvalue: '1.10.17', + currentValue: '1.10.17', extractVersion: '^v?(?\\d+\\.\\d+\\.)', }); }); From ae07f50e2987425ce14764f7977ea1da3021d0db Mon Sep 17 00:00:00 2001 From: Risu <79110363+risu729@users.noreply.github.com> Date: Sat, 28 Dec 2024 01:41:32 +0900 Subject: [PATCH 19/30] fix: revert order of version and config null checks --- lib/modules/manager/mise/extract.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/modules/manager/mise/extract.ts b/lib/modules/manager/mise/extract.ts index ff753231d43d68..ddb6212431c064 100644 --- a/lib/modules/manager/mise/extract.ts +++ b/lib/modules/manager/mise/extract.ts @@ -175,16 +175,16 @@ function createDependency( version: string | null, config: ToolingConfig | BackendToolingConfig | null, ): PackageDependency { - if (is.null_(config)) { + if (is.null_(version)) { return { depName: name, - skipReason: 'unsupported-datasource', + skipReason: 'unspecified-version', }; } - if (is.null_(version)) { + if (is.null_(config)) { return { depName: name, - skipReason: 'unspecified-version', + skipReason: 'unsupported-datasource', }; } From 237f1b7693934c5ae8931cfd6540f1ea6ad6e73e Mon Sep 17 00:00:00 2001 From: Risu <79110363+risu729@users.noreply.github.com> Date: Sat, 28 Dec 2024 01:42:47 +0900 Subject: [PATCH 20/30] test: remove leadin v from extractVersion --- lib/modules/manager/mise/extract.spec.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/modules/manager/mise/extract.spec.ts b/lib/modules/manager/mise/extract.spec.ts index 40ec664269fe6d..ee18422ad895dc 100644 --- a/lib/modules/manager/mise/extract.spec.ts +++ b/lib/modules/manager/mise/extract.spec.ts @@ -339,21 +339,21 @@ describe('modules/manager/mise/extract', () => { currentValue: '1.0.0', packageName: 'cargo-bins/cargo-binstall', datasource: 'github-releases', - extractVersion: '^v?(?^\\d+\\.\\d+\\.)', + extractVersion: '^v?(?\\d+\\.\\d+\\.)', }, { depName: 'ubi:cargo-bins/cargo-binstall', currentValue: '1.0.0', packageName: 'cargo-bins/cargo-binstall', datasource: 'github-releases', - extractVersion: '^v?(?^\\d+\\.)', + extractVersion: '^v?(?\\d+\\.)', }, { depName: 'ubi:cargo-bins/cargo-binstall', currentValue: '1.0.0', packageName: 'cargo-bins/cargo-binstall', datasource: 'github-releases', - extractVersion: '^v?(?^\\d+\\.)', + extractVersion: '^v?(?\\d+\\.)', }, ], }); From 60a025b44e402ad097650b959b658bd0b62310a1 Mon Sep 17 00:00:00 2001 From: Risu <79110363+risu729@users.noreply.github.com> Date: Sat, 28 Dec 2024 03:00:59 +0900 Subject: [PATCH 21/30] feat: support dotnet backend --- lib/modules/manager/mise/backends.spec.ts | 10 ++++++++++ lib/modules/manager/mise/backends.ts | 14 ++++++++++++++ lib/modules/manager/mise/extract.spec.ts | 18 ++++++++++++++++++ lib/modules/manager/mise/extract.ts | 3 +++ lib/modules/manager/mise/index.ts | 2 ++ 5 files changed, 47 insertions(+) diff --git a/lib/modules/manager/mise/backends.spec.ts b/lib/modules/manager/mise/backends.spec.ts index 6a8aaec12380a4..8f864a5ebb2120 100644 --- a/lib/modules/manager/mise/backends.spec.ts +++ b/lib/modules/manager/mise/backends.spec.ts @@ -1,6 +1,7 @@ import { createAquaToolConfig, createCargoToolConfig, + createDotnetToolConfig, createGoToolConfig, createNpmToolConfig, createPipxToolConfig, @@ -83,6 +84,15 @@ describe('modules/manager/mise/backends', () => { }); }); + describe('createDotnetToolConfig()', () => { + it('should create a tooling config', () => { + expect(createDotnetToolConfig('GitVersion.Tool')).toStrictEqual({ + packageName: 'GitVersion.Tool', + datasource: 'nuget', + }); + }); + }); + describe('createGoToolConfig()', () => { it('should create a tooling config', () => { expect(createGoToolConfig('github.com/DarthSim/hivemind')).toStrictEqual({ diff --git a/lib/modules/manager/mise/backends.ts b/lib/modules/manager/mise/backends.ts index 195fc72937c6ae..b2a1950bc700c2 100644 --- a/lib/modules/manager/mise/backends.ts +++ b/lib/modules/manager/mise/backends.ts @@ -11,6 +11,7 @@ import { PypiDatasource } from '../../datasource/pypi'; import { normalizePythonDepName } from '../../datasource/pypi/common'; import type { PackageDependency } from '../types'; import type { MiseToolOptionsSchema } from './schema'; +import { NugetDatasource } from '../../datasource/nuget'; export type BackendToolingConfig = Omit & Required< @@ -86,6 +87,19 @@ export function createCargoToolConfig( } } +/** + * Create a tooling config for dotnet backend + * @link https://mise.jdx.dev/dev-tools/backends/dotnet.html + */ +export function createDotnetToolConfig( + name: string, +): BackendToolingConfig { + return { + packageName: name, + datasource: NugetDatasource.id, + }; +} + /** * Create a tooling config for go backend * @link https://mise.jdx.dev/dev-tools/backends/go.html diff --git a/lib/modules/manager/mise/extract.spec.ts b/lib/modules/manager/mise/extract.spec.ts index ee18422ad895dc..412c1c952ccdcf 100644 --- a/lib/modules/manager/mise/extract.spec.ts +++ b/lib/modules/manager/mise/extract.spec.ts @@ -207,6 +207,24 @@ describe('modules/manager/mise/extract', () => { }); }); + it('extracts dotnet backend tool', () => { + const content = codeBlock` + [tools] + "dotnet:GitVersion.Tool" = "5.12.0" + `; + const result = extractPackageFile(content, miseFilename); + expect(result).toMatchObject({ + deps: [ + { + depName: 'dotnet:GitVersion.Tool', + currentValue: '5.12.0', + packageName: 'GitVersion.Tool', + datasource: 'nuget', + }, + ], + }); + }); + it('extracts go backend tool', () => { const content = codeBlock` [tools] diff --git a/lib/modules/manager/mise/extract.ts b/lib/modules/manager/mise/extract.ts index ddb6212431c064..47c113e4266aa5 100644 --- a/lib/modules/manager/mise/extract.ts +++ b/lib/modules/manager/mise/extract.ts @@ -7,6 +7,7 @@ import type { BackendToolingConfig } from './backends'; import { createAquaToolConfig, createCargoToolConfig, + createDotnetToolConfig, createGoToolConfig, createNpmToolConfig, createPipxToolConfig, @@ -122,6 +123,8 @@ function getToolConfig( ); case 'cargo': return createCargoToolConfig(toolName, version); + case 'dotnet': + return createDotnetToolConfig(toolName); case 'go': return createGoToolConfig(toolName); case 'npm': diff --git a/lib/modules/manager/mise/index.ts b/lib/modules/manager/mise/index.ts index 9534bbbe87dda2..f3ab38e1073ac1 100644 --- a/lib/modules/manager/mise/index.ts +++ b/lib/modules/manager/mise/index.ts @@ -8,6 +8,7 @@ import { GoDatasource } from '../../datasource/go'; import { JavaVersionDatasource } from '../../datasource/java-version'; import { NodeVersionDatasource } from '../../datasource/node-version'; import { NpmDatasource } from '../../datasource/npm'; +import { NugetDatasource } from '../../datasource/nuget'; import { PypiDatasource } from '../../datasource/pypi'; import { RubyVersionDatasource } from '../../datasource/ruby-version'; import { supportedDatasources as asdfSupportedDatasources } from '../asdf'; @@ -33,6 +34,7 @@ const backendDatasources = { asdf: asdfSupportedDatasources, aqua: [GithubTagsDatasource.id], cargo: [CrateDatasource.id, GitTagsDatasource.id, GitRefsDatasource.id], + dotnet: [NugetDatasource.id], go: [GoDatasource.id], npm: [NpmDatasource.id], pipx: [PypiDatasource.id, GithubTagsDatasource.id, GitRefsDatasource.id], From 37aa7ae78b1995651ca8bd9974190267ad0677d2 Mon Sep 17 00:00:00 2001 From: Risu <79110363+risu729@users.noreply.github.com> Date: Sat, 28 Dec 2024 03:44:52 +0900 Subject: [PATCH 22/30] feat: support gem backend --- lib/modules/manager/mise/backends.spec.ts | 9 +++++++++ lib/modules/manager/mise/backends.ts | 14 ++++++++++++++ lib/modules/manager/mise/extract.spec.ts | 18 ++++++++++++++++++ lib/modules/manager/mise/extract.ts | 3 +++ lib/modules/manager/mise/index.ts | 2 ++ 5 files changed, 46 insertions(+) diff --git a/lib/modules/manager/mise/backends.spec.ts b/lib/modules/manager/mise/backends.spec.ts index 8f864a5ebb2120..7bb1b6ce02de05 100644 --- a/lib/modules/manager/mise/backends.spec.ts +++ b/lib/modules/manager/mise/backends.spec.ts @@ -93,6 +93,15 @@ describe('modules/manager/mise/backends', () => { }); }); + describe('createGemToolConfig()', () => { + it('should create a tooling config', () => { + expect(createGoToolConfig('rubocop')).toStrictEqual({ + packageName: 'rubocop', + datasource: 'rubygems', + }); + }); + }); + describe('createGoToolConfig()', () => { it('should create a tooling config', () => { expect(createGoToolConfig('github.com/DarthSim/hivemind')).toStrictEqual({ diff --git a/lib/modules/manager/mise/backends.ts b/lib/modules/manager/mise/backends.ts index b2a1950bc700c2..83fcb9a3d542b2 100644 --- a/lib/modules/manager/mise/backends.ts +++ b/lib/modules/manager/mise/backends.ts @@ -12,6 +12,7 @@ import { normalizePythonDepName } from '../../datasource/pypi/common'; import type { PackageDependency } from '../types'; import type { MiseToolOptionsSchema } from './schema'; import { NugetDatasource } from '../../datasource/nuget'; +import { RubygemsDatasource } from '../../datasource/rubygems'; export type BackendToolingConfig = Omit & Required< @@ -100,6 +101,19 @@ export function createDotnetToolConfig( }; } +/** + * Create a tooling config for gem backend + * @link https://mise.jdx.dev/dev-tools/backends/gem.html + */ +export function createGemToolConfig( + name: string, +): BackendToolingConfig { + return { + packageName: name, + datasource: RubygemsDatasource.id, + }; +} + /** * Create a tooling config for go backend * @link https://mise.jdx.dev/dev-tools/backends/go.html diff --git a/lib/modules/manager/mise/extract.spec.ts b/lib/modules/manager/mise/extract.spec.ts index 412c1c952ccdcf..ecb79bacf04b33 100644 --- a/lib/modules/manager/mise/extract.spec.ts +++ b/lib/modules/manager/mise/extract.spec.ts @@ -225,6 +225,24 @@ describe('modules/manager/mise/extract', () => { }); }); + it('extracts gem backend tool', () => { + const content = codeBlock` + [tools] + "gem:rubocop" = "1.69.2" + `; + const result = extractPackageFile(content, miseFilename); + expect(result).toMatchObject({ + deps: [ + { + depName: 'gem:rubocop', + currentValue: '1.69.2', + packageName: 'rubocop', + datasource: 'rubygems', + }, + ], + }); + }); + it('extracts go backend tool', () => { const content = codeBlock` [tools] diff --git a/lib/modules/manager/mise/extract.ts b/lib/modules/manager/mise/extract.ts index 47c113e4266aa5..2d191268e0602a 100644 --- a/lib/modules/manager/mise/extract.ts +++ b/lib/modules/manager/mise/extract.ts @@ -8,6 +8,7 @@ import { createAquaToolConfig, createCargoToolConfig, createDotnetToolConfig, + createGemToolConfig, createGoToolConfig, createNpmToolConfig, createPipxToolConfig, @@ -125,6 +126,8 @@ function getToolConfig( return createCargoToolConfig(toolName, version); case 'dotnet': return createDotnetToolConfig(toolName); + case 'gem': + return createGemToolConfig(toolName); case 'go': return createGoToolConfig(toolName); case 'npm': diff --git a/lib/modules/manager/mise/index.ts b/lib/modules/manager/mise/index.ts index f3ab38e1073ac1..82eba27e4695b3 100644 --- a/lib/modules/manager/mise/index.ts +++ b/lib/modules/manager/mise/index.ts @@ -11,6 +11,7 @@ import { NpmDatasource } from '../../datasource/npm'; import { NugetDatasource } from '../../datasource/nuget'; import { PypiDatasource } from '../../datasource/pypi'; import { RubyVersionDatasource } from '../../datasource/ruby-version'; +import { RubygemsDatasource } from '../../datasource/rubygems'; import { supportedDatasources as asdfSupportedDatasources } from '../asdf'; export { extractPackageFile } from './extract'; @@ -35,6 +36,7 @@ const backendDatasources = { aqua: [GithubTagsDatasource.id], cargo: [CrateDatasource.id, GitTagsDatasource.id, GitRefsDatasource.id], dotnet: [NugetDatasource.id], + gem: [RubygemsDatasource.id], go: [GoDatasource.id], npm: [NpmDatasource.id], pipx: [PypiDatasource.id, GithubTagsDatasource.id, GitRefsDatasource.id], From 0e13a0525289ecf164ca6efe0c418b99f7cb0089 Mon Sep 17 00:00:00 2001 From: Risu <79110363+risu729@users.noreply.github.com> Date: Sat, 28 Dec 2024 16:55:28 +0900 Subject: [PATCH 23/30] fix --- lib/modules/manager/mise/backends.spec.ts | 3 ++- lib/modules/manager/mise/backends.ts | 12 ++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/modules/manager/mise/backends.spec.ts b/lib/modules/manager/mise/backends.spec.ts index 7bb1b6ce02de05..508addca3b338d 100644 --- a/lib/modules/manager/mise/backends.spec.ts +++ b/lib/modules/manager/mise/backends.spec.ts @@ -2,6 +2,7 @@ import { createAquaToolConfig, createCargoToolConfig, createDotnetToolConfig, + createGemToolConfig, createGoToolConfig, createNpmToolConfig, createPipxToolConfig, @@ -95,7 +96,7 @@ describe('modules/manager/mise/backends', () => { describe('createGemToolConfig()', () => { it('should create a tooling config', () => { - expect(createGoToolConfig('rubocop')).toStrictEqual({ + expect(createGemToolConfig('rubocop')).toStrictEqual({ packageName: 'rubocop', datasource: 'rubygems', }); diff --git a/lib/modules/manager/mise/backends.ts b/lib/modules/manager/mise/backends.ts index 83fcb9a3d542b2..92f32ada30c24e 100644 --- a/lib/modules/manager/mise/backends.ts +++ b/lib/modules/manager/mise/backends.ts @@ -7,12 +7,12 @@ import { GithubReleasesDatasource } from '../../datasource/github-releases'; import { GithubTagsDatasource } from '../../datasource/github-tags'; import { GoDatasource } from '../../datasource/go'; import { NpmDatasource } from '../../datasource/npm'; +import { NugetDatasource } from '../../datasource/nuget'; import { PypiDatasource } from '../../datasource/pypi'; import { normalizePythonDepName } from '../../datasource/pypi/common'; +import { RubygemsDatasource } from '../../datasource/rubygems'; import type { PackageDependency } from '../types'; import type { MiseToolOptionsSchema } from './schema'; -import { NugetDatasource } from '../../datasource/nuget'; -import { RubygemsDatasource } from '../../datasource/rubygems'; export type BackendToolingConfig = Omit & Required< @@ -92,9 +92,7 @@ export function createCargoToolConfig( * Create a tooling config for dotnet backend * @link https://mise.jdx.dev/dev-tools/backends/dotnet.html */ -export function createDotnetToolConfig( - name: string, -): BackendToolingConfig { +export function createDotnetToolConfig(name: string): BackendToolingConfig { return { packageName: name, datasource: NugetDatasource.id, @@ -105,9 +103,7 @@ export function createDotnetToolConfig( * Create a tooling config for gem backend * @link https://mise.jdx.dev/dev-tools/backends/gem.html */ -export function createGemToolConfig( - name: string, -): BackendToolingConfig { +export function createGemToolConfig(name: string): BackendToolingConfig { return { packageName: name, datasource: RubygemsDatasource.id, From b329d1570a035fab8d2e24e6959366c962233d43 Mon Sep 17 00:00:00 2001 From: Risu <79110363+risu729@users.noreply.github.com> Date: Thu, 6 Feb 2025 23:54:39 +1100 Subject: [PATCH 24/30] fix(manager/mise): fix coverage issue --- lib/modules/manager/mise/extract.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/modules/manager/mise/extract.ts b/lib/modules/manager/mise/extract.ts index 2d191268e0602a..4284453d9d26d8 100644 --- a/lib/modules/manager/mise/extract.ts +++ b/lib/modules/manager/mise/extract.ts @@ -42,10 +42,11 @@ export function extractPackageFile( for (const [name, toolData] of Object.entries(tools)) { const version = parseVersion(toolData); // Parse the tool options in the tool name - const { name: depName, options: optionsInName } = - optionInToolNameRegex.exec(name.trim())?.groups ?? { - name: name.trim(), - }; + const toolNameMatchResult = optionInToolNameRegex.exec(name.trim())?.groups; + if (!toolNameMatchResult) { + throw new Error(`Failed to parse tool name: ${name}`); + } + const { name: depName, options: optionsInName } = toolNameMatchResult; const delimiterIndex = name.indexOf(':'); const backend = depName.substring(0, delimiterIndex); const toolName = depName.substring(delimiterIndex + 1); From 9e9c7f35043c2144e8f2850715c6a77221a42da5 Mon Sep 17 00:00:00 2001 From: Risu <79110363+risu729@users.noreply.github.com> Date: Thu, 6 Feb 2025 23:56:54 +1100 Subject: [PATCH 25/30] style: format by prettier --- lib/modules/manager/mise/extract.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/modules/manager/mise/extract.ts b/lib/modules/manager/mise/extract.ts index 4284453d9d26d8..04d727eec1b95a 100644 --- a/lib/modules/manager/mise/extract.ts +++ b/lib/modules/manager/mise/extract.ts @@ -42,7 +42,9 @@ export function extractPackageFile( for (const [name, toolData] of Object.entries(tools)) { const version = parseVersion(toolData); // Parse the tool options in the tool name - const toolNameMatchResult = optionInToolNameRegex.exec(name.trim())?.groups; + const toolNameMatchResult = optionInToolNameRegex.exec( + name.trim(), + )?.groups; if (!toolNameMatchResult) { throw new Error(`Failed to parse tool name: ${name}`); } From b8eb2021b2010cca2ade562e89b8d142c27ce2e5 Mon Sep 17 00:00:00 2001 From: Risu <79110363+risu729@users.noreply.github.com> Date: Fri, 7 Feb 2025 00:09:19 +1100 Subject: [PATCH 26/30] Revert "style: format by prettier" This reverts commit 9e9c7f35043c2144e8f2850715c6a77221a42da5. --- lib/modules/manager/mise/extract.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/modules/manager/mise/extract.ts b/lib/modules/manager/mise/extract.ts index 04d727eec1b95a..4284453d9d26d8 100644 --- a/lib/modules/manager/mise/extract.ts +++ b/lib/modules/manager/mise/extract.ts @@ -42,9 +42,7 @@ export function extractPackageFile( for (const [name, toolData] of Object.entries(tools)) { const version = parseVersion(toolData); // Parse the tool options in the tool name - const toolNameMatchResult = optionInToolNameRegex.exec( - name.trim(), - )?.groups; + const toolNameMatchResult = optionInToolNameRegex.exec(name.trim())?.groups; if (!toolNameMatchResult) { throw new Error(`Failed to parse tool name: ${name}`); } From 016baa99ae9d4fbe5507c97e8c56f33d01a156cd Mon Sep 17 00:00:00 2001 From: Risu <79110363+risu729@users.noreply.github.com> Date: Fri, 7 Feb 2025 00:09:35 +1100 Subject: [PATCH 27/30] Revert "fix(manager/mise): fix coverage issue" This reverts commit b329d1570a035fab8d2e24e6959366c962233d43. --- lib/modules/manager/mise/extract.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/modules/manager/mise/extract.ts b/lib/modules/manager/mise/extract.ts index 4284453d9d26d8..2d191268e0602a 100644 --- a/lib/modules/manager/mise/extract.ts +++ b/lib/modules/manager/mise/extract.ts @@ -42,11 +42,10 @@ export function extractPackageFile( for (const [name, toolData] of Object.entries(tools)) { const version = parseVersion(toolData); // Parse the tool options in the tool name - const toolNameMatchResult = optionInToolNameRegex.exec(name.trim())?.groups; - if (!toolNameMatchResult) { - throw new Error(`Failed to parse tool name: ${name}`); - } - const { name: depName, options: optionsInName } = toolNameMatchResult; + const { name: depName, options: optionsInName } = + optionInToolNameRegex.exec(name.trim())?.groups ?? { + name: name.trim(), + }; const delimiterIndex = name.indexOf(':'); const backend = depName.substring(0, delimiterIndex); const toolName = depName.substring(delimiterIndex + 1); From 36b037c53b310fdcb2723c8cd59ddc371c2a98a6 Mon Sep 17 00:00:00 2001 From: Risu <79110363+risu729@users.noreply.github.com> Date: Fri, 7 Feb 2025 00:13:45 +1100 Subject: [PATCH 28/30] fix: ignore coverage --- lib/modules/manager/mise/extract.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/modules/manager/mise/extract.ts b/lib/modules/manager/mise/extract.ts index 2d191268e0602a..1ccb5cc3745584 100644 --- a/lib/modules/manager/mise/extract.ts +++ b/lib/modules/manager/mise/extract.ts @@ -43,6 +43,7 @@ export function extractPackageFile( const version = parseVersion(toolData); // Parse the tool options in the tool name const { name: depName, options: optionsInName } = + // istanbul ignore next: groups is always defined optionInToolNameRegex.exec(name.trim())?.groups ?? { name: name.trim(), }; From 82b3f3135f43759e5ac53c85fe1ae3b36f6482f1 Mon Sep 17 00:00:00 2001 From: Risu <79110363+risu729@users.noreply.github.com> Date: Fri, 7 Feb 2025 00:17:48 +1100 Subject: [PATCH 29/30] style: format --- lib/modules/manager/mise/extract.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/modules/manager/mise/extract.ts b/lib/modules/manager/mise/extract.ts index 1ccb5cc3745584..f1860d3b85e6b2 100644 --- a/lib/modules/manager/mise/extract.ts +++ b/lib/modules/manager/mise/extract.ts @@ -43,7 +43,7 @@ export function extractPackageFile( const version = parseVersion(toolData); // Parse the tool options in the tool name const { name: depName, options: optionsInName } = - // istanbul ignore next: groups is always defined + // istanbul ignore next: groups is always defined optionInToolNameRegex.exec(name.trim())?.groups ?? { name: name.trim(), }; From be4fec7590231f9923f3cae0a8919ac14b3df16b Mon Sep 17 00:00:00 2001 From: Risu <79110363+risu729@users.noreply.github.com> Date: Fri, 7 Feb 2025 20:18:16 +1100 Subject: [PATCH 30/30] docs(manager): remove limitations about v prefix in mise manager --- lib/modules/manager/mise/readme.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/modules/manager/mise/readme.md b/lib/modules/manager/mise/readme.md index c0c53354117f79..1f5e77d208dd6b 100644 --- a/lib/modules/manager/mise/readme.md +++ b/lib/modules/manager/mise/readme.md @@ -92,10 +92,6 @@ Renovate's `mise` manager does not support the following tool syntax: The `tag_regex` option is used as `extractVersion`, but the regex engines are not the same between mise and Renovate. If the version is not updated or updated incorrectly, override `extractVersion` manually in the renovate config. -- Versions with `v` prefix. - mise automatically strips the `v` prefix from versions, but Renovate does not. - If the version is not updated or updated incorrectly, set `extractVersion` to `v(?.+)` in the Renovate config. - ### Supported default registry tool short names Renovate's `mise` manager can only version these tool short names: