repo stringlengths 7 64 | file_url stringlengths 81 338 | file_path stringlengths 5 257 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:25:31 2026-01-05 01:50:38 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/deprecated/www/registry/default/ui/tooltip.tsx | deprecated/www/registry/default/ui/tooltip.tsx | "use client"
import * as React from "react"
import * as TooltipPrimitive from "@radix-ui/react-tooltip"
import { cn } from "@/lib/utils"
const TooltipProvider = TooltipPrimitive.Provider
const Tooltip = TooltipPrimitive.Root
const TooltipTrigger = TooltipPrimitive.Trigger
const TooltipContent = React.forwardRef<
... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/deprecated/www/registry/default/ui/radio-group.tsx | deprecated/www/registry/default/ui/radio-group.tsx | "use client"
import * as React from "react"
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group"
import { Circle } from "lucide-react"
import { cn } from "@/lib/utils"
const RadioGroup = React.forwardRef<
React.ElementRef<typeof RadioGroupPrimitive.Root>,
React.ComponentPropsWithoutRef<typeof Radio... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/deprecated/www/registry/default/ui/chart.tsx | deprecated/www/registry/default/ui/chart.tsx | "use client"
import * as React from "react"
import * as RechartsPrimitive from "recharts"
import { cn } from "@/lib/utils"
// Format: { THEME_NAME: CSS_SELECTOR }
const THEMES = { light: "", dark: ".dark" } as const
export type ChartConfig = {
[k in string]: {
label?: React.ReactNode
icon?: React.Componen... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/deprecated/www/registry/default/ui/select.tsx | deprecated/www/registry/default/ui/select.tsx | "use client"
import * as React from "react"
import * as SelectPrimitive from "@radix-ui/react-select"
import { Check, ChevronDown, ChevronUp } from "lucide-react"
import { cn } from "@/lib/utils"
const Select = SelectPrimitive.Root
const SelectGroup = SelectPrimitive.Group
const SelectValue = SelectPrimitive.Value... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/deprecated/www/registry/default/ui/pagination.tsx | deprecated/www/registry/default/ui/pagination.tsx | import * as React from "react"
import { ChevronLeft, ChevronRight, MoreHorizontal } from "lucide-react"
import { cn } from "@/lib/utils"
import { ButtonProps, buttonVariants } from "@/registry/default/ui/button"
const Pagination = ({ className, ...props }: React.ComponentProps<"nav">) => (
<nav
role="navigation... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/deprecated/www/registry/default/ui/empty.tsx | deprecated/www/registry/default/ui/empty.tsx | import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "@/lib/utils"
function Empty({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="empty"
className={cn(
"flex min-w-0 flex-1 flex-col items-center justify-center gap-6 text-balanc... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/deprecated/www/registry/default/ui/alert-dialog.tsx | deprecated/www/registry/default/ui/alert-dialog.tsx | "use client"
import * as React from "react"
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog"
import { cn } from "@/lib/utils"
import { buttonVariants } from "@/registry/default/ui/button"
const AlertDialog = AlertDialogPrimitive.Root
const AlertDialogTrigger = AlertDialogPrimitive.Trigger
const... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/deprecated/www/registry/default/ui/command.tsx | deprecated/www/registry/default/ui/command.tsx | "use client"
import * as React from "react"
import { type DialogProps } from "@radix-ui/react-dialog"
import { Command as CommandPrimitive } from "cmdk"
import { Search } from "lucide-react"
import { cn } from "@/lib/utils"
import { Dialog, DialogContent } from "@/registry/default/ui/dialog"
const Command = React.fo... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/deprecated/www/registry/default/ui/input-otp.tsx | deprecated/www/registry/default/ui/input-otp.tsx | "use client"
import * as React from "react"
import { OTPInput, OTPInputContext } from "input-otp"
import { Dot } from "lucide-react"
import { cn } from "@/lib/utils"
const InputOTP = React.forwardRef<
React.ElementRef<typeof OTPInput>,
React.ComponentPropsWithoutRef<typeof OTPInput>
>(({ className, containerClas... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/deprecated/www/registry/default/ui/input.tsx | deprecated/www/registry/default/ui/input.tsx | import * as React from "react"
import { cn } from "@/lib/utils"
const Input = React.forwardRef<HTMLInputElement, React.ComponentProps<"input">>(
({ className, type, ...props }, ref) => {
return (
<input
type={type}
className={cn(
"flex h-10 w-full rounded-md border border-input b... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/deprecated/www/registry/default/ui/checkbox.tsx | deprecated/www/registry/default/ui/checkbox.tsx | "use client"
import * as React from "react"
import * as CheckboxPrimitive from "@radix-ui/react-checkbox"
import { Check } from "lucide-react"
import { cn } from "@/lib/utils"
const Checkbox = React.forwardRef<
React.ElementRef<typeof CheckboxPrimitive.Root>,
React.ComponentPropsWithoutRef<typeof CheckboxPrimiti... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/deprecated/www/registry/default/ui/input-group.tsx | deprecated/www/registry/default/ui/input-group.tsx | "use client"
import * as React from "react"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "@/lib/utils"
import { Button } from "@/registry/default/ui/button"
import { Input } from "@/registry/default/ui/input"
import { Textarea } from "@/registry/default/ui/textarea"
function I... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/deprecated/www/registry/default/ui/context-menu.tsx | deprecated/www/registry/default/ui/context-menu.tsx | "use client"
import * as React from "react"
import * as ContextMenuPrimitive from "@radix-ui/react-context-menu"
import { Check, ChevronRight, Circle } from "lucide-react"
import { cn } from "@/lib/utils"
const ContextMenu = ContextMenuPrimitive.Root
const ContextMenuTrigger = ContextMenuPrimitive.Trigger
const Co... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/deprecated/www/registry/default/ui/calendar.tsx | deprecated/www/registry/default/ui/calendar.tsx | "use client"
import * as React from "react"
import {
ChevronDownIcon,
ChevronLeftIcon,
ChevronRightIcon,
} from "lucide-react"
import { DayButton, DayPicker, getDefaultClassNames } from "react-day-picker"
import { cn } from "@/lib/utils"
import { Button, buttonVariants } from "@/registry/new-york/ui/button"
fu... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/templates/monorepo-next/apps/web/next-env.d.ts | templates/monorepo-next/apps/web/next-env.d.ts | /// <reference types="next" />
/// <reference types="next/image-types/global" />
import "./.next/types/routes.d.ts";
// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
| typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/templates/monorepo-next/apps/web/app/layout.tsx | templates/monorepo-next/apps/web/app/layout.tsx | import { Geist, Geist_Mono } from "next/font/google"
import "@workspace/ui/globals.css"
import { Providers } from "@/components/providers"
const fontSans = Geist({
subsets: ["latin"],
variable: "--font-sans",
})
const fontMono = Geist_Mono({
subsets: ["latin"],
variable: "--font-mono",
})
export default fun... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/templates/monorepo-next/apps/web/app/page.tsx | templates/monorepo-next/apps/web/app/page.tsx | import { Button } from "@workspace/ui/components/button"
export default function Page() {
return (
<div className="flex items-center justify-center min-h-svh">
<div className="flex flex-col items-center justify-center gap-4">
<h1 className="text-2xl font-bold">Hello World</h1>
<Button size=... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/templates/monorepo-next/apps/web/components/providers.tsx | templates/monorepo-next/apps/web/components/providers.tsx | "use client"
import * as React from "react"
import { ThemeProvider as NextThemesProvider } from "next-themes"
export function Providers({ children }: { children: React.ReactNode }) {
return (
<NextThemesProvider
attribute="class"
defaultTheme="system"
enableSystem
disableTransitionOnChan... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/templates/monorepo-next/packages/ui/src/components/button.tsx | templates/monorepo-next/packages/ui/src/components/button.tsx | import * as React from "react"
import { Slot } from "@radix-ui/react-slot"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "@workspace/ui/lib/utils"
const buttonVariants = cva(
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transi... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/templates/monorepo-next/packages/ui/src/lib/utils.ts | templates/monorepo-next/packages/ui/src/lib/utils.ts | import { clsx, type ClassValue } from "clsx"
import { twMerge } from "tailwind-merge"
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}
| typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/templates/start-app/vite.config.ts | templates/start-app/vite.config.ts | import { defineConfig } from 'vite'
import { devtools } from '@tanstack/devtools-vite'
import { tanstackStart } from '@tanstack/react-start/plugin/vite'
import viteReact from '@vitejs/plugin-react'
import viteTsConfigPaths from 'vite-tsconfig-paths'
import tailwindcss from '@tailwindcss/vite'
import { nitro } from 'nit... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/templates/start-app/src/routeTree.gen.ts | templates/start-app/src/routeTree.gen.ts | /* eslint-disable */
// @ts-nocheck
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
// You should NOT make any changes in this file as it will be overwritten.
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from bei... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/templates/start-app/src/router.tsx | templates/start-app/src/router.tsx | import { createRouter } from '@tanstack/react-router'
// Import the generated route tree
import { routeTree } from './routeTree.gen'
// Create a new router instance
export const getRouter = () => {
const router = createRouter({
routeTree,
scrollRestoration: true,
defaultPreloadStaleTime: 0,
})
retu... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/templates/start-app/src/routes/__root.tsx | templates/start-app/src/routes/__root.tsx | import { HeadContent, Scripts, createRootRoute } from '@tanstack/react-router'
import { TanStackRouterDevtoolsPanel } from '@tanstack/react-router-devtools'
import { TanStackDevtools } from '@tanstack/react-devtools'
import appCss from '../styles.css?url'
export const Route = createRootRoute({
head: () => ({
me... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/templates/start-app/src/routes/index.tsx | templates/start-app/src/routes/index.tsx | import { createFileRoute } from "@tanstack/react-router";
export const Route = createFileRoute("/")({ component: App });
function App() {
return (
<div className="min-h-screen flex flex-col items-center justify-center">
<div className="font-medium">Hello World</div>
</div>
);
}
| typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/templates/vite-app/vite.config.ts | templates/vite-app/vite.config.ts | import path from "path"
import tailwindcss from "@tailwindcss/vite"
import react from "@vitejs/plugin-react"
import { defineConfig } from "vite"
// https://vite.dev/config/
export default defineConfig({
plugins: [react(), tailwindcss()],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/templates/vite-app/src/App.tsx | templates/vite-app/src/App.tsx | export function App() {
return (
<div className="flex items-center justify-center min-h-screen">
<div className="font-medium">Hello World</div>
</div>
)
}
export default App
| typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/templates/vite-app/src/main.tsx | templates/vite-app/src/main.tsx | import { StrictMode } from "react"
import { createRoot } from "react-dom/client"
import "./index.css"
import App from "./App.tsx"
createRoot(document.getElementById("root")!).render(
<StrictMode>
<App />
</StrictMode>
)
| typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/tests/vitest.config.ts | packages/tests/vitest.config.ts | import tsconfigPaths from "vite-tsconfig-paths"
import { defineConfig } from "vitest/config"
export default defineConfig({
test: {
testTimeout: 120000,
hookTimeout: 120000,
globals: true,
environment: "node",
globalSetup: ["./src/utils/setup.ts"],
maxConcurrency: 4,
isolate: false,
},
... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/tests/fixtures/next-app-init/next.config.ts | packages/tests/fixtures/next-app-init/next.config.ts | /** @type {import('next').NextConfig} */
const nextConfig = {}
module.exports = nextConfig
| typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/tests/fixtures/next-app-init/app/layout.tsx | packages/tests/fixtures/next-app-init/app/layout.tsx | import "./globals.css"
import type { Metadata } from "next"
import { Inter } from "next/font/google"
const inter = Inter({ subsets: ["latin"] })
export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
}
export default function RootLayout({
children,
}: {
chi... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/tests/fixtures/next-app-init/app/page.tsx | packages/tests/fixtures/next-app-init/app/page.tsx | import Image from "next/image"
export default function Home() {
return (
<main className="flex min-h-screen flex-col items-center justify-between p-24">
<div className="z-10 max-w-5xl w-full items-center justify-between font-mono text-sm lg:flex">
<p className="fixed left-0 top-0 flex w-full justif... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/tests/fixtures/next-app-init/lib/utils.ts | packages/tests/fixtures/next-app-init/lib/utils.ts | import { clsx, type ClassValue } from "clsx"
import { twMerge } from "tailwind-merge"
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}
| typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/tests/fixtures/next-app/next.config.ts | packages/tests/fixtures/next-app/next.config.ts | /** @type {import('next').NextConfig} */
const nextConfig = {}
module.exports = nextConfig
| typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/tests/fixtures/next-app/app/layout.tsx | packages/tests/fixtures/next-app/app/layout.tsx | import "./globals.css"
import type { Metadata } from "next"
import { Inter } from "next/font/google"
const inter = Inter({ subsets: ["latin"] })
export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
}
export default function RootLayout({
children,
}: {
chi... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/tests/fixtures/next-app/app/page.tsx | packages/tests/fixtures/next-app/app/page.tsx | import Image from "next/image"
export default function Home() {
return (
<main className="flex min-h-screen flex-col items-center justify-between p-24">
<div className="z-10 max-w-5xl w-full items-center justify-between font-mono text-sm lg:flex">
<p className="fixed left-0 top-0 flex w-full justif... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/tests/fixtures/vite-app/vite.config.ts | packages/tests/fixtures/vite-app/vite.config.ts | import path from "path"
import tailwindcss from "@tailwindcss/vite"
import react from "@vitejs/plugin-react"
import { defineConfig } from "vite"
// https://vite.dev/config/
export default defineConfig({
plugins: [react(), tailwindcss()],
resolve: {
alias: {
"#custom": path.resolve(__dirname, "./src"),
... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/tests/fixtures/vite-app/src/App.tsx | packages/tests/fixtures/vite-app/src/App.tsx | import { useState } from "react"
import reactLogo from "./assets/react.svg"
import viteLogo from "/vite.svg"
import "./App.css"
function App() {
const [count, setCount] = useState(0)
return (
<>
<div>
<a href="https://vite.dev" target="_blank">
<img src={viteLogo} className="logo" alt... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/tests/fixtures/vite-app/src/main.tsx | packages/tests/fixtures/vite-app/src/main.tsx | import { StrictMode } from "react"
import { createRoot } from "react-dom/client"
import "./index.css"
import App from "./App.tsx"
createRoot(document.getElementById("root")!).render(
<StrictMode>
<App />
</StrictMode>
)
| typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/tests/fixtures/vite-app/src/vite-env.d.ts | packages/tests/fixtures/vite-app/src/vite-env.d.ts | /// <reference types="vite/client" />
| typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/tests/src/tests/init.test.ts | packages/tests/src/tests/init.test.ts | import path from "path"
import fs from "fs-extra"
import { describe, expect, it } from "vitest"
import {
createFixtureTestDirectory,
cssHasProperties,
npxShadcn,
} from "../utils/helpers"
import { createRegistryServer } from "../utils/registry"
describe("shadcn init - next-app", () => {
it("should init with d... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/tests/src/tests/add.test.ts | packages/tests/src/tests/add.test.ts | import path from "path"
import fs from "fs-extra"
import { describe, expect, it } from "vitest"
import {
createFixtureTestDirectory,
cssHasProperties,
getRegistryUrl,
npxShadcn,
} from "../utils/helpers"
// Note: The tests here intentionally do not use a mocked registry.
// We test this against the real regis... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/tests/src/tests/registries.test.ts | packages/tests/src/tests/registries.test.ts | /* eslint-disable turbo/no-undeclared-env-vars */
import path from "path"
import fs from "fs-extra"
import { afterAll, beforeAll, describe, expect, it } from "vitest"
import {
createFixtureTestDirectory,
cssHasProperties,
npxShadcn,
} from "../utils/helpers"
import { configureRegistries, createRegistryServer } f... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | true |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/tests/src/tests/search.test.ts | packages/tests/src/tests/search.test.ts | import { afterAll, beforeAll, describe, expect, it } from "vitest"
import { createFixtureTestDirectory, npxShadcn } from "../utils/helpers"
import { configureRegistries, createRegistryServer } from "../utils/registry"
const registryShadcn = await createRegistryServer(
[
{
name: "button",
type: "regi... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/tests/src/tests/view.test.ts | packages/tests/src/tests/view.test.ts | import { afterAll, beforeAll, describe, expect, it } from "vitest"
import { createFixtureTestDirectory, npxShadcn } from "../utils/helpers"
import { configureRegistries, createRegistryServer } from "../utils/registry"
const registryShadcn = await createRegistryServer(
[
{
name: "button",
type: "regi... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/tests/src/utils/setup.ts | packages/tests/src/utils/setup.ts | import path from "path"
import fs from "fs-extra"
import { rimraf } from "rimraf"
export const TEMP_DIR = path.join(__dirname, "../../temp")
export default async function setup() {
await fs.ensureDir(TEMP_DIR)
return async () => {
try {
await rimraf(TEMP_DIR)
} catch (error) {
console.error("... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/tests/src/utils/registry.ts | packages/tests/src/utils/registry.ts | import { createServer } from "http"
import path from "path"
import fs from "fs-extra"
export async function createRegistryServer(
items: Array<{ name: string; type: string } & Record<string, unknown>>,
{
port = 4444,
path = "/r",
}: {
port?: number
path?: string
}
) {
const server = createSer... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/tests/src/utils/helpers.ts | packages/tests/src/utils/helpers.ts | import { randomUUID } from "crypto"
import path from "path"
import { fileURLToPath } from "url"
import { execa } from "execa"
import fs from "fs-extra"
import { TEMP_DIR } from "./setup"
const __dirname = path.dirname(fileURLToPath(import.meta.url))
const FIXTURES_DIR = path.join(__dirname, "../../fixtures")
const SH... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/vitest.config.ts | packages/shadcn/vitest.config.ts | import tsconfigPaths from "vite-tsconfig-paths"
import { configDefaults, defineConfig } from "vitest/config"
export default defineConfig({
test: {
exclude: [
...configDefaults.exclude,
"**/node_modules/**",
"**/fixtures/**",
"**/templates/**",
],
testTimeout: 8000,
},
plugins:... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/tsup.config.ts | packages/shadcn/tsup.config.ts | import { copyFileSync } from "fs"
import { defineConfig } from "tsup"
export default defineConfig({
clean: true,
dts: true,
entry: [
"src/index.ts",
"src/registry/index.ts",
"src/schema/index.ts",
"src/mcp/index.ts",
"src/utils/index.ts",
"src/icons/index.ts",
],
format: ["esm"],
so... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/index.ts | packages/shadcn/src/index.ts | #!/usr/bin/env node
import { add } from "@/src/commands/add"
import { build } from "@/src/commands/build"
import { create } from "@/src/commands/create"
import { diff } from "@/src/commands/diff"
import { info } from "@/src/commands/info"
import { init } from "@/src/commands/init"
import { mcp } from "@/src/commands/mc... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/styles/transform.ts | packages/shadcn/src/styles/transform.ts | import { Project, ScriptKind, type SourceFile } from "ts-morph"
import { type StyleMap } from "./create-style-map"
import { transformStyleMap } from "./transform-style-map"
export type TransformerStyle<Output = SourceFile> = (opts: {
sourceFile: SourceFile
styleMap: StyleMap
}) => Promise<Output>
export async fu... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/styles/create-style-map.test.ts | packages/shadcn/src/styles/create-style-map.test.ts | import { describe, expect, it } from "vitest"
import { createStyleMap } from "./create-style-map"
describe("parseStyle", () => {
it("extracts tailwind classes from @apply directives", () => {
const css = `
.style-nova {
.cn-alert-dialog-content {
@apply bg-background gap-4 rounded-xl bor... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/styles/transform-style-map.test.ts | packages/shadcn/src/styles/transform-style-map.test.ts | import { Project, ScriptKind } from "ts-morph"
import { describe, expect, it } from "vitest"
import { type StyleMap } from "./create-style-map"
import { transformStyleMap } from "./transform-style-map"
const baseStyleMap: StyleMap = {
"cn-foo": "bg-background gap-4 rounded-xl",
}
async function applyTransform(sour... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/styles/transform-style-map.ts | packages/shadcn/src/styles/transform-style-map.ts | import { TransformerStyle } from "@/src/styles/transform"
import {
Node,
type CallExpression,
type NoSubstitutionTemplateLiteral,
type SourceFile,
type StringLiteral,
} from "ts-morph"
import { type StyleMap } from "./create-style-map"
/**
* Classes that should never be removed during transformation.
* Th... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/styles/create-style-map.ts | packages/shadcn/src/styles/create-style-map.ts | import postcss from "postcss"
import selectorParser, {
type ClassName,
type Selector as SelectorNodeRoot,
} from "postcss-selector-parser"
import { z } from "zod"
const CN_PREFIX = "cn-"
export const styleMapSchema = z.record(
z.string().startsWith(CN_PREFIX),
z.string()
)
export type StyleMap = z.infer<type... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/preflights/preflight-migrate.ts | packages/shadcn/src/preflights/preflight-migrate.ts | import path from "path"
import { addOptionsSchema } from "@/src/commands/add"
import { migrateOptionsSchema } from "@/src/commands/migrate"
import * as ERRORS from "@/src/utils/errors"
import { getConfig } from "@/src/utils/get-config"
import { highlighter } from "@/src/utils/highlighter"
import { logger } from "@/src/... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/preflights/preflight-build.ts | packages/shadcn/src/preflights/preflight-build.ts | import path from "path"
import { buildOptionsSchema } from "@/src/commands/build"
import * as ERRORS from "@/src/utils/errors"
import { highlighter } from "@/src/utils/highlighter"
import { logger } from "@/src/utils/logger"
import fs from "fs-extra"
import { z } from "zod"
export async function preFlightBuild(
opti... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/preflights/preflight-add.ts | packages/shadcn/src/preflights/preflight-add.ts | import path from "path"
import { addOptionsSchema } from "@/src/commands/add"
import * as ERRORS from "@/src/utils/errors"
import { getConfig } from "@/src/utils/get-config"
import { highlighter } from "@/src/utils/highlighter"
import { logger } from "@/src/utils/logger"
import fs from "fs-extra"
import { z } from "zod... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/preflights/preflight-registry.ts | packages/shadcn/src/preflights/preflight-registry.ts | import path from "path"
import { buildOptionsSchema } from "@/src/commands/build"
import * as ERRORS from "@/src/utils/errors"
import { getConfig } from "@/src/utils/get-config"
import { highlighter } from "@/src/utils/highlighter"
import { logger } from "@/src/utils/logger"
import fs from "fs-extra"
import { z } from ... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/preflights/preflight-init.ts | packages/shadcn/src/preflights/preflight-init.ts | import path from "path"
import { initOptionsSchema } from "@/src/commands/init"
import * as ERRORS from "@/src/utils/errors"
import { getProjectInfo } from "@/src/utils/get-project-info"
import { highlighter } from "@/src/utils/highlighter"
import { logger } from "@/src/utils/logger"
import { spinner } from "@/src/util... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/icons/index.ts | packages/shadcn/src/icons/index.ts | export * from "./libraries"
| typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/icons/libraries.ts | packages/shadcn/src/icons/libraries.ts | export const iconLibraries = {
lucide: {
name: "lucide",
title: "Lucide",
packages: ["lucide-react"],
import: "import { ICON } from 'lucide-react'",
usage: "<ICON />",
export: "lucide-react",
},
tabler: {
name: "tabler",
title: "Tabler Icons",
packages: ["@tabler/icons-react"],... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/commands/init.ts | packages/shadcn/src/commands/init.ts | import { promises as fs } from "fs"
import path from "path"
import { preFlightInit } from "@/src/preflights/preflight-init"
import {
getRegistryBaseColors,
getRegistryItems,
getRegistryStyles,
} from "@/src/registry/api"
import { buildUrlAndHeadersForRegistryItem } from "@/src/registry/builder"
import { configWit... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/commands/info.ts | packages/shadcn/src/commands/info.ts | import { getConfig } from "@/src/utils/get-config"
import { getProjectInfo } from "@/src/utils/get-project-info"
import { handleError } from "@/src/utils/handle-error"
import { logger } from "@/src/utils/logger"
import { Command } from "commander"
export const info = new Command()
.name("info")
.description("get i... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/commands/diff.ts | packages/shadcn/src/commands/diff.ts | import { existsSync, promises as fs } from "fs"
import path from "path"
import {
fetchTree,
getItemTargetPath,
getRegistryBaseColor,
getShadcnRegistryIndex,
} from "@/src/registry/api"
import { registryIndexSchema } from "@/src/schema"
import { Config, getConfig } from "@/src/utils/get-config"
import { handleEr... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/commands/build.ts | packages/shadcn/src/commands/build.ts | import * as fs from "fs/promises"
import * as path from "path"
import { preFlightBuild } from "@/src/preflights/preflight-build"
import { registryItemSchema, registrySchema } from "@/src/schema"
import { handleError } from "@/src/utils/handle-error"
import { highlighter } from "@/src/utils/highlighter"
import { logger ... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/commands/mcp.ts | packages/shadcn/src/commands/mcp.ts | import { promises as fs } from "fs"
import path from "path"
import { server } from "@/src/mcp"
import { loadEnvFiles } from "@/src/utils/env-loader"
import { getConfig } from "@/src/utils/get-config"
import { getPackageManager } from "@/src/utils/get-package-manager"
import { handleError } from "@/src/utils/handle-erro... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/commands/create.ts | packages/shadcn/src/commands/create.ts | import path from "path"
import { getPreset, getPresets, getRegistryItems } from "@/src/registry/api"
import { configWithDefaults } from "@/src/registry/config"
import { clearRegistryContext } from "@/src/registry/context"
import { isUrl } from "@/src/registry/utils"
import { Preset } from "@/src/schema"
import { addCom... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/commands/search.ts | packages/shadcn/src/commands/search.ts | import path from "path"
import { configWithDefaults } from "@/src/registry/config"
import { clearRegistryContext } from "@/src/registry/context"
import { searchRegistries } from "@/src/registry/search"
import { validateRegistryConfigForItems } from "@/src/registry/validator"
import { rawConfigSchema } from "@/src/schem... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/commands/migrate.ts | packages/shadcn/src/commands/migrate.ts | import path from "path"
import { migrateIcons } from "@/src/migrations/migrate-icons"
import { migrateRadix } from "@/src/migrations/migrate-radix"
import { preFlightMigrate } from "@/src/preflights/preflight-migrate"
import * as ERRORS from "@/src/utils/errors"
import { handleError } from "@/src/utils/handle-error"
im... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/commands/add.ts | packages/shadcn/src/commands/add.ts | import path from "path"
import { runInit } from "@/src/commands/init"
import { preFlightAdd } from "@/src/preflights/preflight-add"
import { getRegistryItems, getShadcnRegistryIndex } from "@/src/registry/api"
import { DEPRECATED_COMPONENTS } from "@/src/registry/constants"
import { clearRegistryContext } from "@/src/r... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/commands/view.ts | packages/shadcn/src/commands/view.ts | import path from "path"
import { getRegistryItems } from "@/src/registry/api"
import { configWithDefaults } from "@/src/registry/config"
import { clearRegistryContext } from "@/src/registry/context"
import { validateRegistryConfigForItems } from "@/src/registry/validator"
import { rawConfigSchema } from "@/src/schema"
... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/commands/registry/build.ts | packages/shadcn/src/commands/registry/build.ts | import * as fs from "fs/promises"
import * as path from "path"
import { preFlightRegistryBuild } from "@/src/preflights/preflight-registry"
import { recursivelyResolveFileImports } from "@/src/registry/utils"
import { configSchema, registryItemSchema, registrySchema } from "@/src/schema"
import * as ERRORS from "@/src/... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/commands/registry/mcp.ts | packages/shadcn/src/commands/registry/mcp.ts | import { highlighter } from "@/src/utils/highlighter"
import { logger } from "@/src/utils/logger"
import { Command } from "commander"
export const mcp = new Command()
.name("registry:mcp")
.description("starts the registry MCP server [DEPRECATED]")
.option(
"-c, --cwd <cwd>",
"the working directory. defa... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/utils/create-project.test.ts | packages/shadcn/src/utils/create-project.test.ts | import { fetchRegistry } from "@/src/registry/fetcher"
import { spinner } from "@/src/utils/spinner"
import { execa } from "execa"
import fs from "fs-extra"
import prompts from "prompts"
import {
afterEach,
beforeEach,
describe,
expect,
it,
vi,
type MockInstance,
} from "vitest"
import { TEMPLATES, creat... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/utils/get-config.ts | packages/shadcn/src/utils/get-config.ts | import path from "path"
import { BUILTIN_REGISTRIES } from "@/src/registry/constants"
import {
configSchema,
rawConfigSchema,
workspaceConfigSchema,
} from "@/src/schema"
import { getProjectInfo } from "@/src/utils/get-project-info"
import { highlighter } from "@/src/utils/highlighter"
import { resolveImport } fr... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/utils/env-helpers.test.ts | packages/shadcn/src/utils/env-helpers.test.ts | import { existsSync } from "fs"
import { beforeEach, describe, expect, test, vi } from "vitest"
import {
findExistingEnvFile,
getNewEnvKeys,
isEnvFile,
mergeEnvContent,
parseEnvContent,
} from "./env-helpers"
// Mock fs module
vi.mock("fs", () => ({
existsSync: vi.fn(),
}))
describe("isEnvFile", () => {
... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/utils/templates.ts | packages/shadcn/src/utils/templates.ts | export const UTILS = `import { type ClassValue, clsx } from "clsx"
import { twMerge } from "tailwind-merge"
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}
`
export const UTILS_JS = `import { clsx } from "clsx"
import { twMerge } from "tailwind-merge"
export function cn(...inputs) {
... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/utils/errors.ts | packages/shadcn/src/utils/errors.ts | export const MISSING_DIR_OR_EMPTY_PROJECT = "1"
export const EXISTING_CONFIG = "2"
export const MISSING_CONFIG = "3"
export const FAILED_CONFIG_READ = "4"
export const TAILWIND_NOT_CONFIGURED = "5"
export const IMPORT_ALIAS_MISSING = "6"
export const UNSUPPORTED_FRAMEWORK = "7"
export const COMPONENT_URL_NOT_FOUND = "8... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/utils/add-components.ts | packages/shadcn/src/utils/add-components.ts | import path from "path"
import { getRegistryItems } from "@/src/registry/api"
import { configWithDefaults } from "@/src/registry/config"
import { resolveRegistryTree } from "@/src/registry/resolver"
import {
configSchema,
registryItemFileSchema,
registryItemSchema,
workspaceConfigSchema,
} from "@/src/schema"
i... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/utils/resolve-import.ts | packages/shadcn/src/utils/resolve-import.ts | import { createMatchPath, type ConfigLoaderSuccessResult } from "tsconfig-paths"
export async function resolveImport(
importPath: string,
config: Pick<ConfigLoaderSuccessResult, "absoluteBaseUrl" | "paths">
) {
return createMatchPath(config.absoluteBaseUrl, config.paths)(
importPath,
undefined,
() =>... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/utils/file-helper.ts | packages/shadcn/src/utils/file-helper.ts | import fsExtra from "fs-extra"
export const FILE_BACKUP_SUFFIX = ".bak"
export function createFileBackup(filePath: string): string | null {
if (!fsExtra.existsSync(filePath)) {
return null
}
const backupPath = `${filePath}${FILE_BACKUP_SUFFIX}`
try {
fsExtra.renameSync(filePath, backupPath)
retur... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/utils/handle-error.ts | packages/shadcn/src/utils/handle-error.ts | import { RegistryError } from "@/src/registry/errors"
import { highlighter } from "@/src/utils/highlighter"
import { logger } from "@/src/utils/logger"
import { z } from "zod"
export function handleError(error: unknown) {
logger.break()
logger.error(
`Something went wrong. Please check the error below for more... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/utils/get-project-info.ts | packages/shadcn/src/utils/get-project-info.ts | import path from "path"
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"
import fg from "fast-glob"
import fs from "fs... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/utils/create-project.ts | packages/shadcn/src/utils/create-project.ts | import os from "os"
import path from "path"
import { initOptionsSchema } from "@/src/commands/init"
import { fetchRegistry } from "@/src/registry/fetcher"
import { getPackageManager } from "@/src/utils/get-package-manager"
import { handleError } from "@/src/utils/handle-error"
import { highlighter } from "@/src/utils/h... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/utils/frameworks.ts | packages/shadcn/src/utils/frameworks.ts | export const FRAMEWORKS = {
"next-app": {
name: "next-app",
label: "Next.js",
links: {
installation: "https://ui.shadcn.com/docs/installation/next",
tailwind: "https://tailwindcss.com/docs/guides/nextjs",
},
},
"next-pages": {
name: "next-pages",
label: "Next.js",
links: {
... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/utils/env-loader.ts | packages/shadcn/src/utils/env-loader.ts | import { existsSync } from "fs"
import { join } from "path"
import { logger } from "@/src/utils/logger"
export async function loadEnvFiles(cwd: string = process.cwd()): Promise<void> {
try {
const { config } = await import("@dotenvx/dotenvx")
const envFiles = [
".env.local",
".env.development.loc... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/utils/update-app-index.ts | packages/shadcn/src/utils/update-app-index.ts | import fs from "fs/promises"
import path from "path"
import { getRegistryItems } from "@/src/registry/api"
import { Config } from "@/src/utils/get-config"
export async function updateAppIndex(component: string, config: Config) {
const indexPath = path.join(config.resolvedPaths.cwd, "app/page.tsx")
if (!(await fs.... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/utils/is-safe-target.test.ts | packages/shadcn/src/utils/is-safe-target.test.ts | import { describe, expect, test } from "vitest"
import { isSafeTarget } from "./is-safe-target"
describe("isSafeTarget", () => {
const cwd = "/foo/bar"
describe("should reject path traversal attempts", () => {
test.each([
{
description: "basic path traversal with ../",
target: "../../et... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/utils/env-helpers.ts | packages/shadcn/src/utils/env-helpers.ts | import { existsSync } from "fs"
import path from "path"
export function isEnvFile(filePath: string) {
const fileName = path.basename(filePath)
return /^\.env(\.|$)/.test(fileName)
}
/**
* Finds a file variant in the project.
* TODO: abstract this to a more generic function.
*/
export function findExistingEnvFi... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/utils/logger.ts | packages/shadcn/src/utils/logger.ts | import { highlighter } from "@/src/utils/highlighter"
export const logger = {
error(...args: unknown[]) {
console.log(highlighter.error(args.join(" ")))
},
warn(...args: unknown[]) {
console.log(highlighter.warn(args.join(" ")))
},
info(...args: unknown[]) {
console.log(highlighter.info(args.join... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/utils/compare.ts | packages/shadcn/src/utils/compare.ts | export function isContentSame(
existingContent: string,
newContent: string,
options: {
ignoreImports?: boolean
} = {}
) {
const { ignoreImports = false } = options
// Normalize line endings and whitespace.
const normalizedExisting = existingContent.replace(/\r\n/g, "\n").trim()
const normalizedNew ... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/utils/is-safe-target.ts | packages/shadcn/src/utils/is-safe-target.ts | import path from "path"
export function isSafeTarget(targetPath: string, cwd: string): boolean {
// Check for null bytes which can be used to bypass validations.
if (targetPath.includes("\0")) {
return false
}
// Decode URL-encoded sequences to catch encoded traversal attempts.
let decodedPath: string
... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/utils/highlighter.ts | packages/shadcn/src/utils/highlighter.ts | import { cyan, green, red, yellow } from "kleur/colors"
export const highlighter = {
error: red,
warn: yellow,
info: cyan,
success: green,
}
| typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/utils/index.ts | packages/shadcn/src/utils/index.ts | export { createStyleMap } from "../styles/create-style-map"
export { transformStyle } from "../styles/transform"
export { transformIcons } from "../utils/transformers/transform-icons"
export { transformMenu } from "../utils/transformers/transform-menu"
export { transformRender } from "../utils/transformers/transform-re... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/utils/registries.ts | packages/shadcn/src/utils/registries.ts | import path from "path"
import { getRegistriesIndex } from "@/src/registry/api"
import { BUILTIN_REGISTRIES } from "@/src/registry/constants"
import { resolveRegistryNamespaces } from "@/src/registry/namespaces"
import { rawConfigSchema } from "@/src/registry/schema"
import { Config } from "@/src/utils/get-config"
impo... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/utils/get-package-info.ts | packages/shadcn/src/utils/get-package-info.ts | import path from "path"
import fs from "fs-extra"
import { type PackageJson } from "type-fest"
export function getPackageInfo(
cwd: string = "",
shouldThrow: boolean = true
): PackageJson | null {
const packageJsonPath = path.join(cwd, "package.json")
return fs.readJSONSync(packageJsonPath, {
throws: shou... | typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/utils/legacy-icon-libraries.ts | packages/shadcn/src/utils/legacy-icon-libraries.ts | export const LEGACY_ICON_LIBRARIES = {
lucide: {
name: "lucide-react",
package: "lucide-react",
import: "lucide-react",
},
radix: {
name: "@radix-ui/react-icons",
package: "@radix-ui/react-icons",
import: "@radix-ui/react-icons",
},
}
| typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
shadcn-ui/ui | https://github.com/shadcn-ui/ui/blob/ccafdaf7c6f6747a24f54e84436b42ec42f01779/packages/shadcn/src/utils/spinner.ts | packages/shadcn/src/utils/spinner.ts | import ora, { type Options } from "ora"
export function spinner(
text: Options["text"],
options?: {
silent?: boolean
}
) {
return ora({
text,
isSilent: options?.silent,
})
}
| typescript | MIT | ccafdaf7c6f6747a24f54e84436b42ec42f01779 | 2026-01-04T15:25:31.746168Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.