mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
add nextjs frontend and backend
This commit is contained in:
@@ -16,6 +16,11 @@ export async function getBackendFrameworkChoice(
|
||||
label: "Hono",
|
||||
hint: "Lightweight, ultrafast web framework",
|
||||
},
|
||||
{
|
||||
value: "next",
|
||||
label: "Next.js",
|
||||
hint: "Full-stack framework with API routes",
|
||||
},
|
||||
{
|
||||
value: "express",
|
||||
label: "Express",
|
||||
|
||||
@@ -52,7 +52,8 @@ export async function gatherConfig(
|
||||
},
|
||||
frontend: () => getFrontendChoice(flags.frontend),
|
||||
backend: () => getBackendFrameworkChoice(flags.backend),
|
||||
runtime: () => getRuntimeChoice(flags.runtime),
|
||||
runtime: ({ results }) =>
|
||||
getRuntimeChoice(flags.runtime, results.backend),
|
||||
database: () => getDatabaseChoice(flags.database),
|
||||
orm: ({ results }) =>
|
||||
getORMChoice(flags.orm, results.database !== "none", results.database),
|
||||
|
||||
@@ -27,7 +27,8 @@ export async function getFrontendChoice(
|
||||
(f) =>
|
||||
f === "tanstack-router" ||
|
||||
f === "react-router" ||
|
||||
f === "tanstack-start",
|
||||
f === "tanstack-start" ||
|
||||
f === "next",
|
||||
)
|
||||
? ["web"]
|
||||
: [],
|
||||
@@ -54,6 +55,11 @@ export async function getFrontendChoice(
|
||||
label: "React Router",
|
||||
hint: "A user‑obsessed, standards‑focused, multi‑strategy router",
|
||||
},
|
||||
{
|
||||
value: "next",
|
||||
label: "Next.js",
|
||||
hint: "The React Framework for the Web",
|
||||
},
|
||||
{
|
||||
value: "tanstack-start",
|
||||
label: "TanStack Start (beta)",
|
||||
@@ -65,7 +71,8 @@ export async function getFrontendChoice(
|
||||
(f) =>
|
||||
f === "tanstack-router" ||
|
||||
f === "react-router" ||
|
||||
f === "tanstack-start",
|
||||
f === "tanstack-start" ||
|
||||
f === "next",
|
||||
) || "tanstack-router",
|
||||
});
|
||||
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
import { cancel, isCancel, select } from "@clack/prompts";
|
||||
import pc from "picocolors";
|
||||
import { DEFAULT_CONFIG } from "../constants";
|
||||
import type { ProjectRuntime } from "../types";
|
||||
import type { ProjectBackend, ProjectRuntime } from "../types";
|
||||
|
||||
export async function getRuntimeChoice(
|
||||
runtime?: ProjectRuntime,
|
||||
backend?: ProjectBackend,
|
||||
): Promise<ProjectRuntime> {
|
||||
if (runtime !== undefined) return runtime;
|
||||
|
||||
if (backend === "next") {
|
||||
return "node";
|
||||
}
|
||||
|
||||
const response = await select<ProjectRuntime>({
|
||||
message: "Select runtime",
|
||||
options: [
|
||||
|
||||
Reference in New Issue
Block a user