mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
feat(web): add shareable stack page (#556)
This commit is contained in:
@@ -123,25 +123,6 @@ export async function gatherConfig(
|
||||
},
|
||||
);
|
||||
|
||||
if (result.backend === "convex") {
|
||||
result.runtime = "none";
|
||||
result.database = "none";
|
||||
result.orm = "none";
|
||||
result.api = "none";
|
||||
result.dbSetup = "none";
|
||||
result.examples = ["todo"];
|
||||
}
|
||||
|
||||
if (result.backend === "none") {
|
||||
result.runtime = "none";
|
||||
result.database = "none";
|
||||
result.orm = "none";
|
||||
result.api = "none";
|
||||
result.auth = "none";
|
||||
result.dbSetup = "none";
|
||||
result.examples = [];
|
||||
}
|
||||
|
||||
return {
|
||||
projectName: projectName,
|
||||
projectDir: projectDir,
|
||||
|
||||
@@ -175,6 +175,116 @@ export function validateDatabaseSetup(
|
||||
}
|
||||
}
|
||||
|
||||
export function validateConvexConstraints(
|
||||
config: Partial<ProjectConfig>,
|
||||
providedFlags: Set<string>,
|
||||
): void {
|
||||
const { backend } = config;
|
||||
|
||||
if (backend !== "convex") {
|
||||
return;
|
||||
}
|
||||
|
||||
const has = (k: string) => providedFlags.has(k);
|
||||
|
||||
if (has("runtime") && config.runtime !== "none") {
|
||||
exitWithError(
|
||||
"Convex backend requires '--runtime none'. Please remove the --runtime flag or set it to 'none'.",
|
||||
);
|
||||
}
|
||||
|
||||
if (has("database") && config.database !== "none") {
|
||||
exitWithError(
|
||||
"Convex backend requires '--database none'. Please remove the --database flag or set it to 'none'.",
|
||||
);
|
||||
}
|
||||
|
||||
if (has("orm") && config.orm !== "none") {
|
||||
exitWithError(
|
||||
"Convex backend requires '--orm none'. Please remove the --orm flag or set it to 'none'.",
|
||||
);
|
||||
}
|
||||
|
||||
if (has("api") && config.api !== "none") {
|
||||
exitWithError(
|
||||
"Convex backend requires '--api none'. Please remove the --api flag or set it to 'none'.",
|
||||
);
|
||||
}
|
||||
|
||||
if (has("dbSetup") && config.dbSetup !== "none") {
|
||||
exitWithError(
|
||||
"Convex backend requires '--db-setup none'. Please remove the --db-setup flag or set it to 'none'.",
|
||||
);
|
||||
}
|
||||
|
||||
if (has("serverDeploy") && config.serverDeploy !== "none") {
|
||||
exitWithError(
|
||||
"Convex backend requires '--server-deploy none'. Please remove the --server-deploy flag or set it to 'none'.",
|
||||
);
|
||||
}
|
||||
|
||||
if (has("auth") && config.auth === "better-auth") {
|
||||
exitWithError(
|
||||
"Better-Auth is not compatible with Convex backend. Please use '--auth clerk' or '--auth none'.",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export function validateBackendNoneConstraints(
|
||||
config: Partial<ProjectConfig>,
|
||||
providedFlags: Set<string>,
|
||||
): void {
|
||||
const { backend } = config;
|
||||
|
||||
if (backend !== "none") {
|
||||
return;
|
||||
}
|
||||
|
||||
const has = (k: string) => providedFlags.has(k);
|
||||
|
||||
if (has("runtime") && config.runtime !== "none") {
|
||||
exitWithError(
|
||||
"Backend 'none' requires '--runtime none'. Please remove the --runtime flag or set it to 'none'.",
|
||||
);
|
||||
}
|
||||
|
||||
if (has("database") && config.database !== "none") {
|
||||
exitWithError(
|
||||
"Backend 'none' requires '--database none'. Please remove the --database flag or set it to 'none'.",
|
||||
);
|
||||
}
|
||||
|
||||
if (has("orm") && config.orm !== "none") {
|
||||
exitWithError(
|
||||
"Backend 'none' requires '--orm none'. Please remove the --orm flag or set it to 'none'.",
|
||||
);
|
||||
}
|
||||
|
||||
if (has("api") && config.api !== "none") {
|
||||
exitWithError(
|
||||
"Backend 'none' requires '--api none'. Please remove the --api flag or set it to 'none'.",
|
||||
);
|
||||
}
|
||||
|
||||
if (has("auth") && config.auth !== "none") {
|
||||
exitWithError(
|
||||
"Backend 'none' requires '--auth none'. Please remove the --auth flag or set it to 'none'.",
|
||||
);
|
||||
}
|
||||
|
||||
if (has("dbSetup") && config.dbSetup !== "none") {
|
||||
exitWithError(
|
||||
"Backend 'none' requires '--db-setup none'. Please remove the --db-setup flag or set it to 'none'.",
|
||||
);
|
||||
}
|
||||
|
||||
if (has("serverDeploy") && config.serverDeploy !== "none") {
|
||||
exitWithError(
|
||||
"Backend 'none' requires '--server-deploy none'. Please remove the --server-deploy flag or set it to 'none'.",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export function validateBackendConstraints(
|
||||
config: Partial<ProjectConfig>,
|
||||
providedFlags: Set<string>,
|
||||
@@ -201,16 +311,6 @@ export function validateBackendConstraints(
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
backend === "convex" &&
|
||||
config.auth === "better-auth" &&
|
||||
providedFlags.has("auth")
|
||||
) {
|
||||
exitWithError(
|
||||
"Better-Auth is not compatible with the Convex backend. Please use '--auth clerk' or '--auth none'.",
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
providedFlags.has("backend") &&
|
||||
backend &&
|
||||
@@ -287,6 +387,8 @@ export function validateFullConfig(
|
||||
validateDatabaseOrmAuth(config, providedFlags);
|
||||
validateDatabaseSetup(config, providedFlags);
|
||||
|
||||
validateConvexConstraints(config, providedFlags);
|
||||
validateBackendNoneConstraints(config, providedFlags);
|
||||
validateBackendConstraints(config, providedFlags, options);
|
||||
|
||||
validateFrontendConstraints(config, providedFlags);
|
||||
|
||||
Reference in New Issue
Block a user