Skip to content

Commit 32919df

Browse files
fix(cli): only prompt server deploy for hono+workers and restrict to wrangler/alchemy
1 parent 934419d commit 32919df

File tree

3 files changed

+40
-18
lines changed

3 files changed

+40
-18
lines changed

apps/cli/src/prompts/server-deploy.ts

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,19 @@ export async function getServerDeploymentChoice(
4949

5050
const options: DeploymentOption[] = [];
5151

52-
if (runtime === "workers") {
53-
["alchemy", "wrangler"].forEach((deploy) => {
54-
const { label, hint } = getDeploymentDisplay(deploy as ServerDeploy);
55-
options.unshift({
56-
value: deploy as ServerDeploy,
57-
label,
58-
hint,
59-
});
60-
});
61-
} else {
62-
options.push({ value: "none", label: "None", hint: "Manual setup" });
52+
if (runtime !== "workers") {
53+
return "none";
6354
}
6455

56+
["alchemy", "wrangler"].forEach((deploy) => {
57+
const { label, hint } = getDeploymentDisplay(deploy as ServerDeploy);
58+
options.unshift({
59+
value: deploy as ServerDeploy,
60+
label,
61+
hint,
62+
});
63+
});
64+
6565
const response = await select<ServerDeploy>({
6666
message: "Select server deployment",
6767
options,
@@ -114,11 +114,6 @@ export async function getServerDeploymentToAdd(
114114
}
115115

116116
if (options.length > 0) {
117-
options.push({
118-
value: "none",
119-
label: "None",
120-
hint: "Skip deployment setup",
121-
});
122117
}
123118

124119
if (options.length === 0) {

apps/cli/src/utils/config-validation.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,12 @@ export function validateFullConfig(
283283

284284
validateWorkersCompatibility(providedFlags, options, config);
285285

286+
if (config.runtime === "workers" && config.serverDeploy === "none") {
287+
exitWithError(
288+
"Cloudflare Workers runtime requires a server deployment. Please choose 'wrangler' or 'alchemy' for --server-deploy.",
289+
);
290+
}
291+
286292
if (config.addons && config.addons.length > 0) {
287293
validateAddonsAgainstFrontends(config.addons, config.frontend);
288294
config.addons = [...new Set(config.addons)];

apps/web/src/app/(home)/_components/stack-builder.tsx

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ function TechIcon({
164164

165165
return (
166166
<Image
167+
suppressHydrationWarning
167168
src={iconSrc}
168169
alt={`${name} icon`}
169170
width={20}
@@ -636,6 +637,21 @@ const analyzeStackCompatibility = (stack: StackState): CompatibilityResult => {
636637
});
637638
}
638639

640+
// Workers runtime requires a server deployment (wrangler or alchemy)
641+
if (nextStack.serverDeploy === "none") {
642+
notes.serverDeploy.notes.push(
643+
"Cloudflare Workers runtime requires a server deployment. Wrangler will be selected.",
644+
);
645+
notes.serverDeploy.hasIssue = true;
646+
nextStack.serverDeploy = "wrangler";
647+
changed = true;
648+
changes.push({
649+
category: "serverDeploy",
650+
message:
651+
"Server deployment set to 'Wrangler' (required by Cloudflare Workers)",
652+
});
653+
}
654+
639655
if (nextStack.orm !== "drizzle" && nextStack.orm !== "none") {
640656
notes.runtime.notes.push(
641657
"Cloudflare Workers runtime requires Drizzle ORM or no ORM. Drizzle will be selected.",
@@ -681,7 +697,6 @@ const analyzeStackCompatibility = (stack: StackState): CompatibilityResult => {
681697
notes.runtime.hasIssue = true;
682698
notes.dbSetup.hasIssue = true;
683699
nextStack.dbSetup = "d1";
684-
changed = true;
685700
changes.push({
686701
category: "runtime",
687702
message:
@@ -1811,7 +1826,13 @@ const StackBuilder = () => {
18111826
TECH_OPTIONS[categoryKey as keyof typeof TECH_OPTIONS] || [];
18121827
const categoryDisplayName = getCategoryDisplayName(categoryKey);
18131828

1814-
const filteredOptions = categoryOptions.filter(() => {
1829+
const filteredOptions = categoryOptions.filter((opt) => {
1830+
if (
1831+
categoryKey === "serverDeploy" &&
1832+
stack.runtime === "workers"
1833+
) {
1834+
return opt.id === "wrangler" || opt.id === "alchemy";
1835+
}
18151836
return true;
18161837
});
18171838

0 commit comments

Comments
 (0)