feat: support root option
This commit is contained in:
parent
09feb74ebe
commit
a528711b99
|
|
@ -116,6 +116,12 @@ export async function promptForConfig(
|
|||
{ title: 'Nuxt', value: 'nuxt' },
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'text',
|
||||
name: 'root',
|
||||
message: `Where is your ${highlight('source code')} folder located`,
|
||||
initial: (prev, values) => defaultConfig?.root ?? values.framework === 'nuxt' ? '.' : 'src',
|
||||
},
|
||||
{
|
||||
type: 'select',
|
||||
name: 'style',
|
||||
|
|
@ -174,6 +180,7 @@ export async function promptForConfig(
|
|||
|
||||
const config = rawConfigSchema.parse({
|
||||
// $schema: 'https://ui.shadcn.com/schema.json',
|
||||
root: options.root,
|
||||
style: options.style,
|
||||
typescript: options.typescript,
|
||||
framework: options.framework,
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ const explorer = cosmiconfig('components', {
|
|||
export const rawConfigSchema = z
|
||||
.object({
|
||||
$schema: z.string().optional(),
|
||||
root: z.string(),
|
||||
style: z.string(),
|
||||
typescript: z.boolean().default(false),
|
||||
tailwind: z.object({
|
||||
|
|
|
|||
|
|
@ -129,6 +129,7 @@ export function getItemTargetPath(
|
|||
return null
|
||||
|
||||
return path.join(
|
||||
config.typescript ? '' : config.root,
|
||||
config.resolvedPaths[parent as keyof typeof config.resolvedPaths],
|
||||
type,
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user