mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
make backend optional
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { cancel, isCancel, log, select } from "@clack/prompts";
|
||||
import { cancel, isCancel, select } from "@clack/prompts";
|
||||
import pc from "picocolors";
|
||||
import { DEFAULT_CONFIG } from "../constants";
|
||||
import type { ProjectApi, ProjectBackend, ProjectFrontend } from "../types";
|
||||
@@ -8,7 +8,7 @@ export async function getApiChoice(
|
||||
frontend?: ProjectFrontend[],
|
||||
backend?: ProjectBackend,
|
||||
): Promise<ProjectApi> {
|
||||
if (backend === "convex") {
|
||||
if (backend === "convex" || backend === "none") {
|
||||
return "none";
|
||||
}
|
||||
|
||||
|
||||
@@ -48,6 +48,13 @@ export async function getBackendFrameworkChoice(
|
||||
});
|
||||
}
|
||||
|
||||
// Add "None" option
|
||||
backendOptions.push({
|
||||
value: "none" as const,
|
||||
label: "None",
|
||||
hint: "No backend server (e.g., for a static site or client-only app)",
|
||||
});
|
||||
|
||||
let initialValue = DEFAULT_CONFIG.backend;
|
||||
if (hasIncompatibleFrontend && initialValue === "convex") {
|
||||
initialValue = "hono";
|
||||
|
||||
@@ -106,6 +106,16 @@ export async function gatherConfig(
|
||||
result.dbSetup = "none";
|
||||
}
|
||||
|
||||
if (result.backend === "none") {
|
||||
result.runtime = "none";
|
||||
result.database = "none";
|
||||
result.orm = "none";
|
||||
result.api = "none";
|
||||
result.auth = false;
|
||||
result.dbSetup = "none";
|
||||
result.examples = [];
|
||||
}
|
||||
|
||||
return {
|
||||
projectName: projectName,
|
||||
projectDir: projectDir,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { cancel, isCancel, log, select } from "@clack/prompts";
|
||||
import { cancel, isCancel, select } from "@clack/prompts";
|
||||
import pc from "picocolors";
|
||||
import { DEFAULT_CONFIG } from "../constants";
|
||||
import type { ProjectBackend, ProjectDatabase } from "../types";
|
||||
@@ -7,7 +7,7 @@ export async function getDatabaseChoice(
|
||||
database?: ProjectDatabase,
|
||||
backend?: ProjectBackend,
|
||||
): Promise<ProjectDatabase> {
|
||||
if (backend === "convex") {
|
||||
if (backend === "convex" || backend === "none") {
|
||||
return "none";
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { cancel, isCancel, log, multiselect } from "@clack/prompts";
|
||||
import { cancel, isCancel, multiselect } from "@clack/prompts";
|
||||
import pc from "picocolors";
|
||||
import { DEFAULT_CONFIG } from "../constants";
|
||||
import type {
|
||||
@@ -20,6 +20,10 @@ export async function getExamplesChoice(
|
||||
return ["todo"];
|
||||
}
|
||||
|
||||
if (backend === "none") {
|
||||
return [];
|
||||
}
|
||||
|
||||
if (database === "none") return [];
|
||||
|
||||
const onlyNative =
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { cancel, isCancel, log, select } from "@clack/prompts";
|
||||
import { cancel, isCancel, select } from "@clack/prompts";
|
||||
import pc from "picocolors";
|
||||
import { DEFAULT_CONFIG } from "../constants";
|
||||
import type { ProjectBackend, ProjectRuntime } from "../types";
|
||||
@@ -7,7 +7,7 @@ export async function getRuntimeChoice(
|
||||
runtime?: ProjectRuntime,
|
||||
backend?: ProjectBackend,
|
||||
): Promise<ProjectRuntime> {
|
||||
if (backend === "convex") {
|
||||
if (backend === "convex" || backend === "none") {
|
||||
return "none";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user