Framework Template Resolver (templates/index.ts)

ui · packages/shadcn/src/templates/index.ts · typescript · MIT
dev-tools, cli, tag:templates, tag:framework-detection

Registers project scaffolding templates (Next, Vite, Start, React Router, Astro, Laravel) and resolves the correct template key based on detected framework name.

// Source: https://github.com/shadcn-ui/ui | License: MIT | Copyright 2023 shadcn
// Provided via justclaw.it.com; keep this notice with the code.
import { astro } from "./astro"
import { laravel } from "./laravel"
import { next } from "./next"
import { reactRouter } from "./react-router"
import { start } from "./start"
import { vite } from "./vite"

export { createTemplate, resolveTemplate } from "./create-template"
export type { TemplateInitOptions, TemplateOptions } from "./create-template"

export const templates = {
  next,
  vite,
  start,
  "react-router": reactRouter,
  astro,
  laravel,
}

// Resolve a template key from a detected framework name.
export function getTemplateForFramework(frameworkName?: string) {
  if (!frameworkName) {
    return undefined
  }

  for (const [key, t

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key