From 2c72bd4b3382e6a3db0f7d2207aea4bc07aa4a1e Mon Sep 17 00:00:00 2001 From: David Sherret Date: Sat, 3 Oct 2026 18:32:02 -0400 Subject: [PATCH 1/6] fix: name info.json plugins by the name they report about themselves --- homeView.tsx | 9 +++++--- info.json | 57 ++++++++++++++++++++++++++++++++----------------- plugins.test.ts | 29 ++++++++++++++++++++++++- plugins.ts | 44 ++++++++++++++++++++++++++++++++------ readInfoFile.ts | 12 ++++++----- 5 files changed, 117 insertions(+), 34 deletions(-) diff --git a/homeView.tsx b/homeView.tsx index f746709..349e981 100644 --- a/homeView.tsx +++ b/homeView.tsx @@ -86,7 +86,9 @@ function renderPage(pluginsData: PluginsData) { autocomplete="off" spellcheck={false} /> - dprint plugin docs ↗ + + dprint plugin docs ↗ + {renderPlugins(pluginsData)} @@ -101,6 +103,7 @@ function renderPage(pluginsData: PluginsData) { function pluginSearchText(plugin: PluginData) { const parts: (string | undefined)[] = [ plugin.name, + plugin.repo, // the url stays searchable even when the npm specifier is what's shown plugin.url, latestReference(plugin), @@ -164,7 +167,7 @@ function renderPlugin(plugin: PluginData) {
- {plugin.name} + {plugin.repo ?? plugin.name} {plugin.version ? {plugin.version} : null}
{renderPluginLinks(plugin)} @@ -174,7 +177,7 @@ function renderPlugin(plugin: PluginData) { {latestReference(plugin)}
- Downloads (30d) + Downloads (30d) {plugin.downloadCount.allVersions?.toLocaleString("en-US")}
diff --git a/info.json b/info.json index fa9ea98..16e6a9c 100644 --- a/info.json +++ b/info.json @@ -259,7 +259,8 @@ "configExcludes": [] }, { - "name": "jakebailey/gofumpt", + "name": "dprint-plugin-gofumpt", + "repo": "jakebailey/gofumpt", "description": "Gofumpt (Go) wrapper plugin.", "website": "https://dprint.dev/plugins/gofumpt/", "npm": { @@ -279,7 +280,8 @@ "configExcludes": [] }, { - "name": "kachick/kdl", + "name": "dprint-plugin-kdl", + "repo": "kachick/kdl", "description": "KDL crate wrapper plugin.", "npm": { "name": "@kachick/dprint-plugin-kdl" @@ -295,7 +297,8 @@ "configExcludes": [] }, { - "name": "kachick/nix", + "name": "dprint-plugin-nix", + "repo": "kachick/nix", "description": "Nixfmt-rs (Nix) wrapper plugin.", "npm": { "name": "@kachick/dprint-plugin-nix" @@ -312,7 +315,8 @@ "configExcludes": [] }, { - "name": "kachick/sh", + "name": "dprint-plugin-sh", + "repo": "kachick/sh", "description": "Shuck-formatter (shell script) wrapper plugin.", "npm": { "name": "@kachick/dprint-plugin-sh" @@ -370,7 +374,8 @@ "configExcludes": [] }, { - "name": "g-plane/malva", + "name": "dprint_plugin_malva", + "repo": "g-plane/malva", "description": "CSS, SCSS, Sass and Less formatter.", "website": "https://dprint.dev/plugins/malva/", "npm": { @@ -396,7 +401,8 @@ ] }, { - "name": "g-plane/markup_fmt", + "name": "dprint_plugin_markup", + "repo": "g-plane/markup_fmt", "description": "HTML, Vue, Svelte, Astro, Angular, Jinja, Twig, Nunjucks, and Vento formatter.", "website": "https://dprint.dev/plugins/markup_fmt/", "npm": { @@ -445,7 +451,8 @@ "configExcludes": [] }, { - "name": "g-plane/pretty_yaml", + "name": "dprint_plugin_yaml", + "repo": "g-plane/pretty_yaml", "description": "YAML formatter.", "website": "https://dprint.dev/plugins/pretty_yaml/", "npm": { @@ -466,7 +473,8 @@ "configExcludes": [] }, { - "name": "g-plane/pretty_graphql", + "name": "dprint_plugin_graphql", + "repo": "g-plane/pretty_graphql", "description": "GraphQL formatter.", "website": "https://dprint.dev/plugins/pretty_graphql/", "npm": { @@ -486,7 +494,8 @@ "configExcludes": [] }, { - "name": "apcamargo/bibtex-tidy", + "name": "dprint-plugin-bibtex-tidy", + "repo": "apcamargo/bibtex-tidy", "description": "Tidy bibtex files.", "selected": false, "configKey": "bibtex-tidy", @@ -515,7 +524,8 @@ "configExcludes": [] }, { - "name": "bartlomieju/lax-css", + "name": "lax-css", + "repo": "bartlomieju/lax-css", "description": "CSS, SCSS, and Less formatter that never reinterprets your styles.", "npm": { "name": "lax-css" @@ -538,7 +548,8 @@ ] }, { - "name": "bartlomieju/lax-markup", + "name": "lax-markup", + "repo": "bartlomieju/lax-markup", "description": "HTML, XML, SVG, Vue, Svelte, and Astro formatter that preserves rendering-critical whitespace.", "npm": { "name": "lax-markup" @@ -566,7 +577,8 @@ "configExcludes": [] }, { - "name": "bartlomieju/lax-sql", + "name": "lax-sql", + "repo": "bartlomieju/lax-sql", "description": "Dialect-agnostic SQL formatter.", "npm": { "name": "lax-sql" @@ -587,7 +599,8 @@ "configExcludes": [] }, { - "name": "jolars/panache", + "name": "dprint-plugin-panache", + "repo": "jolars/panache", "description": "Quarto, Pandoc, R Markdown, and Markdown formatter.", "selected": false, "configKey": "panache", @@ -611,7 +624,8 @@ "configExcludes": [] }, { - "name": "drluckyspin/swift", + "name": "dprint-plugin-swift", + "repo": "drluckyspin/swift", "description": "Swift code formatter (SwiftFormat wrapper).", "selected": false, "configKey": "swiftformat", @@ -818,7 +832,8 @@ ] }, { - "name": "sargunv/dprint-clang-format", + "name": "dprint-plugin-clang-format", + "repo": "sargunv/dprint-clang-format", "description": "C, C++, and Objective-C code formatter (clang-format).", "selected": false, "configKey": "clangFormat", @@ -846,7 +861,8 @@ "configExcludes": [] }, { - "name": "sargunv/dprint-cmakefmt", + "name": "dprint-cmakefmt", + "repo": "sargunv/dprint-cmakefmt", "description": "CMake code formatter (cmakefmt).", "selected": false, "configKey": "cmakefmt", @@ -865,7 +881,8 @@ "configExcludes": [] }, { - "name": "jolars/arity", + "name": "dprint-plugin-arity", + "repo": "jolars/arity", "description": "R code formatter (arity).", "selected": false, "configKey": "arity", @@ -882,7 +899,8 @@ "configExcludes": [] }, { - "name": "jolars/fatou", + "name": "dprint-plugin-fatou", + "repo": "jolars/fatou", "description": "Julia code formatter (fatou).", "selected": false, "configKey": "fatou", @@ -896,7 +914,8 @@ "configExcludes": [] }, { - "name": "jolars/badness", + "name": "dprint-plugin-badness", + "repo": "jolars/badness", "description": "LaTeX and BibTeX code formatter (badness).", "selected": false, "configKey": "badness", diff --git a/plugins.test.ts b/plugins.test.ts index 1511fc3..323a0d0 100644 --- a/plugins.test.ts +++ b/plugins.test.ts @@ -1,11 +1,26 @@ import { expect, it } from "vitest"; -import { tryResolveAssetUrl, tryResolveLatestJson } from "./plugins.js"; +import { getPluginRepo, tryResolveAssetUrl, tryResolveLatestJson } from "./plugins.js"; import { getLatestReleaseInfo } from "./utils/github.js"; function resolveAsset(url: string) { return tryResolveAssetUrl(new URL(url)); } +it("getPluginRepo", () => { + // dprint org plugin named after its repo + expect(getPluginRepo({ name: "dprint-plugin-typescript" })).toEqual({ + username: "dprint", + repoName: "dprint-plugin-typescript", + }); + // plugin whose name isn't its repo + expect(getPluginRepo({ name: "dprint_plugin_malva", repo: "g-plane/malva" })).toEqual({ + username: "g-plane", + repoName: "malva", + }); + // entry still named by its repo + expect(getPluginRepo({ name: "kachick/typstyle" })).toEqual({ username: "kachick", repoName: "typstyle" }); +}); + it("tryResolveAssetUrl", () => { // allowed repo — should cache expect( @@ -151,6 +166,18 @@ it("tryResolveUserLatestJson", async () => { npm: { name: "dprint-plugin-malva" }, }); } + // community plugin asked for by the name it has in info.json + { + const result = await getValidResultForUrl("https://plugins.dprint.dev/dprint/dprint_plugin_malva/latest.json"); + const releaseInfo = await getLatestReleaseInfo("g-plane", "malva"); + expect(result).toEqual({ + schemaVersion: 1, + url: `https://plugins.dprint.dev/g-plane/malva-${releaseInfo!.tagName}.wasm`, + version: releaseInfo!.tagName.replace(/^v/, ""), + checksum: releaseInfo!.checksum, + npm: { name: "dprint-plugin-malva" }, + }); + } async function getValidResultForUrl(url: string) { const result = await tryResolveLatestJson(new URL(url))!; diff --git a/plugins.ts b/plugins.ts index 6bb26d6..9ee43ae 100644 --- a/plugins.ts +++ b/plugins.ts @@ -82,6 +82,24 @@ export interface PluginNpmInfo { // resolved repo name (ex. `dprint/dprint-plugin-typescript` and `g-plane/malva`) const npmPackagesByRepo = buildNpmPackagesByRepo(); +// the repos of the info.json plugins that aren't named after their repo, keyed +// by plugin name +const reposByPluginName = buildReposByPluginName(); + +/** + * The GitHub repo an info.json entry is published from. An entry's name is + * the name the plugin reports about itself, which the cli matches against the + * plugins in a config file, so `repo` says where it's published from when + * that's not a dprint org repo with the same name. + */ +export function getPluginRepo(plugin: { name: string; repo?: string }) { + const repo = plugin.repo ?? plugin.name; + const slashIndex = repo.indexOf("/"); + return slashIndex === -1 + ? { username: "dprint", repoName: repo } + : { username: repo.slice(0, slashIndex), repoName: repo.slice(slashIndex + 1) }; +} + const APPROVED_ASSET_REPOS = new Set([ "drluckyspin/dprint-plugin-swift", ]); @@ -139,8 +157,13 @@ export async function tryResolveLatestJson(url: URL) { if (!result) { return undefined; } - const username = result.pathname.groups[0]!; - const shortRepoName = result.pathname.groups[1]!; + // `dprint add ` asks for `dprint/`, and the name a + // plugin outside the dprint org has in info.json isn't the repo it's published from + const namedRepo = result.pathname.groups[0] === "dprint" + ? reposByPluginName.get(result.pathname.groups[1]!) + : undefined; + const username = namedRepo?.username ?? result.pathname.groups[0]!; + const shortRepoName = namedRepo?.repoName ?? result.pathname.groups[1]!; const latestInfo = await getLatestInfo(username, shortRepoName, url.origin); if (latestInfo == null) { return 404; @@ -235,19 +258,28 @@ async function userRepoTagPatternMapper( function buildNpmPackagesByRepo() { const result = new Map(); - for (const plugin of infoJson.latest as { name: string; npm?: PluginNpmInfo }[]) { + for (const plugin of infoJson.latest as { name: string; repo?: string; npm?: PluginNpmInfo }[]) { if (plugin.npm == null) { continue; } - const slashIndex = plugin.name.indexOf("/"); - const username = slashIndex === -1 ? "dprint" : plugin.name.slice(0, slashIndex); - const shortName = plugin.name.slice(slashIndex + 1).replace(/^dprint-plugin-/, ""); + const { username, repoName } = getPluginRepo(plugin); + const shortName = repoName.replace(/^dprint-plugin-/, ""); result.set(`${username}/${shortName}`, plugin.npm); result.set(`${username}/dprint-plugin-${shortName}`, plugin.npm); } return result; } +function buildReposByPluginName() { + const result = new Map(); + for (const plugin of infoJson.latest as { name: string; repo?: string }[]) { + if (plugin.repo != null) { + result.set(plugin.name, getPluginRepo(plugin)); + } + } + return result; +} + async function getFullRepoName(username: string, repoName: string) { if (repoName.startsWith("dprint-plugin-")) { return repoName; diff --git a/readInfoFile.ts b/readInfoFile.ts index 3960511..56f2ba1 100644 --- a/readInfoFile.ts +++ b/readInfoFile.ts @@ -1,6 +1,6 @@ import { env } from "cloudflare:workers"; import infoJson from "./info.json" with { type: "json" }; -import { getLatestInfo, type PluginNpmInfo } from "./plugins.js"; +import { getLatestInfo, getPluginRepo, type PluginNpmInfo } from "./plugins.js"; import { getDownloadCounts, type PluginDownloadCounts } from "./utils/analytics.js"; import { getNpmDownloadCounts, getNpmLatestVersions } from "./utils/npm.js"; @@ -10,7 +10,11 @@ export interface PluginsData { } export interface PluginData { + // the name the plugin reports about itself name: string; + // the `username/repo` the plugin is published from, when that's not a dprint + // org repo with the plugin's name + repo?: string; url: string; version: string; downloadCount: { @@ -162,10 +166,8 @@ async function buildInfoFile(origin: string): Promise> { const released = []; for (const plugin of latest) { - const [username, pluginName] = plugin.name.split("/"); - const info = pluginName - ? await getLatestInfo(username, pluginName, origin) - : await getLatestInfo("dprint", plugin.name, origin); + const { username, repoName } = getPluginRepo(plugin); + const info = await getLatestInfo(username, repoName, origin); if (info != null) { released.push({ plugin, info }); } From 5a7eff7ca0b870a5b8b538b59dfae9a963419793 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Sat, 3 Oct 2026 18:35:40 -0400 Subject: [PATCH 2/6] give every info.json entry a repo --- homeView.tsx | 8 +++++++- info.json | 35 +++++++++++++++++++++++++---------- plugins.test.ts | 18 +++++++++--------- plugins.ts | 27 ++++++++++----------------- readInfoFile.ts | 4 ++-- 5 files changed, 53 insertions(+), 39 deletions(-) diff --git a/homeView.tsx b/homeView.tsx index 349e981..dfbb727 100644 --- a/homeView.tsx +++ b/homeView.tsx @@ -167,7 +167,7 @@ function renderPlugin(plugin: PluginData) {
- {plugin.repo ?? plugin.name} + {displayName(plugin)} {plugin.version ? {plugin.version} : null}
{renderPluginLinks(plugin)} @@ -213,6 +213,12 @@ function latestReference(plugin: PluginData) { // the repo and docs links shown beneath a plugin's name. both are optional: the // repo url is derived during the build and docs only exist for plugins with a // dprint.dev page. +// plugins are listed by the repo they're published from, with the dprint org +// left off its own plugins +function displayName(plugin: PluginData) { + return plugin.repo?.replace(/^dprint\//, "") ?? plugin.name; +} + function renderPluginLinks(plugin: PluginData) { if (plugin.repoUrl == null && plugin.website == null) { return null; diff --git a/info.json b/info.json index 16e6a9c..b42aa3a 100644 --- a/info.json +++ b/info.json @@ -4,6 +4,7 @@ "latest": [ { "name": "dprint-plugin-typescript", + "repo": "dprint/dprint-plugin-typescript", "description": "TypeScript/JavaScript code formatter.", "website": "https://dprint.dev/plugins/typescript/", "npm": { @@ -34,6 +35,7 @@ }, { "name": "dprint-plugin-json", + "repo": "dprint/dprint-plugin-json", "description": "JSON/JSONC code formatter.", "website": "https://dprint.dev/plugins/json/", "npm": { @@ -55,6 +57,7 @@ }, { "name": "dprint-plugin-markdown", + "repo": "dprint/dprint-plugin-markdown", "description": "Markdown code formatter.", "website": "https://dprint.dev/plugins/markdown/", "npm": { @@ -79,6 +82,7 @@ }, { "name": "dprint-plugin-toml", + "repo": "dprint/dprint-plugin-toml", "description": "TOML code formatter.", "website": "https://dprint.dev/plugins/toml/", "npm": { @@ -97,6 +101,7 @@ }, { "name": "dprint-plugin-dockerfile", + "repo": "dprint/dprint-plugin-dockerfile", "description": "Dockerfile code formatter.", "website": "https://dprint.dev/plugins/dockerfile/", "npm": { @@ -119,6 +124,7 @@ }, { "name": "dprint-plugin-biome", + "repo": "dprint/dprint-plugin-biome", "description": "Biome (JS/TS/JSON) wrapper plugin.", "website": "https://dprint.dev/plugins/biome/", "npm": { @@ -151,6 +157,7 @@ }, { "name": "dprint-plugin-oxc", + "repo": "dprint/dprint-plugin-oxc", "description": "Oxc (JS/TS/JSON/CSS/SCSS/Less/GraphQL/YAML/TOML) wrapper plugin.", "website": "https://dprint.dev/plugins/oxc/", "npm": { @@ -200,6 +207,7 @@ }, { "name": "dprint-plugin-mago", + "repo": "dprint/dprint-plugin-mago", "description": "Mago (PHP) wrapper plugin.", "website": "https://dprint.dev/plugins/mago/", "npm": { @@ -219,6 +227,7 @@ }, { "name": "dprint-plugin-ruff", + "repo": "dprint/dprint-plugin-ruff", "description": "Ruff (Python) wrapper plugin.", "website": "https://dprint.dev/plugins/ruff/", "npm": { @@ -240,6 +249,7 @@ }, { "name": "dprint-plugin-jupyter", + "repo": "dprint/dprint-plugin-jupyter", "description": "Jupyter notebook code block formatter.", "website": "https://dprint.dev/plugins/jupyter/", "npm": { @@ -260,7 +270,7 @@ }, { "name": "dprint-plugin-gofumpt", - "repo": "jakebailey/gofumpt", + "repo": "jakebailey/dprint-plugin-gofumpt", "description": "Gofumpt (Go) wrapper plugin.", "website": "https://dprint.dev/plugins/gofumpt/", "npm": { @@ -281,7 +291,7 @@ }, { "name": "dprint-plugin-kdl", - "repo": "kachick/kdl", + "repo": "kachick/dprint-plugin-kdl", "description": "KDL crate wrapper plugin.", "npm": { "name": "@kachick/dprint-plugin-kdl" @@ -298,7 +308,7 @@ }, { "name": "dprint-plugin-nix", - "repo": "kachick/nix", + "repo": "kachick/dprint-plugin-nix", "description": "Nixfmt-rs (Nix) wrapper plugin.", "npm": { "name": "@kachick/dprint-plugin-nix" @@ -316,7 +326,7 @@ }, { "name": "dprint-plugin-sh", - "repo": "kachick/sh", + "repo": "kachick/dprint-plugin-sh", "description": "Shuck-formatter (shell script) wrapper plugin.", "npm": { "name": "@kachick/dprint-plugin-sh" @@ -358,6 +368,7 @@ }, { "name": "kachick/typstyle", + "repo": "kachick/dprint-plugin-typstyle", "description": "Typstyle (Typst) wrapper plugin.", "npm": { "name": "@kachick/dprint-plugin-typstyle" @@ -495,7 +506,7 @@ }, { "name": "dprint-plugin-bibtex-tidy", - "repo": "apcamargo/bibtex-tidy", + "repo": "apcamargo/dprint-plugin-bibtex-tidy", "description": "Tidy bibtex files.", "selected": false, "configKey": "bibtex-tidy", @@ -510,6 +521,7 @@ }, { "name": "apcamargo/typstyle", + "repo": "apcamargo/dprint-plugin-typstyle", "description": "A beautiful and reliable code formatter for Typst.", "selected": false, "configKey": "typstyle", @@ -600,7 +612,7 @@ }, { "name": "dprint-plugin-panache", - "repo": "jolars/panache", + "repo": "jolars/dprint-plugin-panache", "description": "Quarto, Pandoc, R Markdown, and Markdown formatter.", "selected": false, "configKey": "panache", @@ -625,7 +637,7 @@ }, { "name": "dprint-plugin-swift", - "repo": "drluckyspin/swift", + "repo": "drluckyspin/dprint-plugin-swift", "description": "Swift code formatter (SwiftFormat wrapper).", "selected": false, "configKey": "swiftformat", @@ -644,6 +656,7 @@ }, { "name": "dprint-plugin-prettier", + "repo": "dprint/dprint-plugin-prettier", "description": "Prettier wrapper plugin (consider faster dedicated plugins for JS/TS, CSS, etc.).", "website": "https://dprint.dev/plugins/prettier/", "npm": { @@ -692,6 +705,7 @@ }, { "name": "dprint-plugin-roslyn", + "repo": "dprint/dprint-plugin-roslyn", "description": "C# and Visual Basic code formatter (Roslyn).", "website": "https://dprint.dev/plugins/roslyn/", "npm": { @@ -716,6 +730,7 @@ }, { "name": "dprint-plugin-exec", + "repo": "dprint/dprint-plugin-exec", "description": "Formats code using formatting CLIs installed on the host machine (rustfmt, clang-format, shfmt, etc.).", "website": "https://dprint.dev/plugins/exec/", "npm": { @@ -882,7 +897,7 @@ }, { "name": "dprint-plugin-arity", - "repo": "jolars/arity", + "repo": "jolars/dprint-plugin-arity", "description": "R code formatter (arity).", "selected": false, "configKey": "arity", @@ -900,7 +915,7 @@ }, { "name": "dprint-plugin-fatou", - "repo": "jolars/fatou", + "repo": "jolars/dprint-plugin-fatou", "description": "Julia code formatter (fatou).", "selected": false, "configKey": "fatou", @@ -915,7 +930,7 @@ }, { "name": "dprint-plugin-badness", - "repo": "jolars/badness", + "repo": "jolars/dprint-plugin-badness", "description": "LaTeX and BibTeX code formatter (badness).", "selected": false, "configKey": "badness", diff --git a/plugins.test.ts b/plugins.test.ts index 323a0d0..db88573 100644 --- a/plugins.test.ts +++ b/plugins.test.ts @@ -1,4 +1,5 @@ import { expect, it } from "vitest"; +import infoJson from "./info.json" with { type: "json" }; import { getPluginRepo, tryResolveAssetUrl, tryResolveLatestJson } from "./plugins.js"; import { getLatestReleaseInfo } from "./utils/github.js"; @@ -7,18 +8,17 @@ function resolveAsset(url: string) { } it("getPluginRepo", () => { - // dprint org plugin named after its repo - expect(getPluginRepo({ name: "dprint-plugin-typescript" })).toEqual({ + expect(getPluginRepo({ repo: "dprint/dprint-plugin-typescript" })).toEqual({ username: "dprint", repoName: "dprint-plugin-typescript", }); - // plugin whose name isn't its repo - expect(getPluginRepo({ name: "dprint_plugin_malva", repo: "g-plane/malva" })).toEqual({ - username: "g-plane", - repoName: "malva", - }); - // entry still named by its repo - expect(getPluginRepo({ name: "kachick/typstyle" })).toEqual({ username: "kachick", repoName: "typstyle" }); + expect(getPluginRepo({ repo: "g-plane/malva" })).toEqual({ username: "g-plane", repoName: "malva" }); +}); + +it("info.json entries should say what repo they're published from", () => { + for (const plugin of infoJson.latest) { + expect(plugin.repo, plugin.name).toMatch(/^[A-Za-z0-9-]+\/[A-Za-z0-9._-]+$/); + } }); it("tryResolveAssetUrl", () => { diff --git a/plugins.ts b/plugins.ts index 9ee43ae..57d3039 100644 --- a/plugins.ts +++ b/plugins.ts @@ -82,22 +82,17 @@ export interface PluginNpmInfo { // resolved repo name (ex. `dprint/dprint-plugin-typescript` and `g-plane/malva`) const npmPackagesByRepo = buildNpmPackagesByRepo(); -// the repos of the info.json plugins that aren't named after their repo, keyed -// by plugin name +// the repos of the info.json plugins, keyed by plugin name const reposByPluginName = buildReposByPluginName(); /** - * The GitHub repo an info.json entry is published from. An entry's name is + * The GitHub repo an info.json entry is published from. An entry's `name` is * the name the plugin reports about itself, which the cli matches against the - * plugins in a config file, so `repo` says where it's published from when - * that's not a dprint org repo with the same name. + * plugins in a config file, so `repo` is what says where it's published from. */ -export function getPluginRepo(plugin: { name: string; repo?: string }) { - const repo = plugin.repo ?? plugin.name; - const slashIndex = repo.indexOf("/"); - return slashIndex === -1 - ? { username: "dprint", repoName: repo } - : { username: repo.slice(0, slashIndex), repoName: repo.slice(slashIndex + 1) }; +export function getPluginRepo(plugin: { repo: string }) { + const slashIndex = plugin.repo.indexOf("/"); + return { username: plugin.repo.slice(0, slashIndex), repoName: plugin.repo.slice(slashIndex + 1) }; } const APPROVED_ASSET_REPOS = new Set([ @@ -158,7 +153,7 @@ export async function tryResolveLatestJson(url: URL) { return undefined; } // `dprint add ` asks for `dprint/`, and the name a - // plugin outside the dprint org has in info.json isn't the repo it's published from + // plugin has in info.json isn't necessarily the repo it's published from const namedRepo = result.pathname.groups[0] === "dprint" ? reposByPluginName.get(result.pathname.groups[1]!) : undefined; @@ -258,7 +253,7 @@ async function userRepoTagPatternMapper( function buildNpmPackagesByRepo() { const result = new Map(); - for (const plugin of infoJson.latest as { name: string; repo?: string; npm?: PluginNpmInfo }[]) { + for (const plugin of infoJson.latest as { repo: string; npm?: PluginNpmInfo }[]) { if (plugin.npm == null) { continue; } @@ -272,10 +267,8 @@ function buildNpmPackagesByRepo() { function buildReposByPluginName() { const result = new Map(); - for (const plugin of infoJson.latest as { name: string; repo?: string }[]) { - if (plugin.repo != null) { - result.set(plugin.name, getPluginRepo(plugin)); - } + for (const plugin of infoJson.latest) { + result.set(plugin.name, getPluginRepo(plugin)); } return result; } diff --git a/readInfoFile.ts b/readInfoFile.ts index 56f2ba1..a83f270 100644 --- a/readInfoFile.ts +++ b/readInfoFile.ts @@ -12,8 +12,8 @@ export interface PluginsData { export interface PluginData { // the name the plugin reports about itself name: string; - // the `username/repo` the plugin is published from, when that's not a dprint - // org repo with the plugin's name + // the `username/repo` the plugin is published from. carried over from + // info.json, so it's absent from data cached before info.json declared it repo?: string; url: string; version: string; From af9ecb9fdd98819ede0227267f15368a2ec10438 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Sat, 3 Oct 2026 18:35:58 -0400 Subject: [PATCH 3/6] test the name shown for a plugin on the homepage --- homeView.test.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/homeView.test.ts b/homeView.test.ts index 76bbfd7..2b1507a 100644 --- a/homeView.test.ts +++ b/homeView.test.ts @@ -90,3 +90,14 @@ it("should keep the url searchable when a specifier replaced it", () => { expect(search).toContain("https://plugins.dprint.dev/json-1.0.0.wasm"); expect(search).toContain("npm:@dprint/json@1.2.3"); }); + +it("should list plugins by repo without the dprint org", () => { + const { html } = renderReferences([ + createPlugin({ name: "dprint-plugin-json", repo: "dprint/dprint-plugin-json" }), + createPlugin({ name: "dprint_plugin_malva", repo: "g-plane/malva" }), + // data cached before info.json declared the repo + createPlugin({ name: "dprint-plugin-cached" }), + ]); + const names = [...html.matchAll(/([^<]*)<\/span>/g)].map((m) => m[1]); + expect(names).toEqual(["dprint-plugin-json", "g-plane/malva", "dprint-plugin-cached"]); +}); From c575675904c07488702fb89111f204bd81877d35 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Sat, 3 Oct 2026 18:38:10 -0400 Subject: [PATCH 4/6] rename the info.json repo property to github --- homeView.test.ts | 4 +-- homeView.tsx | 4 +-- info.json | 68 ++++++++++++++++++++++++------------------------ plugins.test.ts | 6 ++--- plugins.ts | 10 +++---- readInfoFile.ts | 4 +-- 6 files changed, 48 insertions(+), 48 deletions(-) diff --git a/homeView.test.ts b/homeView.test.ts index 2b1507a..e2da177 100644 --- a/homeView.test.ts +++ b/homeView.test.ts @@ -93,8 +93,8 @@ it("should keep the url searchable when a specifier replaced it", () => { it("should list plugins by repo without the dprint org", () => { const { html } = renderReferences([ - createPlugin({ name: "dprint-plugin-json", repo: "dprint/dprint-plugin-json" }), - createPlugin({ name: "dprint_plugin_malva", repo: "g-plane/malva" }), + createPlugin({ name: "dprint-plugin-json", github: "dprint/dprint-plugin-json" }), + createPlugin({ name: "dprint_plugin_malva", github: "g-plane/malva" }), // data cached before info.json declared the repo createPlugin({ name: "dprint-plugin-cached" }), ]); diff --git a/homeView.tsx b/homeView.tsx index dfbb727..667bb5c 100644 --- a/homeView.tsx +++ b/homeView.tsx @@ -103,7 +103,7 @@ function renderPage(pluginsData: PluginsData) { function pluginSearchText(plugin: PluginData) { const parts: (string | undefined)[] = [ plugin.name, - plugin.repo, + plugin.github, // the url stays searchable even when the npm specifier is what's shown plugin.url, latestReference(plugin), @@ -216,7 +216,7 @@ function latestReference(plugin: PluginData) { // plugins are listed by the repo they're published from, with the dprint org // left off its own plugins function displayName(plugin: PluginData) { - return plugin.repo?.replace(/^dprint\//, "") ?? plugin.name; + return plugin.github?.replace(/^dprint\//, "") ?? plugin.name; } function renderPluginLinks(plugin: PluginData) { diff --git a/info.json b/info.json index b42aa3a..b93f204 100644 --- a/info.json +++ b/info.json @@ -4,7 +4,7 @@ "latest": [ { "name": "dprint-plugin-typescript", - "repo": "dprint/dprint-plugin-typescript", + "github": "dprint/dprint-plugin-typescript", "description": "TypeScript/JavaScript code formatter.", "website": "https://dprint.dev/plugins/typescript/", "npm": { @@ -35,7 +35,7 @@ }, { "name": "dprint-plugin-json", - "repo": "dprint/dprint-plugin-json", + "github": "dprint/dprint-plugin-json", "description": "JSON/JSONC code formatter.", "website": "https://dprint.dev/plugins/json/", "npm": { @@ -57,7 +57,7 @@ }, { "name": "dprint-plugin-markdown", - "repo": "dprint/dprint-plugin-markdown", + "github": "dprint/dprint-plugin-markdown", "description": "Markdown code formatter.", "website": "https://dprint.dev/plugins/markdown/", "npm": { @@ -82,7 +82,7 @@ }, { "name": "dprint-plugin-toml", - "repo": "dprint/dprint-plugin-toml", + "github": "dprint/dprint-plugin-toml", "description": "TOML code formatter.", "website": "https://dprint.dev/plugins/toml/", "npm": { @@ -101,7 +101,7 @@ }, { "name": "dprint-plugin-dockerfile", - "repo": "dprint/dprint-plugin-dockerfile", + "github": "dprint/dprint-plugin-dockerfile", "description": "Dockerfile code formatter.", "website": "https://dprint.dev/plugins/dockerfile/", "npm": { @@ -124,7 +124,7 @@ }, { "name": "dprint-plugin-biome", - "repo": "dprint/dprint-plugin-biome", + "github": "dprint/dprint-plugin-biome", "description": "Biome (JS/TS/JSON) wrapper plugin.", "website": "https://dprint.dev/plugins/biome/", "npm": { @@ -157,7 +157,7 @@ }, { "name": "dprint-plugin-oxc", - "repo": "dprint/dprint-plugin-oxc", + "github": "dprint/dprint-plugin-oxc", "description": "Oxc (JS/TS/JSON/CSS/SCSS/Less/GraphQL/YAML/TOML) wrapper plugin.", "website": "https://dprint.dev/plugins/oxc/", "npm": { @@ -207,7 +207,7 @@ }, { "name": "dprint-plugin-mago", - "repo": "dprint/dprint-plugin-mago", + "github": "dprint/dprint-plugin-mago", "description": "Mago (PHP) wrapper plugin.", "website": "https://dprint.dev/plugins/mago/", "npm": { @@ -227,7 +227,7 @@ }, { "name": "dprint-plugin-ruff", - "repo": "dprint/dprint-plugin-ruff", + "github": "dprint/dprint-plugin-ruff", "description": "Ruff (Python) wrapper plugin.", "website": "https://dprint.dev/plugins/ruff/", "npm": { @@ -249,7 +249,7 @@ }, { "name": "dprint-plugin-jupyter", - "repo": "dprint/dprint-plugin-jupyter", + "github": "dprint/dprint-plugin-jupyter", "description": "Jupyter notebook code block formatter.", "website": "https://dprint.dev/plugins/jupyter/", "npm": { @@ -270,7 +270,7 @@ }, { "name": "dprint-plugin-gofumpt", - "repo": "jakebailey/dprint-plugin-gofumpt", + "github": "jakebailey/dprint-plugin-gofumpt", "description": "Gofumpt (Go) wrapper plugin.", "website": "https://dprint.dev/plugins/gofumpt/", "npm": { @@ -291,7 +291,7 @@ }, { "name": "dprint-plugin-kdl", - "repo": "kachick/dprint-plugin-kdl", + "github": "kachick/dprint-plugin-kdl", "description": "KDL crate wrapper plugin.", "npm": { "name": "@kachick/dprint-plugin-kdl" @@ -308,7 +308,7 @@ }, { "name": "dprint-plugin-nix", - "repo": "kachick/dprint-plugin-nix", + "github": "kachick/dprint-plugin-nix", "description": "Nixfmt-rs (Nix) wrapper plugin.", "npm": { "name": "@kachick/dprint-plugin-nix" @@ -326,7 +326,7 @@ }, { "name": "dprint-plugin-sh", - "repo": "kachick/dprint-plugin-sh", + "github": "kachick/dprint-plugin-sh", "description": "Shuck-formatter (shell script) wrapper plugin.", "npm": { "name": "@kachick/dprint-plugin-sh" @@ -368,7 +368,7 @@ }, { "name": "kachick/typstyle", - "repo": "kachick/dprint-plugin-typstyle", + "github": "kachick/dprint-plugin-typstyle", "description": "Typstyle (Typst) wrapper plugin.", "npm": { "name": "@kachick/dprint-plugin-typstyle" @@ -386,7 +386,7 @@ }, { "name": "dprint_plugin_malva", - "repo": "g-plane/malva", + "github": "g-plane/malva", "description": "CSS, SCSS, Sass and Less formatter.", "website": "https://dprint.dev/plugins/malva/", "npm": { @@ -413,7 +413,7 @@ }, { "name": "dprint_plugin_markup", - "repo": "g-plane/markup_fmt", + "github": "g-plane/markup_fmt", "description": "HTML, Vue, Svelte, Astro, Angular, Jinja, Twig, Nunjucks, and Vento formatter.", "website": "https://dprint.dev/plugins/markup_fmt/", "npm": { @@ -463,7 +463,7 @@ }, { "name": "dprint_plugin_yaml", - "repo": "g-plane/pretty_yaml", + "github": "g-plane/pretty_yaml", "description": "YAML formatter.", "website": "https://dprint.dev/plugins/pretty_yaml/", "npm": { @@ -485,7 +485,7 @@ }, { "name": "dprint_plugin_graphql", - "repo": "g-plane/pretty_graphql", + "github": "g-plane/pretty_graphql", "description": "GraphQL formatter.", "website": "https://dprint.dev/plugins/pretty_graphql/", "npm": { @@ -506,7 +506,7 @@ }, { "name": "dprint-plugin-bibtex-tidy", - "repo": "apcamargo/dprint-plugin-bibtex-tidy", + "github": "apcamargo/dprint-plugin-bibtex-tidy", "description": "Tidy bibtex files.", "selected": false, "configKey": "bibtex-tidy", @@ -521,7 +521,7 @@ }, { "name": "apcamargo/typstyle", - "repo": "apcamargo/dprint-plugin-typstyle", + "github": "apcamargo/dprint-plugin-typstyle", "description": "A beautiful and reliable code formatter for Typst.", "selected": false, "configKey": "typstyle", @@ -537,7 +537,7 @@ }, { "name": "lax-css", - "repo": "bartlomieju/lax-css", + "github": "bartlomieju/lax-css", "description": "CSS, SCSS, and Less formatter that never reinterprets your styles.", "npm": { "name": "lax-css" @@ -561,7 +561,7 @@ }, { "name": "lax-markup", - "repo": "bartlomieju/lax-markup", + "github": "bartlomieju/lax-markup", "description": "HTML, XML, SVG, Vue, Svelte, and Astro formatter that preserves rendering-critical whitespace.", "npm": { "name": "lax-markup" @@ -590,7 +590,7 @@ }, { "name": "lax-sql", - "repo": "bartlomieju/lax-sql", + "github": "bartlomieju/lax-sql", "description": "Dialect-agnostic SQL formatter.", "npm": { "name": "lax-sql" @@ -612,7 +612,7 @@ }, { "name": "dprint-plugin-panache", - "repo": "jolars/dprint-plugin-panache", + "github": "jolars/dprint-plugin-panache", "description": "Quarto, Pandoc, R Markdown, and Markdown formatter.", "selected": false, "configKey": "panache", @@ -637,7 +637,7 @@ }, { "name": "dprint-plugin-swift", - "repo": "drluckyspin/dprint-plugin-swift", + "github": "drluckyspin/dprint-plugin-swift", "description": "Swift code formatter (SwiftFormat wrapper).", "selected": false, "configKey": "swiftformat", @@ -656,7 +656,7 @@ }, { "name": "dprint-plugin-prettier", - "repo": "dprint/dprint-plugin-prettier", + "github": "dprint/dprint-plugin-prettier", "description": "Prettier wrapper plugin (consider faster dedicated plugins for JS/TS, CSS, etc.).", "website": "https://dprint.dev/plugins/prettier/", "npm": { @@ -705,7 +705,7 @@ }, { "name": "dprint-plugin-roslyn", - "repo": "dprint/dprint-plugin-roslyn", + "github": "dprint/dprint-plugin-roslyn", "description": "C# and Visual Basic code formatter (Roslyn).", "website": "https://dprint.dev/plugins/roslyn/", "npm": { @@ -730,7 +730,7 @@ }, { "name": "dprint-plugin-exec", - "repo": "dprint/dprint-plugin-exec", + "github": "dprint/dprint-plugin-exec", "description": "Formats code using formatting CLIs installed on the host machine (rustfmt, clang-format, shfmt, etc.).", "website": "https://dprint.dev/plugins/exec/", "npm": { @@ -848,7 +848,7 @@ }, { "name": "dprint-plugin-clang-format", - "repo": "sargunv/dprint-clang-format", + "github": "sargunv/dprint-clang-format", "description": "C, C++, and Objective-C code formatter (clang-format).", "selected": false, "configKey": "clangFormat", @@ -877,7 +877,7 @@ }, { "name": "dprint-cmakefmt", - "repo": "sargunv/dprint-cmakefmt", + "github": "sargunv/dprint-cmakefmt", "description": "CMake code formatter (cmakefmt).", "selected": false, "configKey": "cmakefmt", @@ -897,7 +897,7 @@ }, { "name": "dprint-plugin-arity", - "repo": "jolars/dprint-plugin-arity", + "github": "jolars/dprint-plugin-arity", "description": "R code formatter (arity).", "selected": false, "configKey": "arity", @@ -915,7 +915,7 @@ }, { "name": "dprint-plugin-fatou", - "repo": "jolars/dprint-plugin-fatou", + "github": "jolars/dprint-plugin-fatou", "description": "Julia code formatter (fatou).", "selected": false, "configKey": "fatou", @@ -930,7 +930,7 @@ }, { "name": "dprint-plugin-badness", - "repo": "jolars/dprint-plugin-badness", + "github": "jolars/dprint-plugin-badness", "description": "LaTeX and BibTeX code formatter (badness).", "selected": false, "configKey": "badness", diff --git a/plugins.test.ts b/plugins.test.ts index db88573..93ff3cd 100644 --- a/plugins.test.ts +++ b/plugins.test.ts @@ -8,16 +8,16 @@ function resolveAsset(url: string) { } it("getPluginRepo", () => { - expect(getPluginRepo({ repo: "dprint/dprint-plugin-typescript" })).toEqual({ + expect(getPluginRepo({ github: "dprint/dprint-plugin-typescript" })).toEqual({ username: "dprint", repoName: "dprint-plugin-typescript", }); - expect(getPluginRepo({ repo: "g-plane/malva" })).toEqual({ username: "g-plane", repoName: "malva" }); + expect(getPluginRepo({ github: "g-plane/malva" })).toEqual({ username: "g-plane", repoName: "malva" }); }); it("info.json entries should say what repo they're published from", () => { for (const plugin of infoJson.latest) { - expect(plugin.repo, plugin.name).toMatch(/^[A-Za-z0-9-]+\/[A-Za-z0-9._-]+$/); + expect(plugin.github, plugin.name).toMatch(/^[A-Za-z0-9-]+\/[A-Za-z0-9._-]+$/); } }); diff --git a/plugins.ts b/plugins.ts index 57d3039..032876f 100644 --- a/plugins.ts +++ b/plugins.ts @@ -88,11 +88,11 @@ const reposByPluginName = buildReposByPluginName(); /** * The GitHub repo an info.json entry is published from. An entry's `name` is * the name the plugin reports about itself, which the cli matches against the - * plugins in a config file, so `repo` is what says where it's published from. + * plugins in a config file, so `github` is what says where it's published from. */ -export function getPluginRepo(plugin: { repo: string }) { - const slashIndex = plugin.repo.indexOf("/"); - return { username: plugin.repo.slice(0, slashIndex), repoName: plugin.repo.slice(slashIndex + 1) }; +export function getPluginRepo(plugin: { github: string }) { + const slashIndex = plugin.github.indexOf("/"); + return { username: plugin.github.slice(0, slashIndex), repoName: plugin.github.slice(slashIndex + 1) }; } const APPROVED_ASSET_REPOS = new Set([ @@ -253,7 +253,7 @@ async function userRepoTagPatternMapper( function buildNpmPackagesByRepo() { const result = new Map(); - for (const plugin of infoJson.latest as { repo: string; npm?: PluginNpmInfo }[]) { + for (const plugin of infoJson.latest as { github: string; npm?: PluginNpmInfo }[]) { if (plugin.npm == null) { continue; } diff --git a/readInfoFile.ts b/readInfoFile.ts index a83f270..01f9e7f 100644 --- a/readInfoFile.ts +++ b/readInfoFile.ts @@ -12,9 +12,9 @@ export interface PluginsData { export interface PluginData { // the name the plugin reports about itself name: string; - // the `username/repo` the plugin is published from. carried over from + // the GitHub `username/repo` the plugin is published from. carried over from // info.json, so it's absent from data cached before info.json declared it - repo?: string; + github?: string; url: string; version: string; downloadCount: { From 9fd3a4916b3fdc124498ba803b22bc30379ea460 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Sat, 3 Oct 2026 18:39:02 -0400 Subject: [PATCH 5/6] Revert "rename the info.json repo property to github" This reverts commit c575675904c07488702fb89111f204bd81877d35. --- homeView.test.ts | 4 +-- homeView.tsx | 4 +-- info.json | 68 ++++++++++++++++++++++++------------------------ plugins.test.ts | 6 ++--- plugins.ts | 10 +++---- readInfoFile.ts | 4 +-- 6 files changed, 48 insertions(+), 48 deletions(-) diff --git a/homeView.test.ts b/homeView.test.ts index e2da177..2b1507a 100644 --- a/homeView.test.ts +++ b/homeView.test.ts @@ -93,8 +93,8 @@ it("should keep the url searchable when a specifier replaced it", () => { it("should list plugins by repo without the dprint org", () => { const { html } = renderReferences([ - createPlugin({ name: "dprint-plugin-json", github: "dprint/dprint-plugin-json" }), - createPlugin({ name: "dprint_plugin_malva", github: "g-plane/malva" }), + createPlugin({ name: "dprint-plugin-json", repo: "dprint/dprint-plugin-json" }), + createPlugin({ name: "dprint_plugin_malva", repo: "g-plane/malva" }), // data cached before info.json declared the repo createPlugin({ name: "dprint-plugin-cached" }), ]); diff --git a/homeView.tsx b/homeView.tsx index 667bb5c..dfbb727 100644 --- a/homeView.tsx +++ b/homeView.tsx @@ -103,7 +103,7 @@ function renderPage(pluginsData: PluginsData) { function pluginSearchText(plugin: PluginData) { const parts: (string | undefined)[] = [ plugin.name, - plugin.github, + plugin.repo, // the url stays searchable even when the npm specifier is what's shown plugin.url, latestReference(plugin), @@ -216,7 +216,7 @@ function latestReference(plugin: PluginData) { // plugins are listed by the repo they're published from, with the dprint org // left off its own plugins function displayName(plugin: PluginData) { - return plugin.github?.replace(/^dprint\//, "") ?? plugin.name; + return plugin.repo?.replace(/^dprint\//, "") ?? plugin.name; } function renderPluginLinks(plugin: PluginData) { diff --git a/info.json b/info.json index b93f204..b42aa3a 100644 --- a/info.json +++ b/info.json @@ -4,7 +4,7 @@ "latest": [ { "name": "dprint-plugin-typescript", - "github": "dprint/dprint-plugin-typescript", + "repo": "dprint/dprint-plugin-typescript", "description": "TypeScript/JavaScript code formatter.", "website": "https://dprint.dev/plugins/typescript/", "npm": { @@ -35,7 +35,7 @@ }, { "name": "dprint-plugin-json", - "github": "dprint/dprint-plugin-json", + "repo": "dprint/dprint-plugin-json", "description": "JSON/JSONC code formatter.", "website": "https://dprint.dev/plugins/json/", "npm": { @@ -57,7 +57,7 @@ }, { "name": "dprint-plugin-markdown", - "github": "dprint/dprint-plugin-markdown", + "repo": "dprint/dprint-plugin-markdown", "description": "Markdown code formatter.", "website": "https://dprint.dev/plugins/markdown/", "npm": { @@ -82,7 +82,7 @@ }, { "name": "dprint-plugin-toml", - "github": "dprint/dprint-plugin-toml", + "repo": "dprint/dprint-plugin-toml", "description": "TOML code formatter.", "website": "https://dprint.dev/plugins/toml/", "npm": { @@ -101,7 +101,7 @@ }, { "name": "dprint-plugin-dockerfile", - "github": "dprint/dprint-plugin-dockerfile", + "repo": "dprint/dprint-plugin-dockerfile", "description": "Dockerfile code formatter.", "website": "https://dprint.dev/plugins/dockerfile/", "npm": { @@ -124,7 +124,7 @@ }, { "name": "dprint-plugin-biome", - "github": "dprint/dprint-plugin-biome", + "repo": "dprint/dprint-plugin-biome", "description": "Biome (JS/TS/JSON) wrapper plugin.", "website": "https://dprint.dev/plugins/biome/", "npm": { @@ -157,7 +157,7 @@ }, { "name": "dprint-plugin-oxc", - "github": "dprint/dprint-plugin-oxc", + "repo": "dprint/dprint-plugin-oxc", "description": "Oxc (JS/TS/JSON/CSS/SCSS/Less/GraphQL/YAML/TOML) wrapper plugin.", "website": "https://dprint.dev/plugins/oxc/", "npm": { @@ -207,7 +207,7 @@ }, { "name": "dprint-plugin-mago", - "github": "dprint/dprint-plugin-mago", + "repo": "dprint/dprint-plugin-mago", "description": "Mago (PHP) wrapper plugin.", "website": "https://dprint.dev/plugins/mago/", "npm": { @@ -227,7 +227,7 @@ }, { "name": "dprint-plugin-ruff", - "github": "dprint/dprint-plugin-ruff", + "repo": "dprint/dprint-plugin-ruff", "description": "Ruff (Python) wrapper plugin.", "website": "https://dprint.dev/plugins/ruff/", "npm": { @@ -249,7 +249,7 @@ }, { "name": "dprint-plugin-jupyter", - "github": "dprint/dprint-plugin-jupyter", + "repo": "dprint/dprint-plugin-jupyter", "description": "Jupyter notebook code block formatter.", "website": "https://dprint.dev/plugins/jupyter/", "npm": { @@ -270,7 +270,7 @@ }, { "name": "dprint-plugin-gofumpt", - "github": "jakebailey/dprint-plugin-gofumpt", + "repo": "jakebailey/dprint-plugin-gofumpt", "description": "Gofumpt (Go) wrapper plugin.", "website": "https://dprint.dev/plugins/gofumpt/", "npm": { @@ -291,7 +291,7 @@ }, { "name": "dprint-plugin-kdl", - "github": "kachick/dprint-plugin-kdl", + "repo": "kachick/dprint-plugin-kdl", "description": "KDL crate wrapper plugin.", "npm": { "name": "@kachick/dprint-plugin-kdl" @@ -308,7 +308,7 @@ }, { "name": "dprint-plugin-nix", - "github": "kachick/dprint-plugin-nix", + "repo": "kachick/dprint-plugin-nix", "description": "Nixfmt-rs (Nix) wrapper plugin.", "npm": { "name": "@kachick/dprint-plugin-nix" @@ -326,7 +326,7 @@ }, { "name": "dprint-plugin-sh", - "github": "kachick/dprint-plugin-sh", + "repo": "kachick/dprint-plugin-sh", "description": "Shuck-formatter (shell script) wrapper plugin.", "npm": { "name": "@kachick/dprint-plugin-sh" @@ -368,7 +368,7 @@ }, { "name": "kachick/typstyle", - "github": "kachick/dprint-plugin-typstyle", + "repo": "kachick/dprint-plugin-typstyle", "description": "Typstyle (Typst) wrapper plugin.", "npm": { "name": "@kachick/dprint-plugin-typstyle" @@ -386,7 +386,7 @@ }, { "name": "dprint_plugin_malva", - "github": "g-plane/malva", + "repo": "g-plane/malva", "description": "CSS, SCSS, Sass and Less formatter.", "website": "https://dprint.dev/plugins/malva/", "npm": { @@ -413,7 +413,7 @@ }, { "name": "dprint_plugin_markup", - "github": "g-plane/markup_fmt", + "repo": "g-plane/markup_fmt", "description": "HTML, Vue, Svelte, Astro, Angular, Jinja, Twig, Nunjucks, and Vento formatter.", "website": "https://dprint.dev/plugins/markup_fmt/", "npm": { @@ -463,7 +463,7 @@ }, { "name": "dprint_plugin_yaml", - "github": "g-plane/pretty_yaml", + "repo": "g-plane/pretty_yaml", "description": "YAML formatter.", "website": "https://dprint.dev/plugins/pretty_yaml/", "npm": { @@ -485,7 +485,7 @@ }, { "name": "dprint_plugin_graphql", - "github": "g-plane/pretty_graphql", + "repo": "g-plane/pretty_graphql", "description": "GraphQL formatter.", "website": "https://dprint.dev/plugins/pretty_graphql/", "npm": { @@ -506,7 +506,7 @@ }, { "name": "dprint-plugin-bibtex-tidy", - "github": "apcamargo/dprint-plugin-bibtex-tidy", + "repo": "apcamargo/dprint-plugin-bibtex-tidy", "description": "Tidy bibtex files.", "selected": false, "configKey": "bibtex-tidy", @@ -521,7 +521,7 @@ }, { "name": "apcamargo/typstyle", - "github": "apcamargo/dprint-plugin-typstyle", + "repo": "apcamargo/dprint-plugin-typstyle", "description": "A beautiful and reliable code formatter for Typst.", "selected": false, "configKey": "typstyle", @@ -537,7 +537,7 @@ }, { "name": "lax-css", - "github": "bartlomieju/lax-css", + "repo": "bartlomieju/lax-css", "description": "CSS, SCSS, and Less formatter that never reinterprets your styles.", "npm": { "name": "lax-css" @@ -561,7 +561,7 @@ }, { "name": "lax-markup", - "github": "bartlomieju/lax-markup", + "repo": "bartlomieju/lax-markup", "description": "HTML, XML, SVG, Vue, Svelte, and Astro formatter that preserves rendering-critical whitespace.", "npm": { "name": "lax-markup" @@ -590,7 +590,7 @@ }, { "name": "lax-sql", - "github": "bartlomieju/lax-sql", + "repo": "bartlomieju/lax-sql", "description": "Dialect-agnostic SQL formatter.", "npm": { "name": "lax-sql" @@ -612,7 +612,7 @@ }, { "name": "dprint-plugin-panache", - "github": "jolars/dprint-plugin-panache", + "repo": "jolars/dprint-plugin-panache", "description": "Quarto, Pandoc, R Markdown, and Markdown formatter.", "selected": false, "configKey": "panache", @@ -637,7 +637,7 @@ }, { "name": "dprint-plugin-swift", - "github": "drluckyspin/dprint-plugin-swift", + "repo": "drluckyspin/dprint-plugin-swift", "description": "Swift code formatter (SwiftFormat wrapper).", "selected": false, "configKey": "swiftformat", @@ -656,7 +656,7 @@ }, { "name": "dprint-plugin-prettier", - "github": "dprint/dprint-plugin-prettier", + "repo": "dprint/dprint-plugin-prettier", "description": "Prettier wrapper plugin (consider faster dedicated plugins for JS/TS, CSS, etc.).", "website": "https://dprint.dev/plugins/prettier/", "npm": { @@ -705,7 +705,7 @@ }, { "name": "dprint-plugin-roslyn", - "github": "dprint/dprint-plugin-roslyn", + "repo": "dprint/dprint-plugin-roslyn", "description": "C# and Visual Basic code formatter (Roslyn).", "website": "https://dprint.dev/plugins/roslyn/", "npm": { @@ -730,7 +730,7 @@ }, { "name": "dprint-plugin-exec", - "github": "dprint/dprint-plugin-exec", + "repo": "dprint/dprint-plugin-exec", "description": "Formats code using formatting CLIs installed on the host machine (rustfmt, clang-format, shfmt, etc.).", "website": "https://dprint.dev/plugins/exec/", "npm": { @@ -848,7 +848,7 @@ }, { "name": "dprint-plugin-clang-format", - "github": "sargunv/dprint-clang-format", + "repo": "sargunv/dprint-clang-format", "description": "C, C++, and Objective-C code formatter (clang-format).", "selected": false, "configKey": "clangFormat", @@ -877,7 +877,7 @@ }, { "name": "dprint-cmakefmt", - "github": "sargunv/dprint-cmakefmt", + "repo": "sargunv/dprint-cmakefmt", "description": "CMake code formatter (cmakefmt).", "selected": false, "configKey": "cmakefmt", @@ -897,7 +897,7 @@ }, { "name": "dprint-plugin-arity", - "github": "jolars/dprint-plugin-arity", + "repo": "jolars/dprint-plugin-arity", "description": "R code formatter (arity).", "selected": false, "configKey": "arity", @@ -915,7 +915,7 @@ }, { "name": "dprint-plugin-fatou", - "github": "jolars/dprint-plugin-fatou", + "repo": "jolars/dprint-plugin-fatou", "description": "Julia code formatter (fatou).", "selected": false, "configKey": "fatou", @@ -930,7 +930,7 @@ }, { "name": "dprint-plugin-badness", - "github": "jolars/dprint-plugin-badness", + "repo": "jolars/dprint-plugin-badness", "description": "LaTeX and BibTeX code formatter (badness).", "selected": false, "configKey": "badness", diff --git a/plugins.test.ts b/plugins.test.ts index 93ff3cd..db88573 100644 --- a/plugins.test.ts +++ b/plugins.test.ts @@ -8,16 +8,16 @@ function resolveAsset(url: string) { } it("getPluginRepo", () => { - expect(getPluginRepo({ github: "dprint/dprint-plugin-typescript" })).toEqual({ + expect(getPluginRepo({ repo: "dprint/dprint-plugin-typescript" })).toEqual({ username: "dprint", repoName: "dprint-plugin-typescript", }); - expect(getPluginRepo({ github: "g-plane/malva" })).toEqual({ username: "g-plane", repoName: "malva" }); + expect(getPluginRepo({ repo: "g-plane/malva" })).toEqual({ username: "g-plane", repoName: "malva" }); }); it("info.json entries should say what repo they're published from", () => { for (const plugin of infoJson.latest) { - expect(plugin.github, plugin.name).toMatch(/^[A-Za-z0-9-]+\/[A-Za-z0-9._-]+$/); + expect(plugin.repo, plugin.name).toMatch(/^[A-Za-z0-9-]+\/[A-Za-z0-9._-]+$/); } }); diff --git a/plugins.ts b/plugins.ts index 032876f..57d3039 100644 --- a/plugins.ts +++ b/plugins.ts @@ -88,11 +88,11 @@ const reposByPluginName = buildReposByPluginName(); /** * The GitHub repo an info.json entry is published from. An entry's `name` is * the name the plugin reports about itself, which the cli matches against the - * plugins in a config file, so `github` is what says where it's published from. + * plugins in a config file, so `repo` is what says where it's published from. */ -export function getPluginRepo(plugin: { github: string }) { - const slashIndex = plugin.github.indexOf("/"); - return { username: plugin.github.slice(0, slashIndex), repoName: plugin.github.slice(slashIndex + 1) }; +export function getPluginRepo(plugin: { repo: string }) { + const slashIndex = plugin.repo.indexOf("/"); + return { username: plugin.repo.slice(0, slashIndex), repoName: plugin.repo.slice(slashIndex + 1) }; } const APPROVED_ASSET_REPOS = new Set([ @@ -253,7 +253,7 @@ async function userRepoTagPatternMapper( function buildNpmPackagesByRepo() { const result = new Map(); - for (const plugin of infoJson.latest as { github: string; npm?: PluginNpmInfo }[]) { + for (const plugin of infoJson.latest as { repo: string; npm?: PluginNpmInfo }[]) { if (plugin.npm == null) { continue; } diff --git a/readInfoFile.ts b/readInfoFile.ts index 01f9e7f..a83f270 100644 --- a/readInfoFile.ts +++ b/readInfoFile.ts @@ -12,9 +12,9 @@ export interface PluginsData { export interface PluginData { // the name the plugin reports about itself name: string; - // the GitHub `username/repo` the plugin is published from. carried over from + // the `username/repo` the plugin is published from. carried over from // info.json, so it's absent from data cached before info.json declared it - github?: string; + repo?: string; url: string; version: string; downloadCount: { From 8a1b1145014711fc8ddc6cdc7f099415b42b24c0 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Sat, 3 Oct 2026 18:42:11 -0400 Subject: [PATCH 6/6] show community plugins without the dprint-plugin- prefix on the homepage --- homeView.test.ts | 5 +++-- homeView.tsx | 12 +++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/homeView.test.ts b/homeView.test.ts index 2b1507a..fc99b10 100644 --- a/homeView.test.ts +++ b/homeView.test.ts @@ -91,13 +91,14 @@ it("should keep the url searchable when a specifier replaced it", () => { expect(search).toContain("npm:@dprint/json@1.2.3"); }); -it("should list plugins by repo without the dprint org", () => { +it("should list plugins by repo without the dprint org or plugin prefix", () => { const { html } = renderReferences([ createPlugin({ name: "dprint-plugin-json", repo: "dprint/dprint-plugin-json" }), createPlugin({ name: "dprint_plugin_malva", repo: "g-plane/malva" }), + createPlugin({ name: "dprint-plugin-kdl", repo: "kachick/dprint-plugin-kdl" }), // data cached before info.json declared the repo createPlugin({ name: "dprint-plugin-cached" }), ]); const names = [...html.matchAll(/([^<]*)<\/span>/g)].map((m) => m[1]); - expect(names).toEqual(["dprint-plugin-json", "g-plane/malva", "dprint-plugin-cached"]); + expect(names).toEqual(["dprint-plugin-json", "g-plane/malva", "kachick/kdl", "dprint-plugin-cached"]); }); diff --git a/homeView.tsx b/homeView.tsx index dfbb727..dcee7bb 100644 --- a/homeView.tsx +++ b/homeView.tsx @@ -213,10 +213,16 @@ function latestReference(plugin: PluginData) { // the repo and docs links shown beneath a plugin's name. both are optional: the // repo url is derived during the build and docs only exist for plugins with a // dprint.dev page. -// plugins are listed by the repo they're published from, with the dprint org -// left off its own plugins +// plugins are listed by the repo they're published from: the dprint org is +// left off its own plugins and the `dprint-plugin-` prefix off everyone else's +// (ex. `dprint-plugin-json` and `kachick/kdl`) function displayName(plugin: PluginData) { - return plugin.repo?.replace(/^dprint\//, "") ?? plugin.name; + if (plugin.repo == null) { + return plugin.name; + } + return plugin.repo.startsWith("dprint/") + ? plugin.repo.slice("dprint/".length) + : plugin.repo.replace("/dprint-plugin-", "/"); } function renderPluginLinks(plugin: PluginData) {