fix(cli): only prompt server deploy for hono+workers and restrict to wrangler/alchemy

This commit is contained in:
Aman Varshney
2025-08-21 18:30:59 +05:30
parent 934419d259
commit 32919df73c
3 changed files with 40 additions and 18 deletions

View File

@@ -49,19 +49,19 @@ export async function getServerDeploymentChoice(
const options: DeploymentOption[] = []; const options: DeploymentOption[] = [];
if (runtime === "workers") { if (runtime !== "workers") {
["alchemy", "wrangler"].forEach((deploy) => { return "none";
const { label, hint } = getDeploymentDisplay(deploy as ServerDeploy);
options.unshift({
value: deploy as ServerDeploy,
label,
hint,
});
});
} else {
options.push({ value: "none", label: "None", hint: "Manual setup" });
} }
["alchemy", "wrangler"].forEach((deploy) => {
const { label, hint } = getDeploymentDisplay(deploy as ServerDeploy);
options.unshift({
value: deploy as ServerDeploy,
label,
hint,
});
});
const response = await select<ServerDeploy>({ const response = await select<ServerDeploy>({
message: "Select server deployment", message: "Select server deployment",
options, options,
@@ -114,11 +114,6 @@ export async function getServerDeploymentToAdd(
} }
if (options.length > 0) { if (options.length > 0) {
options.push({
value: "none",
label: "None",
hint: "Skip deployment setup",
});
} }
if (options.length === 0) { if (options.length === 0) {

View File

@@ -283,6 +283,12 @@ export function validateFullConfig(
validateWorkersCompatibility(providedFlags, options, config); validateWorkersCompatibility(providedFlags, options, config);
if (config.runtime === "workers" && config.serverDeploy === "none") {
exitWithError(
"Cloudflare Workers runtime requires a server deployment. Please choose 'wrangler' or 'alchemy' for --server-deploy.",
);
}
if (config.addons && config.addons.length > 0) { if (config.addons && config.addons.length > 0) {
validateAddonsAgainstFrontends(config.addons, config.frontend); validateAddonsAgainstFrontends(config.addons, config.frontend);
config.addons = [...new Set(config.addons)]; config.addons = [...new Set(config.addons)];

View File

@@ -164,6 +164,7 @@ function TechIcon({
return ( return (
<Image <Image
suppressHydrationWarning
src={iconSrc} src={iconSrc}
alt={`${name} icon`} alt={`${name} icon`}
width={20} width={20}
@@ -636,6 +637,21 @@ const analyzeStackCompatibility = (stack: StackState): CompatibilityResult => {
}); });
} }
// Workers runtime requires a server deployment (wrangler or alchemy)
if (nextStack.serverDeploy === "none") {
notes.serverDeploy.notes.push(
"Cloudflare Workers runtime requires a server deployment. Wrangler will be selected.",
);
notes.serverDeploy.hasIssue = true;
nextStack.serverDeploy = "wrangler";
changed = true;
changes.push({
category: "serverDeploy",
message:
"Server deployment set to 'Wrangler' (required by Cloudflare Workers)",
});
}
if (nextStack.orm !== "drizzle" && nextStack.orm !== "none") { if (nextStack.orm !== "drizzle" && nextStack.orm !== "none") {
notes.runtime.notes.push( notes.runtime.notes.push(
"Cloudflare Workers runtime requires Drizzle ORM or no ORM. Drizzle will be selected.", "Cloudflare Workers runtime requires Drizzle ORM or no ORM. Drizzle will be selected.",
@@ -681,7 +697,6 @@ const analyzeStackCompatibility = (stack: StackState): CompatibilityResult => {
notes.runtime.hasIssue = true; notes.runtime.hasIssue = true;
notes.dbSetup.hasIssue = true; notes.dbSetup.hasIssue = true;
nextStack.dbSetup = "d1"; nextStack.dbSetup = "d1";
changed = true;
changes.push({ changes.push({
category: "runtime", category: "runtime",
message: message:
@@ -1811,7 +1826,13 @@ const StackBuilder = () => {
TECH_OPTIONS[categoryKey as keyof typeof TECH_OPTIONS] || []; TECH_OPTIONS[categoryKey as keyof typeof TECH_OPTIONS] || [];
const categoryDisplayName = getCategoryDisplayName(categoryKey); const categoryDisplayName = getCategoryDisplayName(categoryKey);
const filteredOptions = categoryOptions.filter(() => { const filteredOptions = categoryOptions.filter((opt) => {
if (
categoryKey === "serverDeploy" &&
stack.runtime === "workers"
) {
return opt.id === "wrangler" || opt.id === "alchemy";
}
return true; return true;
}); });