diff --git a/packages/shadcn/src/commands/add.ts b/packages/shadcn/src/commands/add.ts index c6b202e3b2..9812e4eaec 100644 --- a/packages/shadcn/src/commands/add.ts +++ b/packages/shadcn/src/commands/add.ts @@ -16,7 +16,11 @@ import { getProjectInfo } from "@/src/utils/get-project-info" import { handleError } from "@/src/utils/handle-error" import { highlighter } from "@/src/utils/highlighter" import { logger } from "@/src/utils/logger" -import { promptForPreset, resolveRegistryBaseConfig } from "@/src/utils/presets" +import { + promptForBase, + promptForPreset, + resolveRegistryBaseConfig, +} from "@/src/utils/presets" import { ensureRegistriesInConfig } from "@/src/utils/registries" import { updateAppIndex } from "@/src/utils/update-app-index" import { Command } from "commander" @@ -163,9 +167,11 @@ export const add = new Command() projectInfo?.framework.name ) - // Prompt for preset. + // Prompt for base and preset. + const base = await promptForBase() const { url: initUrl } = await promptForPreset({ rtl: false, + base, template: inferredTemplate, }) @@ -208,9 +214,11 @@ export const add = new Command() options.cwd = path.resolve(options.cwd, "apps/web") config = await getConfig(options.cwd) } else { - // Prompt for preset. + // Prompt for base and preset. + const selectedBase = await promptForBase() const { url: initUrl } = await promptForPreset({ rtl: false, + base: selectedBase, template, }) const { registryBaseConfig, installStyleIndex } = diff --git a/packages/shadcn/src/commands/info.ts b/packages/shadcn/src/commands/info.ts index 2e47cc1723..8e4324e990 100644 --- a/packages/shadcn/src/commands/info.ts +++ b/packages/shadcn/src/commands/info.ts @@ -1,6 +1,6 @@ import { existsSync } from "fs" import path from "path" -import { getConfig } from "@/src/utils/get-config" +import { getBase, getConfig } from "@/src/utils/get-config" import { formatMonorepoMessage, getMonorepoTargets, @@ -76,10 +76,6 @@ export const info = new Command() } }) -function getBase(style: string | undefined) { - return style?.startsWith("base-") ? "base" : "radix" -} - function getRegistries( registries: Record | undefined ) { diff --git a/packages/shadcn/src/commands/init.ts b/packages/shadcn/src/commands/init.ts index b82e170883..c53c645787 100644 --- a/packages/shadcn/src/commands/init.ts +++ b/packages/shadcn/src/commands/init.ts @@ -4,6 +4,7 @@ import { preFlightInit } from "@/src/preflights/preflight-init" import { getRegistryBaseColors, getRegistryStyles } from "@/src/registry/api" import { BUILTIN_REGISTRIES } from "@/src/registry/constants" import { clearRegistryContext } from "@/src/registry/context" +import { registryConfigSchema } from "@/src/registry/schema" import { isUrl } from "@/src/registry/utils" import { rawConfigSchema } from "@/src/schema" import { getTemplateForFramework, templates } from "@/src/templates/index" @@ -43,6 +44,7 @@ import { logger } from "@/src/utils/logger" import { decodePreset, isPresetCode } from "@/src/utils/preset" import { DEFAULT_PRESETS, + promptForBase, promptForPreset, resolveInitUrl, resolveRegistryBaseConfig, @@ -84,7 +86,7 @@ export const init = new Command() "-t, --template