Skip to content

Commit

Permalink
adds UA to other fetch calls
Browse files Browse the repository at this point in the history
  • Loading branch information
ctate committed Jan 26, 2025
1 parent fa7b5ae commit 9c291a4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions packages/cli/src/utils/registry/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})
Expand Down
6 changes: 5 additions & 1 deletion packages/shadcn/src/utils/create-project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`)
}
Expand Down

0 comments on commit 9c291a4

Please sign in to comment.