mirror of
https://github.com/shadcn-ui/ui.git
synced 2026-07-09 06:55:07 +00:00
faet: add support for laravel in init
This commit is contained in:
@@ -89,7 +89,7 @@ export const init = new Command()
|
||||
.argument("[components...]", "names, url or local path to component")
|
||||
.option(
|
||||
"-t, --template <template>",
|
||||
"the template to use. (next, start, vite, react-router)"
|
||||
"the template to use. (next, start, vite, react-router, laravel)"
|
||||
)
|
||||
.option("-b, --base <base>", "the component library to use. (radix, base)")
|
||||
.option("--monorepo", "scaffold a monorepo project.")
|
||||
@@ -284,6 +284,7 @@ export const init = new Command()
|
||||
choices: Object.entries(templates).map(([value, t]) => ({
|
||||
title: t.title,
|
||||
value,
|
||||
description: t.description,
|
||||
})),
|
||||
})
|
||||
|
||||
@@ -305,6 +306,23 @@ export const init = new Command()
|
||||
}
|
||||
}
|
||||
|
||||
// Laravel cannot be scaffolded — exit early with instructions.
|
||||
if (options.template === "laravel" && !hasPackageJson) {
|
||||
logger.break()
|
||||
logger.log(
|
||||
` Please create a new app with ${highlighter.info(
|
||||
"laravel new --react"
|
||||
)} first then run ${highlighter.info("shadcn init")}.`
|
||||
)
|
||||
logger.log(
|
||||
` See ${highlighter.info(
|
||||
"https://ui.shadcn.com/docs/installation/laravel"
|
||||
)} for more information.`
|
||||
)
|
||||
logger.break()
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
// Prompt for monorepo if the template supports it (new projects only).
|
||||
if (
|
||||
options.monorepo === undefined &&
|
||||
|
||||
@@ -102,7 +102,7 @@ export async function preFlightInit(
|
||||
let tailwindSpinnerMessage = "Validating Tailwind CSS."
|
||||
|
||||
if (projectInfo.tailwindVersion === "v4") {
|
||||
tailwindSpinnerMessage = `Validating Tailwind CSS config. Found ${highlighter.info(
|
||||
tailwindSpinnerMessage = `Validating Tailwind CSS. Found ${highlighter.info(
|
||||
"v4"
|
||||
)}.`
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ export interface TemplateInitOptions {
|
||||
export interface TemplateConfig {
|
||||
name: string
|
||||
title: string
|
||||
description?: string
|
||||
defaultProjectName: string
|
||||
// The template directory name (e.g. "next-app", "vite-app").
|
||||
templateDir: string
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { astro } from "./astro"
|
||||
import { laravel } from "./laravel"
|
||||
import { next } from "./next"
|
||||
import { reactRouter } from "./react-router"
|
||||
import { start } from "./start"
|
||||
@@ -16,6 +17,7 @@ export const templates = {
|
||||
vite,
|
||||
start,
|
||||
"react-router": reactRouter,
|
||||
laravel,
|
||||
astro,
|
||||
}
|
||||
|
||||
|
||||
31
packages/shadcn/src/templates/laravel.ts
Normal file
31
packages/shadcn/src/templates/laravel.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { highlighter } from "@/src/utils/highlighter"
|
||||
import { logger } from "@/src/utils/logger"
|
||||
|
||||
import { createTemplate } from "./create-template"
|
||||
|
||||
export const laravel = createTemplate({
|
||||
name: "laravel",
|
||||
title: "Laravel",
|
||||
description: "Requires `laravel new`",
|
||||
defaultProjectName: "laravel-app",
|
||||
templateDir: "laravel-app",
|
||||
frameworks: ["laravel"],
|
||||
scaffold: async () => {
|
||||
logger.break()
|
||||
logger.log(
|
||||
` Please create a new app with ${highlighter.info(
|
||||
"laravel new --react"
|
||||
)} first then run ${highlighter.info("shadcn init")}.`
|
||||
)
|
||||
logger.log(
|
||||
` See ${highlighter.info(
|
||||
"https://ui.shadcn.com/docs/installation/laravel"
|
||||
)} for more information.`
|
||||
)
|
||||
logger.break()
|
||||
process.exit(0)
|
||||
},
|
||||
create: async () => {
|
||||
// Not used — scaffold exits early.
|
||||
},
|
||||
})
|
||||
@@ -44,6 +44,7 @@ export async function createProject(
|
||||
choices: Object.entries(templates).map(([key, t]) => ({
|
||||
title: t.title,
|
||||
value: key,
|
||||
description: t.description,
|
||||
})),
|
||||
initial: 0,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user