From 388012e7fe60d973876bcb30c3d922f5647f5cbc Mon Sep 17 00:00:00 2001 From: Gianpiero Puleo Date: Sun, 14 Jun 2026 01:33:13 +0900 Subject: [PATCH] fix: respect components.json alias for install path shadcn's resolveAliasTarget only activates when the target starts with `@aliasKey/`. Plain `components/ai-elements/...` bypasses alias resolution and writes to `/components/ai-elements/` regardless of how `components.json` is configured. Prefixing targets with `@components/` lets shadcn resolve the destination through the `components` alias, so projects that remap it (e.g. to `@/lib/components`) get files installed in the right place. --- apps/docs/app/api/registry/[component]/route.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/docs/app/api/registry/[component]/route.ts b/apps/docs/app/api/registry/[component]/route.ts index 713a03bf..0d0ef149 100644 --- a/apps/docs/app/api/registry/[component]/route.ts +++ b/apps/docs/app/api/registry/[component]/route.ts @@ -180,7 +180,7 @@ const componentItems: RegistryItem[] = tsxFiles.map((componentFile) => { files: [ { path: `registry/default/ai-elements/${componentFile.name}`, - target: `components/ai-elements/${componentFile.name}.tsx`, + target: `@components/ai-elements/${componentFile.name}.tsx`, type: "registry:component", }, ], @@ -203,7 +203,7 @@ const exampleItems: RegistryItem[] = exampleTsxFiles.map((exampleFile) => { files: [ { path: `registry/default/examples/${exampleFile.name}`, - target: `components/ai-elements/examples/${exampleFile.name}.tsx`, + target: `@components/ai-elements/examples/${exampleFile.name}.tsx`, type: "registry:block", }, ], @@ -270,7 +270,7 @@ export const GET = async (request: NextRequest, { params }: RequestProps) => { allFiles.push({ content: file.content, path: file.path, - target: `components/ai-elements/${componentFile.name}`, + target: `@components/ai-elements/${componentFile.name}`, type: file.type as RegistryItem["type"], }); @@ -463,7 +463,7 @@ export const GET = async (request: NextRequest, { params }: RequestProps) => { { content: file.content, path: file.path, - target: `components/ai-elements/${item.name}.tsx`, + target: `@components/ai-elements/${item.name}.tsx`, type: file.type as Exclude< RegistryItem["type"], "registry:base" | "registry:font"