From 234a10896d95785f7e3304d37bbf8c805450ba91 Mon Sep 17 00:00:00 2001 From: Aman Varshney Date: Thu, 21 Aug 2025 10:43:11 +0530 Subject: [PATCH] fix(cli): remove alchemy option when next, react router or hono is selected in prompts --- apps/cli/src/helpers/core/command-handlers.ts | 1 + apps/cli/src/prompts/server-deploy.ts | 9 +++++ apps/cli/src/prompts/web-deploy.ts | 37 +++++++++++++------ 3 files changed, 35 insertions(+), 12 deletions(-) diff --git a/apps/cli/src/helpers/core/command-handlers.ts b/apps/cli/src/helpers/core/command-handlers.ts index ae84d79..f6d59ce 100644 --- a/apps/cli/src/helpers/core/command-handlers.ts +++ b/apps/cli/src/helpers/core/command-handlers.ts @@ -307,6 +307,7 @@ export async function addAddonsHandler(input: AddInput) { const serverDeploymentPrompt = await getServerDeploymentToAdd( detectedConfig.runtime, detectedConfig.serverDeploy, + detectedConfig.backend, ); if (serverDeploymentPrompt !== "none") { diff --git a/apps/cli/src/prompts/server-deploy.ts b/apps/cli/src/prompts/server-deploy.ts index b5e2c25..cf6dd27 100644 --- a/apps/cli/src/prompts/server-deploy.ts +++ b/apps/cli/src/prompts/server-deploy.ts @@ -43,6 +43,10 @@ export async function getServerDeploymentChoice( return "none"; } + if (backend !== "hono") { + return "none"; + } + const options: DeploymentOption[] = []; if (runtime === "workers") { @@ -77,7 +81,12 @@ export async function getServerDeploymentChoice( export async function getServerDeploymentToAdd( runtime?: Runtime, existingDeployment?: ServerDeploy, + backend?: Backend, ): Promise { + if (backend !== "hono") { + return "none"; + } + const options: DeploymentOption[] = []; if (runtime === "workers") { diff --git a/apps/cli/src/prompts/web-deploy.ts b/apps/cli/src/prompts/web-deploy.ts index 0605aba..c112c47 100644 --- a/apps/cli/src/prompts/web-deploy.ts +++ b/apps/cli/src/prompts/web-deploy.ts @@ -47,21 +47,28 @@ export async function getDeploymentChoice( return "none"; } - const options: DeploymentOption[] = ["wrangler", "alchemy", "none"].map( - (deploy) => { - const { label, hint } = getDeploymentDisplay(deploy as WebDeploy); - return { - value: deploy as WebDeploy, - label, - hint, - }; - }, + const hasIncompatibleFrontend = frontend.some( + (f) => f === "next" || f === "react-router", ); + const availableDeployments = hasIncompatibleFrontend + ? ["wrangler", "none"] + : ["wrangler", "alchemy", "none"]; + + const options: DeploymentOption[] = availableDeployments.map((deploy) => { + const { label, hint } = getDeploymentDisplay(deploy as WebDeploy); + return { + value: deploy as WebDeploy, + label, + hint, + }; + }); const response = await select({ message: "Select web deployment", options, - initialValue: DEFAULT_CONFIG.webDeploy, + initialValue: hasIncompatibleFrontend + ? "wrangler" + : DEFAULT_CONFIG.webDeploy, }); if (isCancel(response)) return exitCancelled("Operation cancelled"); @@ -77,6 +84,10 @@ export async function getDeploymentToAdd( return "none"; } + const hasIncompatibleFrontend = frontend.some( + (f) => f === "next" || f === "react-router", + ); + const options: DeploymentOption[] = []; if (existingDeployment !== "wrangler") { @@ -88,7 +99,7 @@ export async function getDeploymentToAdd( }); } - if (existingDeployment !== "alchemy") { + if (existingDeployment !== "alchemy" && !hasIncompatibleFrontend) { const { label, hint } = getDeploymentDisplay("alchemy"); options.push({ value: "alchemy", @@ -116,7 +127,9 @@ export async function getDeploymentToAdd( const response = await select({ message: "Select web deployment", options, - initialValue: DEFAULT_CONFIG.webDeploy, + initialValue: hasIncompatibleFrontend + ? "wrangler" + : DEFAULT_CONFIG.webDeploy, }); if (isCancel(response)) return exitCancelled("Operation cancelled");