diff --git a/.changeset/cute-hornets-tap.md b/.changeset/cute-hornets-tap.md new file mode 100644 index 000000000..499d67fd0 --- /dev/null +++ b/.changeset/cute-hornets-tap.md @@ -0,0 +1,5 @@ +--- +"shadcn": patch +--- + +do not install base style when adding themes diff --git a/packages/shadcn/src/commands/add.ts b/packages/shadcn/src/commands/add.ts index 27a8c58d0..0c9850897 100644 --- a/packages/shadcn/src/commands/add.ts +++ b/packages/shadcn/src/commands/add.ts @@ -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 | 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,