fix: do not install baseStyle when adding registry:theme (#8900)

This commit is contained in:
shadcn
2025-11-27 21:13:56 +04:00
committed by GitHub
parent 62218c1c0c
commit d0fb73ac0e
2 changed files with 14 additions and 4 deletions

View File

@@ -0,0 +1,5 @@
---
"shadcn": patch
---
do not install base style when adding themes

View File

@@ -4,6 +4,7 @@ import { preFlightAdd } from "@/src/preflights/preflight-add"
import { getRegistryItems, getShadcnRegistryIndex } from "@/src/registry/api"
import { DEPRECATED_COMPONENTS } from "@/src/registry/constants"
import { clearRegistryContext } from "@/src/registry/context"
import { registryItemTypeSchema } from "@/src/registry/schema"
import { isUniversalRegistryItem } from "@/src/registry/utils"
import { addComponents } from "@/src/utils/add-components"
import { createProject } from "@/src/utils/create-project"
@@ -88,11 +89,12 @@ export const add = new Command()
hasNewRegistries = newRegistries.length > 0
}
let itemType: z.infer<typeof registryItemTypeSchema> | undefined
if (components.length > 0) {
const [registryItem] = await getRegistryItems([components[0]], {
config: initialConfig,
})
const itemType = registryItem?.type
itemType = registryItem?.type
if (isUniversalRegistryItem(registryItem)) {
await addComponents(components, initialConfig, options)
@@ -172,7 +174,7 @@ export const add = new Command()
isNewProject: false,
srcDir: options.srcDir,
cssVariables: options.cssVariables,
baseStyle: true,
baseStyle: itemType !== "registry:theme",
components: options.components,
})
initHasRun = true
@@ -207,7 +209,7 @@ export const add = new Command()
isNewProject: true,
srcDir: options.srcDir,
cssVariables: options.cssVariables,
baseStyle: true,
baseStyle: itemType !== "registry:theme",
components: options.components,
})
initHasRun = true
@@ -234,7 +236,10 @@ export const add = new Command()
config = updatedConfig
if (!initHasRun) {
await addComponents(options.components, config, options)
await addComponents(options.components, config, {
...options,
baseStyle: itemType !== "registry:theme",
})
}
// If we're adding a single component and it's from the v0 registry,