Skip to content

Commit ae85e34

Browse files
fix(cli): add missing deps in api package
1 parent 202bad2 commit ae85e34

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

apps/cli/src/helpers/core/api-setup.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ function getFrontendType(frontend: Frontend[]): {
4747
function getApiDependencies(
4848
api: string,
4949
frontendType: ReturnType<typeof getFrontendType>,
50+
backend: string,
5051
) {
5152
const deps: Record<
5253
string,
@@ -66,6 +67,18 @@ function getApiDependencies(
6667
deps.server = { dependencies: ["@trpc/server", "@trpc/client"] };
6768
}
6869

70+
if (backend !== "self" && backend !== "convex" && backend !== "none") {
71+
if (!deps.server) {
72+
deps.server = { dependencies: [] };
73+
}
74+
75+
if (backend === "hono") {
76+
deps.server.dependencies.push("hono");
77+
} else if (backend === "elysia") {
78+
deps.server.dependencies.push("elysia");
79+
}
80+
}
81+
6982
if (frontendType.hasReactWeb) {
7083
if (api === "orpc") {
7184
deps.web = {
@@ -216,7 +229,7 @@ export async function setupApi(config: ProjectConfig) {
216229
const frontendType = getFrontendType(frontend);
217230

218231
if (!isConvex && api !== "none") {
219-
const apiDeps = getApiDependencies(api, frontendType);
232+
const apiDeps = getApiDependencies(api, frontendType, backend);
220233
const apiPackageDir = path.join(projectDir, "packages/api");
221234

222235
if (apiDeps.server) {

0 commit comments

Comments
 (0)