From 7cb3b13a33c5bf3b3cd6bc51d75720fe1828261d Mon Sep 17 00:00:00 2001 From: shadcn Date: Mon, 6 Apr 2026 23:32:48 +0400 Subject: [PATCH] fix --- packages/shadcn/src/commands/apply.ts | 37 ++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/packages/shadcn/src/commands/apply.ts b/packages/shadcn/src/commands/apply.ts index 1817fc851..32820343f 100644 --- a/packages/shadcn/src/commands/apply.ts +++ b/packages/shadcn/src/commands/apply.ts @@ -1,5 +1,5 @@ import path from "path" -import { confirmBaseSwitch, runInit } from "@/src/commands/init" +import { runInit } from "@/src/commands/init" import { preFlightApply } from "@/src/preflights/preflight-apply" import { decodePreset, isPresetCode } from "@/src/preset/preset" import { @@ -323,3 +323,38 @@ function getInitCommand(preset?: string) { return `shadcn init --preset ${quoteShellArg(preset)}` } + +async function confirmBaseSwitch( + existingStyle: string, + resolvedBase: "radix" | "base" +) { + const oldBase = existingStyle.startsWith("base-") ? "base" : "radix" + if (resolvedBase === oldBase) return resolvedBase + + logger.warn( + ` You are switching from ${highlighter.info( + oldBase + )} to ${highlighter.info(resolvedBase)}.` + ) + logger.warn( + ` Components outside the ${highlighter.info( + "ui" + )} directory that depend on ${highlighter.info( + oldBase + )} primitives may need manual updates.` + ) + logger.break() + + const { proceed } = await prompts({ + type: "confirm", + name: "proceed", + message: "Would you like to continue?", + initial: true, + }) + + if (!proceed) { + process.exit(1) + } + + return resolvedBase +}