mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
Prevent web-deploy when no web frontend is selected
This commit is contained in:
@@ -16,6 +16,7 @@ import {
|
||||
type Runtime,
|
||||
type WebDeploy,
|
||||
} from "./types";
|
||||
import { WEB_FRAMEWORKS } from "./constants";
|
||||
|
||||
export function processAndValidateFlags(
|
||||
options: CLIInput,
|
||||
@@ -125,15 +126,8 @@ export function processAndValidateFlags(
|
||||
const validOptions = options.frontend.filter(
|
||||
(f): f is Frontend => f !== "none",
|
||||
);
|
||||
const webFrontends = validOptions.filter(
|
||||
(f) =>
|
||||
f === "tanstack-router" ||
|
||||
f === "react-router" ||
|
||||
f === "tanstack-start" ||
|
||||
f === "next" ||
|
||||
f === "nuxt" ||
|
||||
f === "svelte" ||
|
||||
f === "solid",
|
||||
const webFrontends = validOptions.filter((f) =>
|
||||
WEB_FRAMEWORKS.includes(f),
|
||||
);
|
||||
const nativeFrontends = validOptions.filter(
|
||||
(f) => f === "native-nativewind" || f === "native-unistyles",
|
||||
@@ -451,6 +445,16 @@ export function processAndValidateFlags(
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const hasWebFrontendFlag = (config.frontend ?? []).some((f) =>
|
||||
WEB_FRAMEWORKS.includes(f),
|
||||
);
|
||||
if (config.webDeploy && config.webDeploy !== "none" && !hasWebFrontendFlag) {
|
||||
consola.fatal(
|
||||
"'--web-deploy' requires a web frontend. Please select a web frontend or set '--web-deploy none'.",
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user