diff --git a/packages/cli/src/utils/registry/index.ts b/packages/cli/src/utils/registry/index.ts index 29395e2b5c2..bd26fc106cf 100644 --- a/packages/cli/src/utils/registry/index.ts +++ b/packages/cli/src/utils/registry/index.ts @@ -142,6 +142,9 @@ async function fetchRegistry(paths: string[]) { paths.map(async (path) => { const response = await fetch(`${baseUrl}/registry/${path}`, { agent, + headers: { + "User-Agent": "shadcn", + }, }) return await response.json() }) diff --git a/packages/shadcn/src/registry/api.ts b/packages/shadcn/src/registry/api.ts index 4ad54d218dc..ee4adf578c4 100644 --- a/packages/shadcn/src/registry/api.ts +++ b/packages/shadcn/src/registry/api.ts @@ -176,7 +176,12 @@ export async function fetchRegistry(paths: string[]) { const results = await Promise.all( paths.map(async (path) => { const url = getRegistryUrl(path) - const response = await fetch(url, { agent }) + const response = await fetch(url, { + agent, + headers: { + "User-Agent": "shadcn", + }, + }) if (!response.ok) { const errorMessages: { [key: number]: string } = { diff --git a/packages/shadcn/src/utils/create-project.ts b/packages/shadcn/src/utils/create-project.ts index b6d27da4f72..7bd6fc1c15b 100644 --- a/packages/shadcn/src/utils/create-project.ts +++ b/packages/shadcn/src/utils/create-project.ts @@ -196,7 +196,11 @@ async function createMonorepoProject( // Get the template. const templatePath = path.join(os.tmpdir(), `shadcn-template-${Date.now()}`) await fs.ensureDir(templatePath) - const response = await fetch(MONOREPO_TEMPLATE_URL) + const response = await fetch(MONOREPO_TEMPLATE_URL, { + headers: { + "User-Agent": "shadcn", + }, + }) if (!response.ok) { throw new Error(`Failed to download template: ${response.statusText}`) }