mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
add nuxt and expo with orpc
This commit is contained in:
@@ -9,7 +9,7 @@ export async function getApiChoice(
|
||||
): Promise<ProjectApi> {
|
||||
if (Api) return Api;
|
||||
|
||||
const includesNative = frontend?.includes("native");
|
||||
const includesNuxt = frontend?.includes("nuxt");
|
||||
|
||||
let apiOptions = [
|
||||
{
|
||||
@@ -24,12 +24,12 @@ export async function getApiChoice(
|
||||
},
|
||||
];
|
||||
|
||||
if (includesNative) {
|
||||
if (includesNuxt) {
|
||||
apiOptions = [
|
||||
{
|
||||
value: "trpc" as const,
|
||||
label: "tRPC",
|
||||
hint: "End-to-end typesafe APIs made easy (Required for Native frontend)",
|
||||
value: "orpc" as const,
|
||||
label: "oRPC",
|
||||
hint: "End-to-end type-safe APIs (Required for Nuxt frontend)",
|
||||
},
|
||||
];
|
||||
}
|
||||
@@ -37,7 +37,7 @@ export async function getApiChoice(
|
||||
const apiType = await select<ProjectApi>({
|
||||
message: "Select API type",
|
||||
options: apiOptions,
|
||||
initialValue: includesNative ? "trpc" : DEFAULT_CONFIG.api,
|
||||
initialValue: includesNuxt ? "orpc" : DEFAULT_CONFIG.api,
|
||||
});
|
||||
|
||||
if (isCancel(apiType)) {
|
||||
@@ -45,8 +45,8 @@ export async function getApiChoice(
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
if (includesNative && apiType !== "trpc") {
|
||||
return "trpc";
|
||||
if (includesNuxt && apiType !== "orpc") {
|
||||
return "orpc";
|
||||
}
|
||||
|
||||
return apiType;
|
||||
|
||||
@@ -2,7 +2,6 @@ import { cancel, isCancel, multiselect } from "@clack/prompts";
|
||||
import pc from "picocolors";
|
||||
import { DEFAULT_CONFIG } from "../constants";
|
||||
import type {
|
||||
ProjectApi,
|
||||
ProjectBackend,
|
||||
ProjectDatabase,
|
||||
ProjectExamples,
|
||||
@@ -22,46 +21,36 @@ export async function getExamplesChoice(
|
||||
const hasWebFrontend =
|
||||
frontends?.includes("react-router") ||
|
||||
frontends?.includes("tanstack-router") ||
|
||||
frontends?.includes("tanstack-start");
|
||||
frontends?.includes("tanstack-start") ||
|
||||
frontends?.includes("next") || // Added next
|
||||
frontends?.includes("nuxt"); // Added nuxt
|
||||
|
||||
if (!hasWebFrontend) return [];
|
||||
|
||||
let response: ProjectExamples[] | symbol = [];
|
||||
const options: { value: ProjectExamples; label: string; hint: string }[] = [
|
||||
{
|
||||
value: "todo" as const,
|
||||
label: "Todo App",
|
||||
hint: "A simple CRUD example app",
|
||||
},
|
||||
];
|
||||
|
||||
if (backend === "elysia") {
|
||||
response = await multiselect<ProjectExamples>({
|
||||
message: "Include examples",
|
||||
options: [
|
||||
{
|
||||
value: "todo",
|
||||
label: "Todo App",
|
||||
hint: "A simple CRUD example app",
|
||||
},
|
||||
],
|
||||
required: false,
|
||||
initialValues: DEFAULT_CONFIG.examples,
|
||||
// AI example is available for hono, express, next backends, and Nuxt (if backend is not elysia)
|
||||
if (backend !== "elysia") {
|
||||
options.push({
|
||||
value: "ai" as const,
|
||||
label: "AI Chat",
|
||||
hint: "A simple AI chat interface using AI SDK",
|
||||
});
|
||||
}
|
||||
|
||||
if (backend === "hono" || backend === "express") {
|
||||
response = await multiselect<ProjectExamples>({
|
||||
message: "Include examples",
|
||||
options: [
|
||||
{
|
||||
value: "todo",
|
||||
label: "Todo App",
|
||||
hint: "A simple CRUD example app",
|
||||
},
|
||||
{
|
||||
value: "ai",
|
||||
label: "AI Chat",
|
||||
hint: "A simple AI chat interface using AI SDK",
|
||||
},
|
||||
],
|
||||
required: false,
|
||||
initialValues: DEFAULT_CONFIG.examples,
|
||||
});
|
||||
}
|
||||
response = await multiselect<ProjectExamples>({
|
||||
message: "Include examples",
|
||||
options: options,
|
||||
required: false,
|
||||
initialValues: DEFAULT_CONFIG.examples,
|
||||
});
|
||||
|
||||
if (isCancel(response)) {
|
||||
cancel(pc.red("Operation cancelled"));
|
||||
|
||||
@@ -14,7 +14,7 @@ export async function getFrontendChoice(
|
||||
{
|
||||
value: "web",
|
||||
label: "Web",
|
||||
hint: "React Web Application",
|
||||
hint: "React or Vue Web Application",
|
||||
},
|
||||
{
|
||||
value: "native",
|
||||
@@ -28,7 +28,8 @@ export async function getFrontendChoice(
|
||||
f === "tanstack-router" ||
|
||||
f === "react-router" ||
|
||||
f === "tanstack-start" ||
|
||||
f === "next",
|
||||
f === "next" ||
|
||||
f === "nuxt",
|
||||
)
|
||||
? ["web"]
|
||||
: [],
|
||||
@@ -60,6 +61,11 @@ export async function getFrontendChoice(
|
||||
label: "Next.js",
|
||||
hint: "The React Framework for the Web",
|
||||
},
|
||||
{
|
||||
value: "nuxt",
|
||||
label: "Nuxt",
|
||||
hint: "The Progressive Web Framework for Vue.js",
|
||||
},
|
||||
{
|
||||
value: "tanstack-start",
|
||||
label: "TanStack Start (beta)",
|
||||
|
||||
Reference in New Issue
Block a user