diff --git a/.changeset/little-turtles-taste.md b/.changeset/little-turtles-taste.md new file mode 100644 index 0000000000..cee5665203 --- /dev/null +++ b/.changeset/little-turtles-taste.md @@ -0,0 +1,5 @@ +--- +"shadcn": major +--- + +move schema to shadcn/schema diff --git a/apps/v4/app/(view)/view/[name]/page.tsx b/apps/v4/app/(view)/view/[name]/page.tsx index 61ebbf2920..b96fc38400 100644 --- a/apps/v4/app/(view)/view/[name]/page.tsx +++ b/apps/v4/app/(view)/view/[name]/page.tsx @@ -1,7 +1,7 @@ import * as React from "react" import { Metadata } from "next" import { notFound } from "next/navigation" -import { registryItemSchema } from "shadcn/registry" +import { registryItemSchema } from "shadcn/schema" import { z } from "zod" import { siteConfig } from "@/lib/config" diff --git a/apps/v4/components/block-display.tsx b/apps/v4/components/block-display.tsx index 34b223cd2c..f860cff158 100644 --- a/apps/v4/components/block-display.tsx +++ b/apps/v4/components/block-display.tsx @@ -1,5 +1,5 @@ import * as React from "react" -import { registryItemFileSchema } from "shadcn/registry" +import { registryItemFileSchema } from "shadcn/schema" import { z } from "zod" import { highlightCode } from "@/lib/highlight-code" diff --git a/apps/v4/components/block-viewer.tsx b/apps/v4/components/block-viewer.tsx index 1507ed5de6..5a65b1e7fe 100644 --- a/apps/v4/components/block-viewer.tsx +++ b/apps/v4/components/block-viewer.tsx @@ -17,7 +17,7 @@ import { Terminal, } from "lucide-react" import { ImperativePanelHandle } from "react-resizable-panels" -import { registryItemFileSchema, registryItemSchema } from "shadcn/registry" +import { registryItemFileSchema, registryItemSchema } from "shadcn/schema" import { z } from "zod" import { trackEvent } from "@/lib/events" diff --git a/apps/v4/components/chart-display.tsx b/apps/v4/components/chart-display.tsx index 9105900c85..6acd219d67 100644 --- a/apps/v4/components/chart-display.tsx +++ b/apps/v4/components/chart-display.tsx @@ -1,5 +1,5 @@ import * as React from "react" -import { registryItemSchema } from "shadcn/registry" +import { registryItemSchema } from "shadcn/schema" import { z } from "zod" import { highlightCode } from "@/lib/highlight-code" diff --git a/apps/v4/lib/blocks.ts b/apps/v4/lib/blocks.ts index 81d01d7fa3..df7904ce7c 100644 --- a/apps/v4/lib/blocks.ts +++ b/apps/v4/lib/blocks.ts @@ -1,6 +1,6 @@ "use server" -import { registryItemSchema } from "shadcn/registry" +import { registryItemSchema } from "shadcn/schema" import { z } from "zod" export async function getAllBlockIds( diff --git a/apps/v4/lib/registry.ts b/apps/v4/lib/registry.ts index 05ff6134bf..d6cdf85933 100644 --- a/apps/v4/lib/registry.ts +++ b/apps/v4/lib/registry.ts @@ -1,7 +1,7 @@ import { promises as fs } from "fs" import { tmpdir } from "os" import path from "path" -import { registryItemFileSchema, registryItemSchema } from "shadcn/registry" +import { registryItemFileSchema, registryItemSchema } from "shadcn/schema" import { Project, ScriptKind } from "ts-morph" import { z } from "zod" diff --git a/apps/v4/registry/index.ts b/apps/v4/registry/index.ts index 528bd8b021..85d45b310f 100644 --- a/apps/v4/registry/index.ts +++ b/apps/v4/registry/index.ts @@ -1,4 +1,4 @@ -import { registryItemSchema, type Registry } from "shadcn/registry" +import { registryItemSchema, type Registry } from "shadcn/schema" import { z } from "zod" import { blocks } from "@/registry/registry-blocks" diff --git a/apps/v4/registry/registry-blocks.ts b/apps/v4/registry/registry-blocks.ts index 614fdf125d..67aa5ed4ed 100644 --- a/apps/v4/registry/registry-blocks.ts +++ b/apps/v4/registry/registry-blocks.ts @@ -1,4 +1,4 @@ -import { type Registry } from "shadcn/registry" +import { type Registry } from "shadcn/schema" export const blocks: Registry["items"] = [ { diff --git a/apps/v4/registry/registry-charts.ts b/apps/v4/registry/registry-charts.ts index 551fffc470..deeda2cba6 100644 --- a/apps/v4/registry/registry-charts.ts +++ b/apps/v4/registry/registry-charts.ts @@ -1,4 +1,4 @@ -import { type Registry } from "shadcn/registry" +import { type Registry } from "shadcn/schema" export const charts: Registry["items"] = [ // Area Charts diff --git a/apps/v4/registry/registry-examples.ts b/apps/v4/registry/registry-examples.ts index 49251c4afe..a48f10a7d8 100644 --- a/apps/v4/registry/registry-examples.ts +++ b/apps/v4/registry/registry-examples.ts @@ -1,4 +1,4 @@ -import { type Registry } from "shadcn/registry" +import { type Registry } from "shadcn/schema" export const examples: Registry["items"] = [ { diff --git a/apps/v4/registry/registry-hooks.ts b/apps/v4/registry/registry-hooks.ts index 42c26c0cd7..5957a81599 100644 --- a/apps/v4/registry/registry-hooks.ts +++ b/apps/v4/registry/registry-hooks.ts @@ -1,4 +1,4 @@ -import { type Registry } from "shadcn/registry" +import { type Registry } from "shadcn/schema" export const hooks: Registry["items"] = [ { diff --git a/apps/v4/registry/registry-internal.ts b/apps/v4/registry/registry-internal.ts index 6cca972b4f..31adcb00e9 100644 --- a/apps/v4/registry/registry-internal.ts +++ b/apps/v4/registry/registry-internal.ts @@ -1,4 +1,4 @@ -import { type Registry } from "shadcn/registry" +import { type Registry } from "shadcn/schema" export const internal: Registry["items"] = [ // Do not move this. They are intentionally here for registry capture. diff --git a/apps/v4/registry/registry-lib.ts b/apps/v4/registry/registry-lib.ts index e6012e45b5..fd94cdea66 100644 --- a/apps/v4/registry/registry-lib.ts +++ b/apps/v4/registry/registry-lib.ts @@ -1,4 +1,4 @@ -import { type Registry } from "shadcn/registry" +import { type Registry } from "shadcn/schema" export const lib: Registry["items"] = [ { diff --git a/apps/v4/registry/registry-themes.ts b/apps/v4/registry/registry-themes.ts index 6337f1e3d2..afe51ddbbf 100644 --- a/apps/v4/registry/registry-themes.ts +++ b/apps/v4/registry/registry-themes.ts @@ -1,4 +1,4 @@ -import { type Registry } from "shadcn/registry" +import { type Registry } from "shadcn/schema" export const themes: Registry["items"] = [ { diff --git a/apps/v4/registry/registry-ui.ts b/apps/v4/registry/registry-ui.ts index fee943751e..63e3f19551 100644 --- a/apps/v4/registry/registry-ui.ts +++ b/apps/v4/registry/registry-ui.ts @@ -1,4 +1,4 @@ -import { type Registry } from "shadcn/registry" +import { type Registry } from "shadcn/schema" export const ui: Registry["items"] = [ { diff --git a/apps/www/components/block-display.tsx b/apps/www/components/block-display.tsx index e3c62a69f7..c1f4362c1e 100644 --- a/apps/www/components/block-display.tsx +++ b/apps/www/components/block-display.tsx @@ -1,5 +1,5 @@ import * as React from "react" -import { registryItemFileSchema } from "shadcn/registry" +import { registryItemFileSchema } from "shadcn/schema" import { z } from "zod" import { highlightCode } from "@/lib/highlight-code" diff --git a/apps/www/components/block-viewer.tsx b/apps/www/components/block-viewer.tsx index d80fffea75..710aacd401 100644 --- a/apps/www/components/block-viewer.tsx +++ b/apps/www/components/block-viewer.tsx @@ -16,7 +16,7 @@ import { Terminal, } from "lucide-react" import { ImperativePanelHandle } from "react-resizable-panels" -import { registryItemFileSchema, registryItemSchema } from "shadcn/registry" +import { registryItemFileSchema, registryItemSchema } from "shadcn/schema" import { z } from "zod" import { trackEvent } from "@/lib/events" diff --git a/apps/www/components/chart-display.tsx b/apps/www/components/chart-display.tsx index 9967e9e4ba..6bfb9e820f 100644 --- a/apps/www/components/chart-display.tsx +++ b/apps/www/components/chart-display.tsx @@ -1,5 +1,5 @@ import * as React from "react" -import { registryItemSchema } from "shadcn/registry" +import { registryItemSchema } from "shadcn/schema" import { z } from "zod" import { highlightCode } from "@/lib/highlight-code" diff --git a/apps/www/lib/blocks.ts b/apps/www/lib/blocks.ts index fdf4b7d994..6760fbdd33 100644 --- a/apps/www/lib/blocks.ts +++ b/apps/www/lib/blocks.ts @@ -1,6 +1,6 @@ "use server" -import { registryItemSchema } from "shadcn/registry" +import { registryItemSchema } from "shadcn/schema" import { z } from "zod" import { Style } from "@/registry/registry-styles" diff --git a/apps/www/lib/registry.ts b/apps/www/lib/registry.ts index ba1243d118..0186a12a8f 100644 --- a/apps/www/lib/registry.ts +++ b/apps/www/lib/registry.ts @@ -2,7 +2,7 @@ import { promises as fs } from "fs" import { tmpdir } from "os" import path from "path" import { Index } from "@/__registry__" -import { registryItemFileSchema, registryItemSchema } from "shadcn/registry" +import { registryItemFileSchema, registryItemSchema } from "shadcn/schema" import { Project, ScriptKind, SourceFile, SyntaxKind } from "ts-morph" import { z } from "zod" diff --git a/apps/www/registry/index.ts b/apps/www/registry/index.ts index f61aec3ea5..2195ca4f87 100644 --- a/apps/www/registry/index.ts +++ b/apps/www/registry/index.ts @@ -1,4 +1,4 @@ -import { type Registry } from "shadcn/registry" +import { type Registry } from "shadcn/schema" import { z } from "zod" import { blocks } from "@/registry/registry-blocks" diff --git a/apps/www/registry/registry-blocks.ts b/apps/www/registry/registry-blocks.ts index 8ef7eba65a..bf171310be 100644 --- a/apps/www/registry/registry-blocks.ts +++ b/apps/www/registry/registry-blocks.ts @@ -1,4 +1,4 @@ -import { type Registry } from "shadcn/registry" +import { type Registry } from "shadcn/schema" export const blocks: Registry["items"] = [ { diff --git a/apps/www/registry/registry-charts.ts b/apps/www/registry/registry-charts.ts index 551fffc470..deeda2cba6 100644 --- a/apps/www/registry/registry-charts.ts +++ b/apps/www/registry/registry-charts.ts @@ -1,4 +1,4 @@ -import { type Registry } from "shadcn/registry" +import { type Registry } from "shadcn/schema" export const charts: Registry["items"] = [ // Area Charts diff --git a/apps/www/registry/registry-examples.ts b/apps/www/registry/registry-examples.ts index 4f07b12ed6..d06105cec1 100644 --- a/apps/www/registry/registry-examples.ts +++ b/apps/www/registry/registry-examples.ts @@ -1,4 +1,4 @@ -import { type Registry } from "shadcn/registry" +import { type Registry } from "shadcn/schema" export const examples: Registry["items"] = [ { diff --git a/apps/www/registry/registry-hooks.ts b/apps/www/registry/registry-hooks.ts index bcc7354f12..117620e51f 100644 --- a/apps/www/registry/registry-hooks.ts +++ b/apps/www/registry/registry-hooks.ts @@ -1,4 +1,4 @@ -import { type Registry } from "shadcn/registry" +import { type Registry } from "shadcn/schema" export const hooks: Registry["items"] = [ { diff --git a/apps/www/registry/registry-internal.ts b/apps/www/registry/registry-internal.ts index aeb9a38dad..f3ff82b938 100644 --- a/apps/www/registry/registry-internal.ts +++ b/apps/www/registry/registry-internal.ts @@ -1,4 +1,4 @@ -import { type Registry } from "shadcn/registry" +import { type Registry } from "shadcn/schema" export const internal: Registry["items"] = [ { diff --git a/apps/www/registry/registry-lib.ts b/apps/www/registry/registry-lib.ts index e6012e45b5..fd94cdea66 100644 --- a/apps/www/registry/registry-lib.ts +++ b/apps/www/registry/registry-lib.ts @@ -1,4 +1,4 @@ -import { type Registry } from "shadcn/registry" +import { type Registry } from "shadcn/schema" export const lib: Registry["items"] = [ { diff --git a/apps/www/registry/registry-themes.ts b/apps/www/registry/registry-themes.ts index 6337f1e3d2..afe51ddbbf 100644 --- a/apps/www/registry/registry-themes.ts +++ b/apps/www/registry/registry-themes.ts @@ -1,4 +1,4 @@ -import { type Registry } from "shadcn/registry" +import { type Registry } from "shadcn/schema" export const themes: Registry["items"] = [ { diff --git a/apps/www/registry/registry-ui.ts b/apps/www/registry/registry-ui.ts index fee943751e..63e3f19551 100644 --- a/apps/www/registry/registry-ui.ts +++ b/apps/www/registry/registry-ui.ts @@ -1,4 +1,4 @@ -import { type Registry } from "shadcn/registry" +import { type Registry } from "shadcn/schema" export const ui: Registry["items"] = [ { diff --git a/apps/www/scripts/build-registry.mts b/apps/www/scripts/build-registry.mts index 25daf69ea3..ec2e33f695 100644 --- a/apps/www/scripts/build-registry.mts +++ b/apps/www/scripts/build-registry.mts @@ -9,7 +9,7 @@ import { registryItemSchema, registryItemTypeSchema, registrySchema, -} from "shadcn/registry" +} from "shadcn/schema" import { Project, ScriptKind } from "ts-morph" import { z } from "zod" diff --git a/packages/shadcn/package.json b/packages/shadcn/package.json index a9d0a7a793..ab5c83cd7e 100644 --- a/packages/shadcn/package.json +++ b/packages/shadcn/package.json @@ -35,6 +35,10 @@ "types": "./dist/registry/index.d.ts", "default": "./dist/registry/index.js" }, + "./schema": { + "types": "./dist/schema/index.d.ts", + "default": "./dist/schema/index.js" + }, "./mcp": { "types": "./dist/mcp/index.d.ts", "default": "./dist/mcp/index.js" diff --git a/packages/shadcn/src/commands/build.ts b/packages/shadcn/src/commands/build.ts index f1e398c9f5..18bdeb3c5f 100644 --- a/packages/shadcn/src/commands/build.ts +++ b/packages/shadcn/src/commands/build.ts @@ -1,7 +1,7 @@ import * as fs from "fs/promises" import * as path from "path" import { preFlightBuild } from "@/src/preflights/preflight-build" -import { registryItemSchema, registrySchema } from "@/src/registry" +import { registryItemSchema, registrySchema } from "@/src/schema" import { handleError } from "@/src/utils/handle-error" import { highlighter } from "@/src/utils/highlighter" import { logger } from "@/src/utils/logger" diff --git a/packages/shadcn/src/commands/diff.ts b/packages/shadcn/src/commands/diff.ts index 25961ebbcc..3e1dfa5738 100644 --- a/packages/shadcn/src/commands/diff.ts +++ b/packages/shadcn/src/commands/diff.ts @@ -6,7 +6,7 @@ import { getRegistryBaseColor, getShadcnRegistryIndex, } from "@/src/registry/api" -import { registryIndexSchema } from "@/src/registry/schema" +import { registryIndexSchema } from "@/src/schema" import { Config, getConfig } from "@/src/utils/get-config" import { handleError } from "@/src/utils/handle-error" import { highlighter } from "@/src/utils/highlighter" diff --git a/packages/shadcn/src/commands/init.ts b/packages/shadcn/src/commands/init.ts index 18c2a7ef77..2d97c776b6 100644 --- a/packages/shadcn/src/commands/init.ts +++ b/packages/shadcn/src/commands/init.ts @@ -10,7 +10,7 @@ import { buildUrlAndHeadersForRegistryItem } from "@/src/registry/builder" import { configWithDefaults } from "@/src/registry/config" import { BASE_COLORS } from "@/src/registry/constants" import { clearRegistryContext } from "@/src/registry/context" -import { rawConfigSchema } from "@/src/registry/schema" +import { rawConfigSchema } from "@/src/schema" import { addComponents } from "@/src/utils/add-components" import { TEMPLATES, createProject } from "@/src/utils/create-project" import { loadEnvFiles } from "@/src/utils/env-loader" diff --git a/packages/shadcn/src/commands/registry/build.ts b/packages/shadcn/src/commands/registry/build.ts index 85c6a647fb..bfd62578fd 100644 --- a/packages/shadcn/src/commands/registry/build.ts +++ b/packages/shadcn/src/commands/registry/build.ts @@ -1,12 +1,8 @@ import * as fs from "fs/promises" import * as path from "path" import { preFlightRegistryBuild } from "@/src/preflights/preflight-registry" -import { - configSchema, - registryItemSchema, - registrySchema, -} from "@/src/registry" import { recursivelyResolveFileImports } from "@/src/registry/utils" +import { configSchema, registryItemSchema, registrySchema } from "@/src/schema" import * as ERRORS from "@/src/utils/errors" import { ProjectInfo, getProjectInfo } from "@/src/utils/get-project-info" import { handleError } from "@/src/utils/handle-error" diff --git a/packages/shadcn/src/mcp/index.ts b/packages/shadcn/src/mcp/index.ts index 36016c5469..9c45078afe 100644 --- a/packages/shadcn/src/mcp/index.ts +++ b/packages/shadcn/src/mcp/index.ts @@ -1,6 +1,6 @@ -import { registrySchema } from "@/src/registry" import { getRegistryItems } from "@/src/registry/api" import { fetchRegistry } from "@/src/registry/fetcher" +import { registrySchema } from "@/src/schema" import { Server } from "@modelcontextprotocol/sdk/server/index.js" import { CallToolRequestSchema, diff --git a/packages/shadcn/src/migrations/migrate-icons.ts b/packages/shadcn/src/migrations/migrate-icons.ts index 343678ed49..3e1762c2b0 100644 --- a/packages/shadcn/src/migrations/migrate-icons.ts +++ b/packages/shadcn/src/migrations/migrate-icons.ts @@ -3,7 +3,7 @@ import { promises as fs } from "fs" import { tmpdir } from "os" import path from "path" import { getRegistryIcons } from "@/src/registry/api" -import { iconsSchema } from "@/src/registry/schema" +import { iconsSchema } from "@/src/schema" import { Config } from "@/src/utils/get-config" import { highlighter } from "@/src/utils/highlighter" import { ICON_LIBRARIES } from "@/src/utils/icon-libraries" diff --git a/packages/shadcn/src/registry/api.ts b/packages/shadcn/src/registry/api.ts index 9035212f17..9c661f2a64 100644 --- a/packages/shadcn/src/registry/api.ts +++ b/packages/shadcn/src/registry/api.ts @@ -22,7 +22,7 @@ import { registryItemSchema, registrySchema, stylesSchema, -} from "@/src/registry/schema" +} from "@/src/schema" import { Config } from "@/src/utils/get-config" import { handleError } from "@/src/utils/handle-error" import { logger } from "@/src/utils/logger" diff --git a/packages/shadcn/src/registry/builder.ts b/packages/shadcn/src/registry/builder.ts index 7becd4b0c0..3597c3eea3 100644 --- a/packages/shadcn/src/registry/builder.ts +++ b/packages/shadcn/src/registry/builder.ts @@ -2,9 +2,9 @@ import { REGISTRY_URL } from "@/src/registry/constants" import { expandEnvVars } from "@/src/registry/env" import { RegistryNotConfiguredError } from "@/src/registry/errors" import { parseRegistryAndItemFromString } from "@/src/registry/parser" -import { registryConfigItemSchema } from "@/src/registry/schema" import { isUrl } from "@/src/registry/utils" import { validateRegistryConfig } from "@/src/registry/validator" +import { registryConfigItemSchema } from "@/src/schema" import { Config } from "@/src/utils/get-config" import { z } from "zod" diff --git a/packages/shadcn/src/registry/config.ts b/packages/shadcn/src/registry/config.ts index e4159ddc77..9c3e22b119 100644 --- a/packages/shadcn/src/registry/config.ts +++ b/packages/shadcn/src/registry/config.ts @@ -1,5 +1,5 @@ import { BUILTIN_REGISTRIES, FALLBACK_STYLE } from "@/src/registry/constants" -import { configSchema } from "@/src/registry/schema" +import { configSchema } from "@/src/schema" import { Config, createConfig } from "@/src/utils/get-config" import deepmerge from "deepmerge" diff --git a/packages/shadcn/src/registry/constants.ts b/packages/shadcn/src/registry/constants.ts index 31bc0acee6..a11e90bd4f 100644 --- a/packages/shadcn/src/registry/constants.ts +++ b/packages/shadcn/src/registry/constants.ts @@ -1,4 +1,4 @@ -import { registryConfigSchema } from "@/src/registry/schema" +import { registryConfigSchema } from "@/src/schema" import { z } from "zod" export const REGISTRY_URL = diff --git a/packages/shadcn/src/registry/fetcher.ts b/packages/shadcn/src/registry/fetcher.ts index e3c2444990..0e87aa50c7 100644 --- a/packages/shadcn/src/registry/fetcher.ts +++ b/packages/shadcn/src/registry/fetcher.ts @@ -11,7 +11,7 @@ import { RegistryParseError, RegistryUnauthorizedError, } from "@/src/registry/errors" -import { registryItemSchema } from "@/src/registry/schema" +import { registryItemSchema } from "@/src/schema" import { HttpsProxyAgent } from "https-proxy-agent" import fetch from "node-fetch" import { z } from "zod" diff --git a/packages/shadcn/src/registry/index.ts b/packages/shadcn/src/registry/index.ts index 3958046a1f..2385f3a328 100644 --- a/packages/shadcn/src/registry/index.ts +++ b/packages/shadcn/src/registry/index.ts @@ -1,6 +1,3 @@ -// TODO: Move to a separate file to support client-side usage. -export * from "./schema" - // TODO: Remove these once we have a proper api. export { resolveRegistryTree as internal_registryResolveItemsTree } from "./resolver" export { fetchRegistry } from "./fetcher" diff --git a/packages/shadcn/src/registry/resolver.ts b/packages/shadcn/src/registry/resolver.ts index eaece140e1..2e1535cd58 100644 --- a/packages/shadcn/src/registry/resolver.ts +++ b/packages/shadcn/src/registry/resolver.ts @@ -15,15 +15,15 @@ import { } from "@/src/registry/errors" import { fetchRegistry, fetchRegistryLocal } from "@/src/registry/fetcher" import { parseRegistryAndItemFromString } from "@/src/registry/parser" -import { - registryItemSchema, - registryResolvedItemsTreeSchema, -} from "@/src/registry/schema" import { deduplicateFilesByTarget, isLocalFile, isUrl, } from "@/src/registry/utils" +import { + registryItemSchema, + registryResolvedItemsTreeSchema, +} from "@/src/schema" import { Config, getTargetStyleFromConfig } from "@/src/utils/get-config" import { getProjectTailwindVersionFromConfig } from "@/src/utils/get-project-info" import { handleError } from "@/src/utils/handle-error" diff --git a/packages/shadcn/src/registry/utils.ts b/packages/shadcn/src/registry/utils.ts index 831f1f0ba1..84fd4cdc62 100644 --- a/packages/shadcn/src/registry/utils.ts +++ b/packages/shadcn/src/registry/utils.ts @@ -1,8 +1,11 @@ import * as fs from "fs/promises" import { tmpdir } from "os" import * as path from "path" -import { configSchema, registryItemSchema } from "@/src/registry" -import { registryItemFileSchema } from "@/src/registry/schema" +import { + configSchema, + registryItemFileSchema, + registryItemSchema, +} from "@/src/schema" import { Config } from "@/src/utils/get-config" import { ProjectInfo, getProjectInfo } from "@/src/utils/get-project-info" import { resolveImport } from "@/src/utils/resolve-import" diff --git a/packages/shadcn/src/registry/validator.ts b/packages/shadcn/src/registry/validator.ts index d37a7b7898..e8ef9e3f35 100644 --- a/packages/shadcn/src/registry/validator.ts +++ b/packages/shadcn/src/registry/validator.ts @@ -1,6 +1,6 @@ import { extractEnvVars } from "@/src/registry/env" import { RegistryMissingEnvironmentVariablesError } from "@/src/registry/errors" -import { registryConfigItemSchema } from "@/src/registry/schema" +import { registryConfigItemSchema } from "@/src/schema" import { z } from "zod" export function extractEnvVarsFromRegistryConfig( diff --git a/packages/shadcn/src/schema/index.ts b/packages/shadcn/src/schema/index.ts new file mode 100644 index 0000000000..4e2f42a34e --- /dev/null +++ b/packages/shadcn/src/schema/index.ts @@ -0,0 +1 @@ +export * from "../registry/schema" diff --git a/packages/shadcn/src/utils/add-components.ts b/packages/shadcn/src/utils/add-components.ts index 1753653d7e..6cca485cde 100644 --- a/packages/shadcn/src/utils/add-components.ts +++ b/packages/shadcn/src/utils/add-components.ts @@ -7,7 +7,7 @@ import { registryItemFileSchema, registryItemSchema, workspaceConfigSchema, -} from "@/src/registry/schema" +} from "@/src/schema" import { findCommonRoot, findPackageRoot, diff --git a/packages/shadcn/src/utils/get-config.ts b/packages/shadcn/src/utils/get-config.ts index 5790433290..95f04a69e6 100644 --- a/packages/shadcn/src/utils/get-config.ts +++ b/packages/shadcn/src/utils/get-config.ts @@ -1,10 +1,10 @@ import path from "path" +import { BUILTIN_REGISTRIES } from "@/src/registry/constants" import { configSchema, rawConfigSchema, workspaceConfigSchema, -} from "@/src/registry" -import { BUILTIN_REGISTRIES } from "@/src/registry/constants" +} from "@/src/schema" import { getProjectInfo } from "@/src/utils/get-project-info" import { highlighter } from "@/src/utils/highlighter" import { resolveImport } from "@/src/utils/resolve-import" diff --git a/packages/shadcn/src/utils/get-project-info.ts b/packages/shadcn/src/utils/get-project-info.ts index 0157c316c7..8bca68172d 100644 --- a/packages/shadcn/src/utils/get-project-info.ts +++ b/packages/shadcn/src/utils/get-project-info.ts @@ -1,5 +1,5 @@ import path from "path" -import { rawConfigSchema } from "@/src/registry" +import { rawConfigSchema } from "@/src/schema" import { FRAMEWORKS, Framework } from "@/src/utils/frameworks" import { Config, getConfig, resolveConfigPaths } from "@/src/utils/get-config" import { getPackageInfo } from "@/src/utils/get-package-info" diff --git a/packages/shadcn/src/utils/transformers/index.ts b/packages/shadcn/src/utils/transformers/index.ts index 2cc9b31048..6d302ae397 100644 --- a/packages/shadcn/src/utils/transformers/index.ts +++ b/packages/shadcn/src/utils/transformers/index.ts @@ -1,7 +1,7 @@ import { promises as fs } from "fs" import { tmpdir } from "os" import path from "path" -import { registryBaseColorSchema } from "@/src/registry/schema" +import { registryBaseColorSchema } from "@/src/schema" import { Config } from "@/src/utils/get-config" import { transformCssVars } from "@/src/utils/transformers/transform-css-vars" import { transformIcons } from "@/src/utils/transformers/transform-icons" diff --git a/packages/shadcn/src/utils/transformers/transform-css-vars.ts b/packages/shadcn/src/utils/transformers/transform-css-vars.ts index b715d9108e..e264cff323 100644 --- a/packages/shadcn/src/utils/transformers/transform-css-vars.ts +++ b/packages/shadcn/src/utils/transformers/transform-css-vars.ts @@ -1,4 +1,4 @@ -import { registryBaseColorSchema } from "@/src/registry/schema" +import { registryBaseColorSchema } from "@/src/schema" import { Transformer } from "@/src/utils/transformers" import { ScriptKind, SyntaxKind } from "ts-morph" import { z } from "zod" diff --git a/packages/shadcn/src/utils/updaters/update-css-vars.ts b/packages/shadcn/src/utils/updaters/update-css-vars.ts index 00ca1a6ee1..9b9a55ccbc 100644 --- a/packages/shadcn/src/utils/updaters/update-css-vars.ts +++ b/packages/shadcn/src/utils/updaters/update-css-vars.ts @@ -3,7 +3,7 @@ import path from "path" import { registryItemCssVarsSchema, registryItemTailwindSchema, -} from "@/src/registry/schema" +} from "@/src/schema" import { Config } from "@/src/utils/get-config" import { getPackageInfo } from "@/src/utils/get-package-info" import { TailwindVersion } from "@/src/utils/get-project-info" diff --git a/packages/shadcn/src/utils/updaters/update-css.ts b/packages/shadcn/src/utils/updaters/update-css.ts index 014fce9781..58ddc0e1b4 100644 --- a/packages/shadcn/src/utils/updaters/update-css.ts +++ b/packages/shadcn/src/utils/updaters/update-css.ts @@ -1,6 +1,6 @@ import { promises as fs } from "fs" import path from "path" -import { registryItemCssSchema } from "@/src/registry/schema" +import { registryItemCssSchema } from "@/src/schema" import { Config } from "@/src/utils/get-config" import { highlighter } from "@/src/utils/highlighter" import { spinner } from "@/src/utils/spinner" diff --git a/packages/shadcn/src/utils/updaters/update-dependencies.ts b/packages/shadcn/src/utils/updaters/update-dependencies.ts index 9e8d7396ce..a73fd72fed 100644 --- a/packages/shadcn/src/utils/updaters/update-dependencies.ts +++ b/packages/shadcn/src/utils/updaters/update-dependencies.ts @@ -1,4 +1,4 @@ -import { RegistryItem } from "@/src/registry/schema" +import { RegistryItem } from "@/src/schema" import { Config } from "@/src/utils/get-config" import { getPackageInfo } from "@/src/utils/get-package-info" import { getPackageManager } from "@/src/utils/get-package-manager" diff --git a/packages/shadcn/src/utils/updaters/update-env-vars.ts b/packages/shadcn/src/utils/updaters/update-env-vars.ts index 5a0eaf8452..6b597b8404 100644 --- a/packages/shadcn/src/utils/updaters/update-env-vars.ts +++ b/packages/shadcn/src/utils/updaters/update-env-vars.ts @@ -1,6 +1,6 @@ import { existsSync, promises as fs } from "fs" import path from "path" -import { registryItemEnvVarsSchema } from "@/src/registry/schema" +import { registryItemEnvVarsSchema } from "@/src/schema" import { findExistingEnvFile, getNewEnvKeys, diff --git a/packages/shadcn/src/utils/updaters/update-files.ts b/packages/shadcn/src/utils/updaters/update-files.ts index b46d89ed20..18cf05d500 100644 --- a/packages/shadcn/src/utils/updaters/update-files.ts +++ b/packages/shadcn/src/utils/updaters/update-files.ts @@ -2,7 +2,7 @@ import { existsSync, promises as fs } from "fs" import { tmpdir } from "os" import path, { basename } from "path" import { getRegistryBaseColor } from "@/src/registry/api" -import { RegistryItem, registryItemFileSchema } from "@/src/registry/schema" +import { RegistryItem, registryItemFileSchema } from "@/src/schema" import { isContentSame } from "@/src/utils/compare" import { findExistingEnvFile, diff --git a/packages/shadcn/src/utils/updaters/update-tailwind-config.ts b/packages/shadcn/src/utils/updaters/update-tailwind-config.ts index b2a1b56531..05fa4c174c 100644 --- a/packages/shadcn/src/utils/updaters/update-tailwind-config.ts +++ b/packages/shadcn/src/utils/updaters/update-tailwind-config.ts @@ -4,7 +4,7 @@ import path from "path" import { registryItemCssVarsSchema, registryItemTailwindSchema, -} from "@/src/registry/schema" +} from "@/src/schema" import { Config } from "@/src/utils/get-config" import { TailwindVersion } from "@/src/utils/get-project-info" import { highlighter } from "@/src/utils/highlighter" diff --git a/packages/shadcn/tsup.config.ts b/packages/shadcn/tsup.config.ts index 04fd325e3d..2d57dd6759 100644 --- a/packages/shadcn/tsup.config.ts +++ b/packages/shadcn/tsup.config.ts @@ -3,7 +3,12 @@ import { defineConfig } from "tsup" export default defineConfig({ clean: true, dts: true, - entry: ["src/index.ts", "src/registry/index.ts", "src/mcp/index.ts"], + entry: [ + "src/index.ts", + "src/registry/index.ts", + "src/schema/index.ts", + "src/mcp/index.ts", + ], format: ["esm"], sourcemap: true, minify: true,