feat(cli): add alchemy and improve cli tooling and structure (#520)

This commit is contained in:
Aman Varshney
2025-08-20 23:43:58 +05:30
committed by GitHub
parent c5430ae4fd
commit 5788876c47
152 changed files with 5804 additions and 2264 deletions

View File

@@ -1,9 +1,11 @@
import type {
Addons,
API,
Backend,
CLIInput,
Frontend,
ProjectConfig,
ServerDeploy,
WebDeploy,
} from "../types";
import { validateAddonCompatibility } from "./addon-compatibility";
@@ -252,6 +254,21 @@ export function validateWebDeployRequiresWebFrontend(
}
}
export function validateServerDeployRequiresBackend(
serverDeploy: ServerDeploy | undefined,
backend: Backend | undefined,
) {
if (
serverDeploy &&
serverDeploy !== "none" &&
(!backend || backend === "none")
) {
exitWithError(
"'--server-deploy' requires a backend. Please select a backend or set '--server-deploy none'.",
);
}
}
export function validateAddonsAgainstFrontends(
addons: Addons[] = [],
frontends: Frontend[] = [],
@@ -297,3 +314,31 @@ export function validateExamplesCompatibility(
);
}
}
export function validateAlchemyCompatibility(
webDeploy: WebDeploy | undefined,
serverDeploy: ServerDeploy | undefined,
frontends: Frontend[] = [],
) {
const isAlchemyWebDeploy = webDeploy === "alchemy";
const isAlchemyServerDeploy = serverDeploy === "alchemy";
if (isAlchemyWebDeploy || isAlchemyServerDeploy) {
const incompatibleFrontends = frontends.filter(
(f) => f === "next" || f === "react-router",
);
if (incompatibleFrontends.length > 0) {
const deployType =
isAlchemyWebDeploy && isAlchemyServerDeploy
? "web and server deployment"
: isAlchemyWebDeploy
? "web deployment"
: "server deployment";
exitWithError(
`Alchemy ${deployType} is temporarily not compatible with ${incompatibleFrontends.join(" and ")} frontend(s). Please choose a different frontend or deployment option.`,
);
}
}
}