mirror of
https://github.com/shadcn-ui/ui.git
synced 2026-02-09 02:49:29 +08:00
fix: do not install baseStyle when adding registry:theme (#8900)
This commit is contained in:
5
.changeset/cute-hornets-tap.md
Normal file
5
.changeset/cute-hornets-tap.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"shadcn": patch
|
||||
---
|
||||
|
||||
do not install base style when adding themes
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user