Skip to content

Commit a276add

Browse files
feat(cli): add openapi suppport in orpc (#563)
1 parent 50a1b94 commit a276add

File tree

15 files changed

+193
-24
lines changed

15 files changed

+193
-24
lines changed

apps/cli/src/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ export const dependencyVersionMap = {
112112

113113
"@orpc/server": "^1.8.6",
114114
"@orpc/client": "^1.8.6",
115+
"@orpc/openapi": "^1.8.6",
116+
"@orpc/zod": "^1.8.6",
115117
"@orpc/tanstack-query": "^1.8.6",
116118

117119
"@trpc/tanstack-react-query": "^11.5.0",

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,14 @@ function getApiDependencies(
5454
> = {};
5555

5656
if (api === "orpc") {
57-
deps.server = { dependencies: ["@orpc/server", "@orpc/client"] };
57+
deps.server = {
58+
dependencies: [
59+
"@orpc/server",
60+
"@orpc/client",
61+
"@orpc/openapi",
62+
"@orpc/zod",
63+
],
64+
};
5865
} else if (api === "trpc") {
5966
deps.server = { dependencies: ["@trpc/server", "@trpc/client"] };
6067
}

apps/cli/src/helpers/core/post-installation.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export async function displayPostInstallInstructions(
1414
config: ProjectConfig & { depsInstalled: boolean },
1515
) {
1616
const {
17+
api,
1718
database,
1819
relativePath,
1920
packageManager,
@@ -158,6 +159,14 @@ export async function displayPostInstallInstructions(
158159

159160
if (!isConvex) {
160161
output += `${pc.cyan("•")} Backend API: http://localhost:3000\n`;
162+
163+
if (api === "orpc") {
164+
if (backend === "next") {
165+
output += `${pc.cyan("•")} OpenAPI (Scalar UI): http://localhost:3000/rpc/api\n`;
166+
} else {
167+
output += `${pc.cyan("•")} OpenAPI (Scalar UI): http://localhost:3000/api\n`;
168+
}
169+
}
161170
}
162171

163172
if (addons?.includes("starlight")) {

apps/cli/src/helpers/deployment/alchemy/alchemy-next-setup.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ export async function setupNextAlchemyDeploy(
2525
...pkg.scripts,
2626
deploy: "alchemy deploy",
2727
destroy: "alchemy destroy",
28-
dev: "alchemy dev",
2928
};
3029
}
3130
await fs.writeJson(pkgPath, pkg, { spaces: 2 });

apps/cli/src/helpers/deployment/alchemy/alchemy-nuxt-setup.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ export async function setupNuxtAlchemyDeploy(
2626
...pkg.scripts,
2727
deploy: "alchemy deploy",
2828
destroy: "alchemy destroy",
29-
dev: "alchemy dev",
3029
};
3130
}
3231
await fs.writeJson(pkgPath, pkg, { spaces: 2 });

apps/cli/src/helpers/deployment/alchemy/alchemy-react-router-setup.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ export async function setupReactRouterAlchemyDeploy(
2525
...pkg.scripts,
2626
deploy: "alchemy deploy",
2727
destroy: "alchemy destroy",
28-
dev: "alchemy dev",
2928
};
3029
}
3130
await fs.writeJson(pkgPath, pkg, { spaces: 2 });

apps/cli/src/helpers/deployment/alchemy/alchemy-solid-setup.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ export async function setupSolidAlchemyDeploy(
2525
...pkg.scripts,
2626
deploy: "alchemy deploy",
2727
destroy: "alchemy destroy",
28-
dev: "alchemy dev",
2928
};
3029
}
3130
await fs.writeJson(pkgPath, pkg, { spaces: 2 });

apps/cli/src/helpers/deployment/alchemy/alchemy-svelte-setup.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ export async function setupSvelteAlchemyDeploy(
2626
...pkg.scripts,
2727
deploy: "alchemy deploy",
2828
destroy: "alchemy destroy",
29-
dev: "alchemy dev",
3029
};
3130
}
3231

apps/cli/src/helpers/deployment/alchemy/alchemy-tanstack-router-setup.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ export async function setupTanStackRouterAlchemyDeploy(
2525
...pkg.scripts,
2626
deploy: "alchemy deploy",
2727
destroy: "alchemy destroy",
28-
dev: "alchemy dev",
2928
};
3029
}
3130

apps/cli/src/helpers/deployment/alchemy/alchemy-tanstack-start-setup.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ export async function setupTanStackStartAlchemyDeploy(
2626
...pkg.scripts,
2727
deploy: "alchemy deploy",
2828
destroy: "alchemy destroy",
29-
dev: "alchemy dev",
3029
};
3130
}
3231

0 commit comments

Comments
 (0)