From 8456c3bf60151076db7da9723216a639ebf5f406 Mon Sep 17 00:00:00 2001 From: futurehua Date: Sat, 18 Jul 2026 12:32:54 +0800 Subject: [PATCH] fix(docs): use local TypeScript compiler in package manager tabs Signed-off-by: futurehua --- apps/docs/source.config.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/docs/source.config.ts b/apps/docs/source.config.ts index eb514ccfa6..d006716576 100644 --- a/apps/docs/source.config.ts +++ b/apps/docs/source.config.ts @@ -14,6 +14,12 @@ function convertLine(cmd: string, pm: "npm" | "pnpm" | "yarn" | "bun"): string { return cmd .split("\n") .map((line) => { + // `pnpm dlx` and `yarn dlx` always download a package, but `tsc` is a + // binary from the locally installed `typescript` package. + if ((pm === "pnpm" || pm === "yarn") && /^npx tsc\b/.test(line)) { + return line.replace(/^npx/, pm); + } + // npm-to-yarn strips @latest from `npm create X@latest` and handles the // npm-specific `--` separator inconsistently across PMs. Handle this // pattern directly instead of fighting the library's output.