From c8a9d1908baf40920198bb8d26e06ddf9ceeea24 Mon Sep 17 00:00:00 2001 From: Risu <79110363+risu729@users.noreply.github.com> Date: Tue, 3 Jun 2025 07:21:39 +1000 Subject: [PATCH 1/4] docs(registry): fix links of registry --- docs/registry.data.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/registry.data.ts b/docs/registry.data.ts index 749653ce8e..b184206037 100644 --- a/docs/registry.data.ts +++ b/docs/registry.data.ts @@ -31,11 +31,14 @@ export default { let name = typeof backend === "string" ? backend : backend.full; // replace selector square brackets name = name.replace(/(.*?)\[.*\]/g, "$1"); - const parts = name.toString().split(":"); + const parts = name.split(":", 2); const prefix = parts[0]; const slug = parts[1]; + const repoName = slug.split("/").slice(0,1).join("/"); const urlMap: { [key: string]: string } = { core: `https://mise.jdx.dev/lang/${slug}.html`, + asdf: slug.startsWith("http") ? slug : `https://github.com/${slug}`, + aqua: `https://github.com/${repoName}`, cargo: `https://crates.io/crates/${slug}`, go: `https://pkg.go.dev/${slug}`, pipx: `https://pypi.org/project/${slug}`, From 5f624341545718820f3f33bc12092b962a14389b Mon Sep 17 00:00:00 2001 From: Risu <79110363+risu729@users.noreply.github.com> Date: Tue, 3 Jun 2025 07:28:37 +1000 Subject: [PATCH 2/4] fix: revert tostring --- docs/registry.data.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/registry.data.ts b/docs/registry.data.ts index b184206037..94dae7034a 100644 --- a/docs/registry.data.ts +++ b/docs/registry.data.ts @@ -31,7 +31,7 @@ export default { let name = typeof backend === "string" ? backend : backend.full; // replace selector square brackets name = name.replace(/(.*?)\[.*\]/g, "$1"); - const parts = name.split(":", 2); + const parts = name.toString().split(":", 2); const prefix = parts[0]; const slug = parts[1]; const repoName = slug.split("/").slice(0,1).join("/"); From 03360da57062cd52f8711df24723ba6347107adf Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Mon, 2 Jun 2025 21:35:04 +0000 Subject: [PATCH 3/4] [autofix.ci] apply automated fixes --- docs/registry.data.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/registry.data.ts b/docs/registry.data.ts index 94dae7034a..42df9f030c 100644 --- a/docs/registry.data.ts +++ b/docs/registry.data.ts @@ -34,7 +34,7 @@ export default { const parts = name.toString().split(":", 2); const prefix = parts[0]; const slug = parts[1]; - const repoName = slug.split("/").slice(0,1).join("/"); + const repoName = slug.split("/").slice(0, 1).join("/"); const urlMap: { [key: string]: string } = { core: `https://mise.jdx.dev/lang/${slug}.html`, asdf: slug.startsWith("http") ? slug : `https://github.com/${slug}`, From 3600471120a6c4632c83ff47b1c689cab9732d4a Mon Sep 17 00:00:00 2001 From: Risu <79110363+risu729@users.noreply.github.com> Date: Tue, 3 Jun 2025 17:56:17 +1000 Subject: [PATCH 4/4] fix: fix types --- docs/registry.data.ts | 49 ++++++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/docs/registry.data.ts b/docs/registry.data.ts index 42df9f030c..a850ceae30 100644 --- a/docs/registry.data.ts +++ b/docs/registry.data.ts @@ -2,38 +2,48 @@ import * as fs from "node:fs"; import { load } from "js-toml"; type Registry = { - [key: string]: { - short: string; - aliases?: string[]; - backends?: [{ name: string; url: string }?]; - os?: string[]; - }; + tools: Record< + string, + { + aliases?: string[]; + backends: ( + | string + | { + full: string; + platforms?: string[]; + } + )[]; + os?: string[]; + } + >; }; -type Backend = string | { full: string; platforms: string[] }; +type Tool = { + short: string; + backends: { name: string; url: string }[]; + aliases: string[]; + os: string[]; +}; export default { watch: ["./registry.toml"], load() { const raw = fs.readFileSync("./registry.toml", "utf-8"); - const doc: any = load(raw); - const registry: Registry = {}; + const { tools } = load(raw) as Registry; + const registry: Record = {}; - const tools = doc["tools"]; for (const key in tools) { const tool = tools[key]; - const backends = tool.backends || []; registry[key] = { short: key, - aliases: tool.aliases || [], - backends: backends.map((backend: Backend) => { + backends: tool.backends.map((backend) => { let name = typeof backend === "string" ? backend : backend.full; // replace selector square brackets name = name.replace(/(.*?)\[.*\]/g, "$1"); - const parts = name.toString().split(":", 2); - const prefix = parts[0]; - const slug = parts[1]; + const parts = name.split(":", 2); + const prefix = parts.at(0) ?? ""; + const slug = parts.at(1) ?? ""; const repoName = slug.split("/").slice(0, 1).join("/"); const urlMap: { [key: string]: string } = { core: `https://mise.jdx.dev/lang/${slug}.html`, @@ -44,18 +54,19 @@ export default { pipx: `https://pypi.org/project/${slug}`, npm: `https://www.npmjs.com/package/${slug}`, }; - const url = urlMap[prefix] || `https://github.com/${slug}`; + const url = urlMap[prefix] ?? `https://github.com/${slug}`; return { name, url, }; }), - os: tool.os || [], + aliases: tool.aliases ?? [], + os: tool.os ?? [], }; } return Object.values(registry).sort((a, b) => - a.short.localeCompare(b.short), + a.short.localeCompare(b.short, "en"), ); }, };