diff --git a/packages/shadcn/src/commands/info.ts b/packages/shadcn/src/commands/info.ts index 8e4324e990..f9993d9728 100644 --- a/packages/shadcn/src/commands/info.ts +++ b/packages/shadcn/src/commands/info.ts @@ -214,7 +214,7 @@ function printInfo(data: ReturnType) { // Registries. if (Object.keys(data.config.registries).length > 0) { logger.break() - logger.log(highlighter.info("Registries")) + logger.log("registries:") printEntries(data.config.registries) } } else { diff --git a/packages/shadcn/src/commands/init.ts b/packages/shadcn/src/commands/init.ts index c53c645787..aaddc8b995 100644 --- a/packages/shadcn/src/commands/init.ts +++ b/packages/shadcn/src/commands/init.ts @@ -134,7 +134,8 @@ export const init = new Command() if (options.defaults) { options.template = options.template || "next" - // Base resolution happens below — just mark presetBase as undefined. + options.base = options.base || "base" + options.reinstall = options.reinstall ?? false } if (options.template && !(options.template in templates)) { @@ -373,13 +374,19 @@ export const init = new Command() : "") if (!resolvedBase) { - const base = await promptForBase() - resolvedBase = base - options.base = base + if (components.length > 0) { + // When initializing from a registry item, default to radix. + // The registry:base config will override this. + resolvedBase = "radix" + } else { + const base = await promptForBase() + resolvedBase = base + options.base = base + } } // Build the --defaults URL now that base is resolved. - if (options.defaults && components.length === 0) { + if (options.defaults && !components.some(isUrl)) { const initUrl = resolveInitUrl( { ...DEFAULT_PRESETS.nova, diff --git a/packages/shadcn/src/utils/presets.ts b/packages/shadcn/src/utils/presets.ts index e46ac6d788..fc239cc5ff 100644 --- a/packages/shadcn/src/utils/presets.ts +++ b/packages/shadcn/src/utils/presets.ts @@ -55,7 +55,7 @@ export const DEFAULT_PRESETS = { }, lyra: { title: "Lyra", - description: "Tabler / JetBrains Mono", + description: "Hugeicons / JetBrains Mono", style: "lyra", baseColor: "neutral", theme: "neutral", diff --git a/packages/tests/src/tests/init.test.ts b/packages/tests/src/tests/init.test.ts index 7cb8b60d62..0bb25b8554 100644 --- a/packages/tests/src/tests/init.test.ts +++ b/packages/tests/src/tests/init.test.ts @@ -549,7 +549,9 @@ describe("shadcn init - next-monorepo", () => { "-t", "next-monorepo", "--preset", - "radix-nova", + "nova", + "--base", + "radix", ], { timeout: 300000, debug: true } ) diff --git a/packages/tests/src/tests/registries.test.ts b/packages/tests/src/tests/registries.test.ts index 689a7a9a00..4b64c0086c 100644 --- a/packages/tests/src/tests/registries.test.ts +++ b/packages/tests/src/tests/registries.test.ts @@ -1042,8 +1042,6 @@ describe("registries", () => { "--yes", ]) - expect(output.stderr).toContain("Updating CSS variables in app/globals.css") - const globalCssContent = await fs.readFile( path.join(fixturePath, "app/globals.css"), "utf-8" @@ -1204,7 +1202,12 @@ describe("registries:init", () => { "@one": "http://localhost:4444/r/{name}", }) - await npxShadcn(fixturePath, ["init", "--force", "@one/style"]) + await npxShadcn(fixturePath, [ + "init", + "--force", + "--no-reinstall", + "@one/style", + ]) const componentsJson = await fs.readJson( path.join(fixturePath, "components.json") @@ -1272,7 +1275,12 @@ describe("registries:init", () => { process.env.BEARER_TOKEN = "EXAMPLE_BEARER_TOKEN" - await npxShadcn(fixturePath, ["init", "--force", "@two/style"]) + await npxShadcn(fixturePath, [ + "init", + "--force", + "--no-reinstall", + "@two/style", + ]) const componentsJson = await fs.readJson( path.join(fixturePath, "components.json")