|
1 | 1 | /* eslint-disable prefer-const */ |
| 2 | +import type { registryItemTypeSchema } from '@/src/registry/schema' |
2 | 3 | import { Command } from 'commander' |
3 | 4 | import path from 'pathe' |
4 | 5 | import prompts from 'prompts' |
@@ -89,11 +90,12 @@ export const add = new Command() |
89 | 90 | hasNewRegistries = newRegistries.length > 0 |
90 | 91 | } |
91 | 92 |
|
| 93 | + let itemType: z.infer<typeof registryItemTypeSchema> | undefined |
92 | 94 | if (components.length > 0) { |
93 | 95 | const [registryItem] = await getRegistryItems([components[0]], { |
94 | 96 | config: initialConfig, |
95 | 97 | }) |
96 | | - const itemType = registryItem?.type |
| 98 | + itemType = registryItem?.type |
97 | 99 |
|
98 | 100 | if (isUniversalRegistryItem(registryItem)) { |
99 | 101 | await addComponents(components, initialConfig, options) |
@@ -173,7 +175,7 @@ export const add = new Command() |
173 | 175 | isNewProject: false, |
174 | 176 | srcDir: options.srcDir, |
175 | 177 | cssVariables: options.cssVariables, |
176 | | - baseStyle: true, |
| 178 | + baseStyle: itemType !== 'registry:theme', |
177 | 179 | components: options.components, |
178 | 180 | }) |
179 | 181 | } |
@@ -234,7 +236,10 @@ export const add = new Command() |
234 | 236 | config = updatedConfig |
235 | 237 |
|
236 | 238 | if (!initHasRun) { |
237 | | - await addComponents(options.components, config, options) |
| 239 | + await addComponents(options.components, config, { |
| 240 | + ...options, |
| 241 | + baseStyle: itemType !== 'registry:theme', |
| 242 | + }) |
238 | 243 | } |
239 | 244 |
|
240 | 245 | // If we're adding a single component and it's from the v0 registry, |
|
0 commit comments