mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
fix(cli): remove alchemy option when next, react router or hono is selected in prompts
This commit is contained in:
@@ -307,6 +307,7 @@ export async function addAddonsHandler(input: AddInput) {
|
||||
const serverDeploymentPrompt = await getServerDeploymentToAdd(
|
||||
detectedConfig.runtime,
|
||||
detectedConfig.serverDeploy,
|
||||
detectedConfig.backend,
|
||||
);
|
||||
|
||||
if (serverDeploymentPrompt !== "none") {
|
||||
|
||||
@@ -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<ServerDeploy> {
|
||||
if (backend !== "hono") {
|
||||
return "none";
|
||||
}
|
||||
|
||||
const options: DeploymentOption[] = [];
|
||||
|
||||
if (runtime === "workers") {
|
||||
|
||||
@@ -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<WebDeploy>({
|
||||
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<WebDeploy>({
|
||||
message: "Select web deployment",
|
||||
options,
|
||||
initialValue: DEFAULT_CONFIG.webDeploy,
|
||||
initialValue: hasIncompatibleFrontend
|
||||
? "wrangler"
|
||||
: DEFAULT_CONFIG.webDeploy,
|
||||
});
|
||||
|
||||
if (isCancel(response)) return exitCancelled("Operation cancelled");
|
||||
|
||||
Reference in New Issue
Block a user