create-prisma 0.5.1 → 0.6.0-pr.45.137.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -7
- package/dist/cli.mjs +1 -1
- package/dist/{create-QmR9Scj8.mjs → create-CfH942dA.mjs} +86 -52
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
- package/templates/create/astro/README.md.hbs +2 -1
- package/templates/create/astro/prisma.compute.ts.hbs +9 -0
- package/templates/create/elysia/README.md.hbs +2 -2
- package/templates/create/elysia/prisma.compute.ts.hbs +11 -0
- package/templates/create/hono/README.md.hbs +2 -2
- package/templates/create/hono/prisma.compute.ts.hbs +10 -0
- package/templates/create/next/README.md.hbs +2 -1
- package/templates/create/next/prisma.compute.ts.hbs +9 -0
- package/templates/create/nuxt/README.md.hbs +2 -1
- package/templates/create/nuxt/prisma.compute.ts.hbs +9 -0
- package/templates/create/tanstack-start/README.md.hbs +2 -1
- package/templates/create/tanstack-start/prisma.compute.ts.hbs +9 -0
- package/templates/create/turborepo/README.md.hbs +4 -2
- package/templates/create/turborepo/apps/api/package.json.hbs +2 -2
- package/templates/create/turborepo/apps/api/src/index.ts.hbs +4 -0
- package/templates/create/turborepo/pnpm-workspace.yaml +3 -0
- package/templates/create/turborepo/prisma.compute.ts.hbs +14 -0
package/README.md
CHANGED
|
@@ -8,10 +8,10 @@ Scaffold a new app with Prisma already wired up.
|
|
|
8
8
|
|
|
9
9
|
- creates a new app from a supported template
|
|
10
10
|
- adds Prisma 7 dependencies for your database
|
|
11
|
-
- scaffolds `prisma/schema.prisma`, `prisma/seed.ts`,
|
|
11
|
+
- scaffolds `prisma/schema.prisma`, `prisma/seed.ts`, `prisma.config.ts`, and Compute deploy defaults for Compute-ready templates
|
|
12
12
|
- writes a Prisma client singleton in the right place for the selected template
|
|
13
13
|
- adds `db:generate`, `db:migrate`, and `db:seed` scripts
|
|
14
|
-
- creates or updates
|
|
14
|
+
- creates or updates the template env file with `DATABASE_URL`
|
|
15
15
|
- can install dependencies and run `prisma generate` for you
|
|
16
16
|
- can deploy the finished app to Prisma Compute and return a live URL
|
|
17
17
|
|
|
@@ -83,7 +83,7 @@ Deploy a supported app to Prisma Compute:
|
|
|
83
83
|
create-prisma --name my-api --template hono --provider postgresql --deploy
|
|
84
84
|
```
|
|
85
85
|
|
|
86
|
-
With PostgreSQL
|
|
86
|
+
With PostgreSQL and no `--database-url`, the Compute flow asks whether to use Prisma Postgres. If accepted, or if `--prisma-postgres` is passed, it creates a Prisma Compute project, creates a `main` Prisma Postgres database on the `main` branch, writes `DATABASE_URL` to the template env file, and deploys the app with the env file configured in `prisma.compute.ts`. Pass `--no-prisma-postgres` to deploy without provisioning a database.
|
|
87
87
|
|
|
88
88
|
## Supported Templates
|
|
89
89
|
|
|
@@ -102,7 +102,10 @@ Prisma Compute deployment is currently supported for:
|
|
|
102
102
|
- `hono`
|
|
103
103
|
- `elysia`
|
|
104
104
|
- `next`
|
|
105
|
+
- `astro`
|
|
106
|
+
- `nuxt`
|
|
105
107
|
- `tanstack-start`
|
|
108
|
+
- `turborepo`
|
|
106
109
|
|
|
107
110
|
## Supported Databases
|
|
108
111
|
|
|
@@ -149,17 +152,17 @@ When Prisma Compute deploy is selected, the skills add-on recommends the `prisma
|
|
|
149
152
|
|
|
150
153
|
## Deploy to Prisma Compute
|
|
151
154
|
|
|
152
|
-
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`,
|
|
155
|
+
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`.
|
|
153
156
|
|
|
154
|
-
Accept the prompt
|
|
157
|
+
Accept the deploy prompt when it appears, or pass the flag:
|
|
155
158
|
|
|
156
159
|
```bash
|
|
157
160
|
create-prisma --name my-api --template hono --provider postgresql --deploy
|
|
158
161
|
```
|
|
159
162
|
|
|
160
|
-
The deploy step signs you in with the Prisma CLI if you are not signed in yet. With PostgreSQL
|
|
163
|
+
The deploy step signs you in with the Prisma CLI if you are not signed in yet. With PostgreSQL and no `--database-url`, create-prisma asks whether to use Prisma Postgres. If accepted, or if `--prisma-postgres` is passed, setup creates a Prisma Compute project, creates a `main` Prisma Postgres database on the `main` branch, writes `DATABASE_URL` to the template env file, runs the requested Prisma setup, then deploys the app with the env file configured in `prisma.compute.ts`. Pass `--no-prisma-postgres` to deploy without provisioning a database.
|
|
161
164
|
|
|
162
|
-
A `compute:deploy` script is added to the generated project so you can redeploy app changes later. That script
|
|
165
|
+
A `prisma.compute.ts` file is generated with the app framework, runtime port, target, and env-file defaults. When deployment is selected, a `compute:deploy` script is added to the generated project so you can redeploy app changes later. That script runs `@prisma/cli@latest app deploy` using `prisma.compute.ts`; it does not create a new project, create a new database, run migrations, or seed data.
|
|
163
166
|
|
|
164
167
|
The deploy prompt is skipped in `--yes` runs unless you pass `--deploy`. Browser sign-in may still need a person at the keyboard if no Prisma CLI session exists.
|
|
165
168
|
|
package/dist/cli.mjs
CHANGED
|
@@ -33,11 +33,21 @@ const dependencyVersionMap = {
|
|
|
33
33
|
"@prisma/adapter-libsql": "^7.8.0",
|
|
34
34
|
"@prisma/adapter-mariadb": "^7.8.0",
|
|
35
35
|
"@prisma/adapter-mssql": "^7.8.0",
|
|
36
|
+
"@prisma/compute-sdk": "latest",
|
|
36
37
|
"@types/node": "^24.3.0",
|
|
37
38
|
dotenv: "^17.2.3",
|
|
38
39
|
prisma: "^7.8.0",
|
|
39
40
|
tsx: "^4.21.0"
|
|
40
41
|
};
|
|
42
|
+
const computeConfigTemplates = new Set([
|
|
43
|
+
"hono",
|
|
44
|
+
"elysia",
|
|
45
|
+
"next",
|
|
46
|
+
"astro",
|
|
47
|
+
"nuxt",
|
|
48
|
+
"tanstack-start",
|
|
49
|
+
"turborepo"
|
|
50
|
+
]);
|
|
41
51
|
function getWorkspaceDependencyVersion(packageManager) {
|
|
42
52
|
return packageManager === "npm" ? "*" : "workspace:*";
|
|
43
53
|
}
|
|
@@ -58,10 +68,15 @@ function getCreateTemplateDependencies(template, packageManager) {
|
|
|
58
68
|
}
|
|
59
69
|
if (template === "turborepo") targets.push({
|
|
60
70
|
packageJsonPath: "apps/api/package.json",
|
|
61
|
-
dependencies: [],
|
|
71
|
+
dependencies: ["dotenv"],
|
|
62
72
|
devDependencies: ["tsx"],
|
|
63
73
|
customDependencies: { "@repo/db": getWorkspaceDependencyVersion(packageManager) }
|
|
64
74
|
});
|
|
75
|
+
if (computeConfigTemplates.has(template)) targets.push({
|
|
76
|
+
packageJsonPath: "package.json",
|
|
77
|
+
dependencies: [],
|
|
78
|
+
devDependencies: ["@prisma/compute-sdk"]
|
|
79
|
+
});
|
|
65
80
|
return targets;
|
|
66
81
|
}
|
|
67
82
|
|
|
@@ -149,7 +164,10 @@ const COMPUTE_DEPLOYABLE_TEMPLATES = new Set([
|
|
|
149
164
|
"hono",
|
|
150
165
|
"elysia",
|
|
151
166
|
"next",
|
|
152
|
-
"
|
|
167
|
+
"astro",
|
|
168
|
+
"nuxt",
|
|
169
|
+
"tanstack-start",
|
|
170
|
+
"turborepo"
|
|
153
171
|
]);
|
|
154
172
|
function isComputeDeployableTemplate(template) {
|
|
155
173
|
return COMPUTE_DEPLOYABLE_TEMPLATES.has(template);
|
|
@@ -313,19 +331,27 @@ function getInstallArgs(packageManager) {
|
|
|
313
331
|
args: ["install"]
|
|
314
332
|
};
|
|
315
333
|
}
|
|
316
|
-
function getPackageExecutionArgs(packageManager, commandArgs) {
|
|
334
|
+
function getPackageExecutionArgs(packageManager, commandArgs, options = {}) {
|
|
317
335
|
switch (packageManager) {
|
|
318
336
|
case "pnpm": return {
|
|
319
337
|
command: "pnpm",
|
|
320
|
-
args: [
|
|
338
|
+
args: [
|
|
339
|
+
...options.silent ? ["--silent"] : [],
|
|
340
|
+
"dlx",
|
|
341
|
+
...commandArgs
|
|
342
|
+
]
|
|
321
343
|
};
|
|
322
344
|
case "yarn": return {
|
|
323
345
|
command: "yarn",
|
|
324
|
-
args: [
|
|
346
|
+
args: [
|
|
347
|
+
"dlx",
|
|
348
|
+
...options.silent ? ["--quiet"] : [],
|
|
349
|
+
...commandArgs
|
|
350
|
+
]
|
|
325
351
|
};
|
|
326
352
|
case "bun": return {
|
|
327
353
|
command: "bunx",
|
|
328
|
-
args: [...commandArgs]
|
|
354
|
+
args: [...options.silent ? ["--silent"] : [], ...commandArgs]
|
|
329
355
|
};
|
|
330
356
|
case "deno": {
|
|
331
357
|
const [packageName, ...args] = commandArgs;
|
|
@@ -342,12 +368,12 @@ function getPackageExecutionArgs(packageManager, commandArgs) {
|
|
|
342
368
|
}
|
|
343
369
|
default: return {
|
|
344
370
|
command: "npx",
|
|
345
|
-
args: [...commandArgs]
|
|
371
|
+
args: [...options.silent ? ["--yes", "--no-update-notifier"] : [], ...commandArgs]
|
|
346
372
|
};
|
|
347
373
|
}
|
|
348
374
|
}
|
|
349
|
-
function getPackageExecutionCommand(packageManager, commandArgs) {
|
|
350
|
-
const execution = getPackageExecutionArgs(packageManager, commandArgs);
|
|
375
|
+
function getPackageExecutionCommand(packageManager, commandArgs, options = {}) {
|
|
376
|
+
const execution = getPackageExecutionArgs(packageManager, commandArgs, options);
|
|
351
377
|
return [execution.command, ...execution.args].join(" ");
|
|
352
378
|
}
|
|
353
379
|
function getPrismaCliArgs(packageManager, prismaArgs) {
|
|
@@ -361,6 +387,30 @@ function getPrismaCliArgs(packageManager, prismaArgs) {
|
|
|
361
387
|
...prismaArgs
|
|
362
388
|
]
|
|
363
389
|
};
|
|
390
|
+
if (packageManager === "bun") return {
|
|
391
|
+
command: "bun",
|
|
392
|
+
args: [
|
|
393
|
+
"--env-file=.env",
|
|
394
|
+
"./node_modules/.bin/prisma",
|
|
395
|
+
...prismaArgs
|
|
396
|
+
]
|
|
397
|
+
};
|
|
398
|
+
if (packageManager === "pnpm") return {
|
|
399
|
+
command: "pnpm",
|
|
400
|
+
args: [
|
|
401
|
+
"exec",
|
|
402
|
+
"prisma",
|
|
403
|
+
...prismaArgs
|
|
404
|
+
]
|
|
405
|
+
};
|
|
406
|
+
if (packageManager === "yarn") return {
|
|
407
|
+
command: "yarn",
|
|
408
|
+
args: [
|
|
409
|
+
"exec",
|
|
410
|
+
"prisma",
|
|
411
|
+
...prismaArgs
|
|
412
|
+
]
|
|
413
|
+
};
|
|
364
414
|
return getPackageExecutionArgs(packageManager, ["prisma", ...prismaArgs]);
|
|
365
415
|
}
|
|
366
416
|
function getPrismaCliCommand$1(packageManager, prismaArgs) {
|
|
@@ -804,7 +854,7 @@ async function promptForMigrateAndSeed() {
|
|
|
804
854
|
}
|
|
805
855
|
async function promptForPrismaPostgres() {
|
|
806
856
|
const shouldUsePrismaPostgres = await confirm({
|
|
807
|
-
message: "Use Prisma Postgres and
|
|
857
|
+
message: "Use Prisma Postgres and write DATABASE_URL automatically?",
|
|
808
858
|
initialValue: true
|
|
809
859
|
});
|
|
810
860
|
if (isCancel(shouldUsePrismaPostgres)) {
|
|
@@ -1723,17 +1773,13 @@ async function executeCreateAddonSetupContext(params) {
|
|
|
1723
1773
|
//#region src/tasks/deploy-to-compute.ts
|
|
1724
1774
|
const PRISMA_CLI_PACKAGE = "@prisma/cli@latest";
|
|
1725
1775
|
const DEPLOY_OPTIONS_BY_TEMPLATE = {
|
|
1726
|
-
hono: {
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
},
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
requiresExplicitFramework: true
|
|
1734
|
-
},
|
|
1735
|
-
next: { framework: "nextjs" },
|
|
1736
|
-
"tanstack-start": { framework: "tanstack-start" }
|
|
1776
|
+
hono: {},
|
|
1777
|
+
elysia: {},
|
|
1778
|
+
next: {},
|
|
1779
|
+
astro: {},
|
|
1780
|
+
nuxt: {},
|
|
1781
|
+
"tanstack-start": {},
|
|
1782
|
+
turborepo: { configTarget: "api" }
|
|
1737
1783
|
};
|
|
1738
1784
|
function getPrismaCliCommand(packageManager) {
|
|
1739
1785
|
return getPackageExecutionCommand(getPrismaCliExecutionPackageManager(packageManager), [PRISMA_CLI_PACKAGE]);
|
|
@@ -1743,25 +1789,24 @@ function getPrismaCliAppDeployCommand(packageManager) {
|
|
|
1743
1789
|
PRISMA_CLI_PACKAGE,
|
|
1744
1790
|
"app",
|
|
1745
1791
|
"deploy"
|
|
1746
|
-
]);
|
|
1792
|
+
], { silent: true });
|
|
1747
1793
|
}
|
|
1748
1794
|
function getComputeDeployScriptMap(context) {
|
|
1749
1795
|
const deployArgs = [
|
|
1796
|
+
...getComputeDeployTargetArgs(context),
|
|
1750
1797
|
"--prod",
|
|
1751
|
-
"--yes"
|
|
1752
|
-
"--env",
|
|
1753
|
-
".env",
|
|
1754
|
-
...getComputeDeployRuntimeArgs(context)
|
|
1798
|
+
"--yes"
|
|
1755
1799
|
];
|
|
1756
1800
|
const deployCommand = [getPrismaCliAppDeployCommand(context.packageManager), ...deployArgs].join(" ");
|
|
1757
1801
|
return { "compute:deploy": deployCommand };
|
|
1758
1802
|
}
|
|
1759
|
-
function
|
|
1760
|
-
return
|
|
1803
|
+
function getComputeDeployTargetArgs(context) {
|
|
1804
|
+
return context.configTarget ? [context.configTarget] : [];
|
|
1761
1805
|
}
|
|
1762
1806
|
function runPrismaCli(packageManager, args, options = {}) {
|
|
1763
|
-
const
|
|
1764
|
-
|
|
1807
|
+
const { silentPackageRunner, ...execaOptions } = options;
|
|
1808
|
+
const execution = getPackageExecutionArgs(getPrismaCliExecutionPackageManager(packageManager), [PRISMA_CLI_PACKAGE, ...args], { silent: silentPackageRunner });
|
|
1809
|
+
return execa(execution.command, execution.args, execaOptions);
|
|
1765
1810
|
}
|
|
1766
1811
|
function getPrismaCliExecutionPackageManager(packageManager) {
|
|
1767
1812
|
return packageManager === "deno" ? "npm" : packageManager;
|
|
@@ -1833,9 +1878,7 @@ async function collectComputeDeployContext(input, options) {
|
|
|
1833
1878
|
template: options.template,
|
|
1834
1879
|
packageManager: options.packageManager,
|
|
1835
1880
|
createProjectName: options.defaultServiceName,
|
|
1836
|
-
|
|
1837
|
-
httpPort: deployOptions.httpPort,
|
|
1838
|
-
requiresExplicitFramework: deployOptions.requiresExplicitFramework
|
|
1881
|
+
configTarget: deployOptions.configTarget
|
|
1839
1882
|
};
|
|
1840
1883
|
}
|
|
1841
1884
|
function redactSecrets(message) {
|
|
@@ -1871,7 +1914,8 @@ async function runPrismaCliJson(params) {
|
|
|
1871
1914
|
"ignore",
|
|
1872
1915
|
"pipe",
|
|
1873
1916
|
"pipe"
|
|
1874
|
-
]
|
|
1917
|
+
],
|
|
1918
|
+
silentPackageRunner: true
|
|
1875
1919
|
});
|
|
1876
1920
|
const parsed = parseJson(stdout);
|
|
1877
1921
|
if (!parsed) return {
|
|
@@ -1970,13 +2014,11 @@ async function executeComputeDeployContext(params) {
|
|
|
1970
2014
|
const args = [
|
|
1971
2015
|
"app",
|
|
1972
2016
|
"deploy",
|
|
2017
|
+
...getComputeDeployTargetArgs(params.context),
|
|
1973
2018
|
"--json",
|
|
1974
2019
|
"--yes",
|
|
1975
2020
|
"--prod",
|
|
1976
|
-
"--
|
|
1977
|
-
".env",
|
|
1978
|
-
...params.createProject === false ? [] : ["--create-project", params.context.createProjectName],
|
|
1979
|
-
...getComputeDeployRuntimeArgs(params.context)
|
|
2021
|
+
...params.createProject === false ? [] : ["--create-project", params.context.createProjectName]
|
|
1980
2022
|
];
|
|
1981
2023
|
const deployResult = await runPrismaCliJson({
|
|
1982
2024
|
packageManager: params.context.packageManager,
|
|
@@ -2002,21 +2044,12 @@ async function executeComputeDeployContext(params) {
|
|
|
2002
2044
|
|
|
2003
2045
|
//#endregion
|
|
2004
2046
|
//#region src/telemetry/client.ts
|
|
2005
|
-
const TELEMETRY_API_KEY = "
|
|
2047
|
+
const TELEMETRY_API_KEY = "";
|
|
2006
2048
|
const TELEMETRY_HOST = "https://us.i.posthog.com";
|
|
2007
2049
|
const TELEMETRY_CONFIG_FILE = "telemetry.json";
|
|
2008
2050
|
const UUID_V4_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
2009
|
-
function isTruthyEnvValue(value) {
|
|
2010
|
-
return [
|
|
2011
|
-
"1",
|
|
2012
|
-
"true",
|
|
2013
|
-
"yes",
|
|
2014
|
-
"on"
|
|
2015
|
-
].includes(String(value ?? "").trim().toLowerCase());
|
|
2016
|
-
}
|
|
2017
2051
|
function shouldDisableTelemetry() {
|
|
2018
|
-
|
|
2019
|
-
return process.env.CREATE_PRISMA_DISABLE_TELEMETRY !== void 0 || process.env.CREATE_PRISMA_TELEMETRY_DISABLED !== void 0 || process.env.DO_NOT_TRACK !== void 0;
|
|
2052
|
+
return true;
|
|
2020
2053
|
}
|
|
2021
2054
|
function getTelemetryConfigDir() {
|
|
2022
2055
|
if (process.platform === "darwin") return path.join(os.homedir(), "Library", "Application Support", "create-prisma");
|
|
@@ -2038,7 +2071,7 @@ async function getAnonymousId() {
|
|
|
2038
2071
|
}
|
|
2039
2072
|
function getCommonProperties() {
|
|
2040
2073
|
return {
|
|
2041
|
-
"cli-version": "0.
|
|
2074
|
+
"cli-version": "0.6.0-pr.45.137.1",
|
|
2042
2075
|
"node-version": process.version,
|
|
2043
2076
|
platform: process.platform,
|
|
2044
2077
|
arch: process.arch
|
|
@@ -2327,9 +2360,10 @@ async function collectCreateContext(input) {
|
|
|
2327
2360
|
defaultServiceName: projectPackageName
|
|
2328
2361
|
});
|
|
2329
2362
|
if (computeDeployContext === void 0) return;
|
|
2330
|
-
const
|
|
2331
|
-
const prismaSetupContext = await completePrismaSetupContext(input, prismaSetupInitialContext, { useComputePostgres: useComputeDatabase });
|
|
2363
|
+
const prismaSetupContext = await completePrismaSetupContext(input, prismaSetupInitialContext);
|
|
2332
2364
|
if (!prismaSetupContext) return;
|
|
2365
|
+
const useComputeDatabase = Boolean(computeDeployContext && prismaSetupContext.shouldUsePrismaPostgres);
|
|
2366
|
+
if (useComputeDatabase) log.info("Prisma Postgres selected: create-prisma will provision a database and write DATABASE_URL to the template env file before deploying.");
|
|
2333
2367
|
const addonSetupContext = await collectCreateAddonSetupContext(input, {
|
|
2334
2368
|
useDefaults,
|
|
2335
2369
|
provider: prismaSetupContext.databaseProvider,
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as DatabaseUrlSchema, i as DatabaseProviderSchema, n as CreateCommandInputSchema, o as PackageManagerSchema, r as CreateTemplateSchema, s as SchemaPresetSchema, t as runCreateCommand } from "./create-
|
|
2
|
+
import { a as DatabaseUrlSchema, i as DatabaseProviderSchema, n as CreateCommandInputSchema, o as PackageManagerSchema, r as CreateTemplateSchema, s as SchemaPresetSchema, t as runCreateCommand } from "./create-CfH942dA.mjs";
|
|
3
3
|
import { os } from "@orpc/server";
|
|
4
4
|
import { createCli } from "trpc-cli";
|
|
5
5
|
|
|
6
6
|
//#region src/index.ts
|
|
7
|
-
const CLI_VERSION = "0.
|
|
7
|
+
const CLI_VERSION = "0.6.0-pr.45.137.1";
|
|
8
8
|
const router = os.router({ create: os.meta({
|
|
9
9
|
description: "Create a new project with Prisma setup",
|
|
10
10
|
default: true,
|
package/package.json
CHANGED
|
@@ -21,6 +21,7 @@ Prisma setup is scaffolded automatically in:
|
|
|
21
21
|
- `src/lib/prisma.ts`
|
|
22
22
|
- `src/pages/api/users.ts`
|
|
23
23
|
- `prisma.config.ts`
|
|
24
|
+
- `prisma.compute.ts`
|
|
24
25
|
- `src/generated/prisma`
|
|
25
26
|
|
|
26
27
|
Database helper scripts are added to `package.json`:
|
|
@@ -40,7 +41,7 @@ The starter page keeps the official Astro minimal structure and points you to `p
|
|
|
40
41
|
|
|
41
42
|
## Prisma Compute
|
|
42
43
|
|
|
43
|
-
This project includes a Prisma Compute deploy script. Deploys load environment variables from `.env`; if setup created a Prisma Postgres database, its `DATABASE_URL` is already written there.
|
|
44
|
+
This project includes a Prisma Compute deploy script and deploy defaults in `prisma.compute.ts`. Deploys load environment variables from `.env`; if setup created a Prisma Postgres database, its `DATABASE_URL` is already written there.
|
|
44
45
|
|
|
45
46
|
After local changes, run `{{runScriptCommand packageManager "compute:deploy"}}` to redeploy.
|
|
46
47
|
{{/if}}
|
|
@@ -28,7 +28,7 @@ Generated by `create-prisma` with the Elysia template.
|
|
|
28
28
|
|
|
29
29
|
5. Use the Prisma client from `src/lib/prisma.ts`.
|
|
30
30
|
|
|
31
|
-
Generated Prisma files are written to `src/generated/prisma`.
|
|
31
|
+
Generated Prisma files are written to `src/generated/prisma`. Prisma Compute deploy defaults are written to `prisma.compute.ts`.
|
|
32
32
|
{{#if (eq schemaPreset "basic")}}
|
|
33
33
|
|
|
34
34
|
The template includes a basic `User` model, a sample `GET /users` endpoint, and seed data in `prisma/seed.ts`.
|
|
@@ -37,7 +37,7 @@ The template includes a basic `User` model, a sample `GET /users` endpoint, and
|
|
|
37
37
|
|
|
38
38
|
## Prisma Compute
|
|
39
39
|
|
|
40
|
-
This project includes a Prisma Compute deploy script. Deploys load environment variables from `.env`; if setup created a Prisma Postgres database, its `DATABASE_URL` is already written there.
|
|
40
|
+
This project includes a Prisma Compute deploy script and deploy defaults in `prisma.compute.ts`. Deploys load environment variables from `.env`; if setup created a Prisma Postgres database, its `DATABASE_URL` is already written there.
|
|
41
41
|
|
|
42
42
|
After local changes, run `{{runScriptCommand packageManager "compute:deploy"}}` to redeploy.
|
|
43
43
|
{{/if}}
|
|
@@ -28,7 +28,7 @@ Generated by `create-prisma` with the Hono template.
|
|
|
28
28
|
|
|
29
29
|
5. Use the Prisma client from `src/lib/prisma.ts`.
|
|
30
30
|
|
|
31
|
-
Generated Prisma files are written to `src/generated/prisma`.
|
|
31
|
+
Generated Prisma files are written to `src/generated/prisma`. Prisma Compute deploy defaults are written to `prisma.compute.ts`.
|
|
32
32
|
{{#if (eq schemaPreset "basic")}}
|
|
33
33
|
|
|
34
34
|
The template includes a basic `User` model, a sample `GET /users` endpoint, and seed data in `prisma/seed.ts`.
|
|
@@ -37,7 +37,7 @@ The template includes a basic `User` model, a sample `GET /users` endpoint, and
|
|
|
37
37
|
|
|
38
38
|
## Prisma Compute
|
|
39
39
|
|
|
40
|
-
This project includes a Prisma Compute deploy script. Deploys load environment variables from `.env`; if setup created a Prisma Postgres database, its `DATABASE_URL` is already written there.
|
|
40
|
+
This project includes a Prisma Compute deploy script and deploy defaults in `prisma.compute.ts`. Deploys load environment variables from `.env`; if setup created a Prisma Postgres database, its `DATABASE_URL` is already written there.
|
|
41
41
|
|
|
42
42
|
After local changes, run `{{runScriptCommand packageManager "compute:deploy"}}` to redeploy.
|
|
43
43
|
{{/if}}
|
|
@@ -19,6 +19,7 @@ Prisma setup is scaffolded automatically in:
|
|
|
19
19
|
- `prisma/seed.ts`
|
|
20
20
|
- `src/lib/prisma.ts`
|
|
21
21
|
- `prisma.config.ts`
|
|
22
|
+
- `prisma.compute.ts`
|
|
22
23
|
- `src/generated/prisma`
|
|
23
24
|
|
|
24
25
|
Database helper scripts are added to `package.json`:
|
|
@@ -35,7 +36,7 @@ The starter page in `src/app/page.tsx` reads from a basic `User` model so you ca
|
|
|
35
36
|
|
|
36
37
|
## Prisma Compute
|
|
37
38
|
|
|
38
|
-
This project includes a Prisma Compute deploy script. Deploys load environment variables from `.env`; if setup created a Prisma Postgres database, its `DATABASE_URL` is already written there.
|
|
39
|
+
This project includes a Prisma Compute deploy script and deploy defaults in `prisma.compute.ts`. Deploys load environment variables from `.env`; if setup created a Prisma Postgres database, its `DATABASE_URL` is already written there.
|
|
39
40
|
|
|
40
41
|
After local changes, run `{{runScriptCommand packageManager "compute:deploy"}}` to redeploy.
|
|
41
42
|
{{/if}}
|
|
@@ -21,6 +21,7 @@ Prisma setup is scaffolded automatically in:
|
|
|
21
21
|
- `server/utils/prisma.ts`
|
|
22
22
|
- `server/api/users.get.ts`
|
|
23
23
|
- `prisma.config.ts`
|
|
24
|
+
- `prisma.compute.ts`
|
|
24
25
|
- `server/generated/prisma`
|
|
25
26
|
|
|
26
27
|
Database helper scripts are added to `package.json`:
|
|
@@ -37,7 +38,7 @@ The starter page in `app/pages/index.vue` fetches seeded users from `server/api/
|
|
|
37
38
|
|
|
38
39
|
## Prisma Compute
|
|
39
40
|
|
|
40
|
-
This project includes a Prisma Compute deploy script. Deploys load environment variables from `.env`; if setup created a Prisma Postgres database, its `DATABASE_URL` is already written there.
|
|
41
|
+
This project includes a Prisma Compute deploy script and deploy defaults in `prisma.compute.ts`. Deploys load environment variables from `.env`; if setup created a Prisma Postgres database, its `DATABASE_URL` is already written there.
|
|
41
42
|
|
|
42
43
|
After local changes, run `{{runScriptCommand packageManager "compute:deploy"}}` to redeploy.
|
|
43
44
|
{{/if}}
|
|
@@ -20,6 +20,7 @@ Prisma setup is scaffolded automatically in:
|
|
|
20
20
|
- `prisma/seed.ts`
|
|
21
21
|
- `src/lib/prisma.server.ts`
|
|
22
22
|
- `prisma.config.ts`
|
|
23
|
+
- `prisma.compute.ts`
|
|
23
24
|
- `src/generated/prisma`
|
|
24
25
|
|
|
25
26
|
Database helper scripts are added to `package.json`:
|
|
@@ -36,7 +37,7 @@ The home route uses a TanStack Start server function to load users with the Pris
|
|
|
36
37
|
|
|
37
38
|
## Prisma Compute
|
|
38
39
|
|
|
39
|
-
This project includes a Prisma Compute deploy script. Deploys load environment variables from `.env`; if setup created a Prisma Postgres database, its `DATABASE_URL` is already written there.
|
|
40
|
+
This project includes a Prisma Compute deploy script and deploy defaults in `prisma.compute.ts`. Deploys load environment variables from `.env`; if setup created a Prisma Postgres database, its `DATABASE_URL` is already written there.
|
|
40
41
|
|
|
41
42
|
After local changes, run `{{runScriptCommand packageManager "compute:deploy"}}` to redeploy.
|
|
42
43
|
{{/if}}
|
|
@@ -6,6 +6,7 @@ Generated by `create-prisma` with the Turborepo template.
|
|
|
6
6
|
|
|
7
7
|
- `apps/api` - Hono API app
|
|
8
8
|
- `packages/db` - shared Prisma package
|
|
9
|
+
- `pnpm-workspace.yaml` - pnpm workspace package globs
|
|
9
10
|
|
|
10
11
|
## Scripts
|
|
11
12
|
|
|
@@ -16,7 +17,7 @@ Generated by `create-prisma` with the Turborepo template.
|
|
|
16
17
|
- `{{runScriptCommand packageManager "db:migrate"}}` - create/apply migrations in `packages/db`
|
|
17
18
|
- `{{runScriptCommand packageManager "db:seed"}}` - run seed script in `packages/db`
|
|
18
19
|
{{#if compute}}
|
|
19
|
-
- `{{runScriptCommand packageManager "compute:deploy"}}` - redeploy to Prisma Compute with environment variables from
|
|
20
|
+
- `{{runScriptCommand packageManager "compute:deploy"}}` - redeploy to Prisma Compute with environment variables from `packages/db/.env`
|
|
20
21
|
{{/if}}
|
|
21
22
|
|
|
22
23
|
## Prisma
|
|
@@ -27,6 +28,7 @@ Prisma is scaffolded inside `packages/db`:
|
|
|
27
28
|
- `packages/db/prisma/seed.ts`
|
|
28
29
|
- `packages/db/src/client.ts`
|
|
29
30
|
- `packages/db/prisma.config.ts`
|
|
31
|
+
- `prisma.compute.ts`
|
|
30
32
|
- `packages/db/src/generated/prisma`
|
|
31
33
|
|
|
32
34
|
`apps/api/src/index.ts` imports the shared Prisma client from `@repo/db`.
|
|
@@ -34,7 +36,7 @@ Prisma is scaffolded inside `packages/db`:
|
|
|
34
36
|
|
|
35
37
|
## Prisma Compute
|
|
36
38
|
|
|
37
|
-
This project includes a Prisma Compute deploy script. Deploys load environment variables from
|
|
39
|
+
This project includes a Prisma Compute deploy script and deploy defaults in `prisma.compute.ts`. Deploys load environment variables from `packages/db/.env`; if setup created a Prisma Postgres database, its `DATABASE_URL` is already written there.
|
|
38
40
|
|
|
39
41
|
After local changes, run `{{runScriptCommand packageManager "compute:deploy"}}` to redeploy.
|
|
40
42
|
{{/if}}
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
{{#if (eq packageManager "deno")}}
|
|
7
|
-
"dev": "deno run -A --env-file
|
|
7
|
+
"dev": "deno run -A --env-file=../../packages/db/.env --watch src/index.ts",
|
|
8
8
|
"build": "deno check src/index.ts",
|
|
9
|
-
"start": "deno run -A --env-file
|
|
9
|
+
"start": "deno run -A --env-file=../../packages/db/.env src/index.ts",
|
|
10
10
|
"typecheck": "deno check src/index.ts"
|
|
11
11
|
{{else}}
|
|
12
12
|
"dev": "tsx watch src/index.ts",
|
|
@@ -4,8 +4,12 @@ import "dotenv/config";
|
|
|
4
4
|
import { serve } from "@hono/node-server";
|
|
5
5
|
import { Hono } from "hono";
|
|
6
6
|
{{#if (eq schemaPreset "basic")}}
|
|
7
|
+
{{#if (eq packageManager "deno")}}
|
|
8
|
+
import { prisma } from "../../../packages/db/src/index.ts";
|
|
9
|
+
{{else}}
|
|
7
10
|
import { prisma } from "@repo/db";
|
|
8
11
|
{{/if}}
|
|
12
|
+
{{/if}}
|
|
9
13
|
|
|
10
14
|
const app = new Hono();
|
|
11
15
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { defineComputeConfig } from "@prisma/compute-sdk/config";
|
|
2
|
+
|
|
3
|
+
export default defineComputeConfig({
|
|
4
|
+
apps: {
|
|
5
|
+
api: {
|
|
6
|
+
name: "{{projectName}}",
|
|
7
|
+
root: "apps/api",
|
|
8
|
+
framework: "hono",
|
|
9
|
+
entry: "src/index.ts",
|
|
10
|
+
httpPort: 3000,
|
|
11
|
+
env: "packages/db/.env",
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
});
|