Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ Prisma Compute deployment is currently supported for:

- `hono`
- `elysia`
- `nest`
- `next`
- `astro`
- `nuxt`
Expand Down Expand Up @@ -152,7 +153,7 @@ When Prisma Compute deploy is selected, the skills add-on recommends the `prisma

## Deploy to Prisma Compute

After scaffolding, `create-prisma` can deploy your app to [Prisma Compute](https://www.prisma.io/docs/compute), the serverless hosting for TypeScript apps that runs next to your Prisma Postgres database. It is offered for the templates the Prisma CLI can deploy today: `hono`, `elysia`, `next`, `astro`, `nuxt`, `tanstack-start`, and `turborepo`.
After scaffolding, `create-prisma` can deploy your app to [Prisma Compute](https://www.prisma.io/docs/compute), the serverless hosting for TypeScript apps that runs next to your Prisma Postgres database. It is offered for the templates the Prisma CLI can deploy today: `hono`, `elysia`, `nest`, `next`, `astro`, `nuxt`, `tanstack-start`, and `turborepo`.

Accept the deploy prompt when it appears, or pass the flag:

Expand Down
1 change: 1 addition & 0 deletions src/constants/dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export type CreateTemplateDependencyTarget = {
const computeConfigTemplates = new Set<CreateTemplate>([
"hono",
"elysia",
"nest",
"next",
"astro",
"nuxt",
Expand Down
1 change: 1 addition & 0 deletions src/tasks/deploy-to-compute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const DEPLOY_OPTIONS_BY_TEMPLATE: Partial<
> = {
hono: {},
elysia: {},
nest: {},
next: {},
astro: {},
nuxt: {},
Expand Down
1 change: 1 addition & 0 deletions src/templates/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ Handlebars.registerHelper(
sourceEntrypoint,
builtEntrypoint,
denoFlags: getOptionalHashStringList(hash, "denoFlags"),
emit: hash.emit === true,
});
},
);
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ export const CreateScaffoldOptionsSchema = z.object({
export const COMPUTE_DEPLOYABLE_TEMPLATES: ReadonlySet<CreateTemplate> = new Set<CreateTemplate>([
"hono",
"elysia",
"nest",
"next",
"astro",
"nuxt",
Expand Down
11 changes: 9 additions & 2 deletions src/utils/package-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ type RuntimeScriptOptions = {
sourceEntrypoint: string;
builtEntrypoint?: string;
denoFlags?: string[];
// When true, `build` compiles to `dist` instead of only type-checking.
// Templates that deploy a compiled artifact (e.g. NestJS) need this; bun and
// deno otherwise run TypeScript directly and skip emit.
emit?: boolean;
};

const packageManagerManifestValues = {
Expand Down Expand Up @@ -198,7 +202,7 @@ export function getRuntimeScriptCommand(
kind: RuntimeScriptKind,
options: RuntimeScriptOptions,
): string {
const { sourceEntrypoint, builtEntrypoint, denoFlags = [] } = options;
const { sourceEntrypoint, builtEntrypoint, denoFlags = [], emit = false } = options;

if (packageManager === "deno") {
switch (kind) {
Expand All @@ -213,6 +217,9 @@ export function getRuntimeScriptCommand(
sourceEntrypoint,
]);
case "build":
// Deno runs TypeScript directly; there is no node-style compiled
// artifact to emit here (the Deno nest variant uses Deno APIs and is
// not built for the node-based Compute runtime).
return `deno check ${sourceEntrypoint}`;
case "start":
return joinCommandParts([
Expand All @@ -231,7 +238,7 @@ export function getRuntimeScriptCommand(
case "dev":
return `bun --watch ${sourceEntrypoint}`;
case "build":
return "tsc --noEmit";
return emit ? "tsc" : "tsc --noEmit";
case "start":
return `bun ${sourceEntrypoint}`;
}
Expand Down
2 changes: 1 addition & 1 deletion templates/create/nest/package.json.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"type": "module",
"scripts": {
"dev": "{{runtimeScript packageManager "dev" "src/main.ts" "dist/main.js"}}",
"build": "{{runtimeScript packageManager "build" "src/main.ts" "dist/main.js"}}",
"build": "{{runtimeScript packageManager "build" "src/main.ts" "dist/main.js" emit=true}}",
"start": "{{runtimeScript packageManager "start" "src/main.ts" "dist/main.js"}}"
},
"dependencies": {
Expand Down
9 changes: 9 additions & 0 deletions templates/create/nest/prisma.compute.ts.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { defineComputeConfig } from "@prisma/compute-sdk/config";

export default defineComputeConfig({
app: {
name: "{{projectName}}",
framework: "nestjs",
env: ".env",
},
});
Loading