create-prisma 0.5.1 → 0.6.0-pr.46.139.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-Jsa6sGYx.mjs} +87 -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/nest/prisma.compute.ts.hbs +9 -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
|
|
|
@@ -148,8 +163,12 @@ const CreateScaffoldOptionsSchema = z.object({
|
|
|
148
163
|
const COMPUTE_DEPLOYABLE_TEMPLATES = new Set([
|
|
149
164
|
"hono",
|
|
150
165
|
"elysia",
|
|
166
|
+
"nest",
|
|
151
167
|
"next",
|
|
152
|
-
"
|
|
168
|
+
"astro",
|
|
169
|
+
"nuxt",
|
|
170
|
+
"tanstack-start",
|
|
171
|
+
"turborepo"
|
|
153
172
|
]);
|
|
154
173
|
function isComputeDeployableTemplate(template) {
|
|
155
174
|
return COMPUTE_DEPLOYABLE_TEMPLATES.has(template);
|
|
@@ -313,19 +332,27 @@ function getInstallArgs(packageManager) {
|
|
|
313
332
|
args: ["install"]
|
|
314
333
|
};
|
|
315
334
|
}
|
|
316
|
-
function getPackageExecutionArgs(packageManager, commandArgs) {
|
|
335
|
+
function getPackageExecutionArgs(packageManager, commandArgs, options = {}) {
|
|
317
336
|
switch (packageManager) {
|
|
318
337
|
case "pnpm": return {
|
|
319
338
|
command: "pnpm",
|
|
320
|
-
args: [
|
|
339
|
+
args: [
|
|
340
|
+
...options.silent ? ["--silent"] : [],
|
|
341
|
+
"dlx",
|
|
342
|
+
...commandArgs
|
|
343
|
+
]
|
|
321
344
|
};
|
|
322
345
|
case "yarn": return {
|
|
323
346
|
command: "yarn",
|
|
324
|
-
args: [
|
|
347
|
+
args: [
|
|
348
|
+
"dlx",
|
|
349
|
+
...options.silent ? ["--quiet"] : [],
|
|
350
|
+
...commandArgs
|
|
351
|
+
]
|
|
325
352
|
};
|
|
326
353
|
case "bun": return {
|
|
327
354
|
command: "bunx",
|
|
328
|
-
args: [...commandArgs]
|
|
355
|
+
args: [...options.silent ? ["--silent"] : [], ...commandArgs]
|
|
329
356
|
};
|
|
330
357
|
case "deno": {
|
|
331
358
|
const [packageName, ...args] = commandArgs;
|
|
@@ -342,12 +369,12 @@ function getPackageExecutionArgs(packageManager, commandArgs) {
|
|
|
342
369
|
}
|
|
343
370
|
default: return {
|
|
344
371
|
command: "npx",
|
|
345
|
-
args: [...commandArgs]
|
|
372
|
+
args: [...options.silent ? ["--yes", "--no-update-notifier"] : [], ...commandArgs]
|
|
346
373
|
};
|
|
347
374
|
}
|
|
348
375
|
}
|
|
349
|
-
function getPackageExecutionCommand(packageManager, commandArgs) {
|
|
350
|
-
const execution = getPackageExecutionArgs(packageManager, commandArgs);
|
|
376
|
+
function getPackageExecutionCommand(packageManager, commandArgs, options = {}) {
|
|
377
|
+
const execution = getPackageExecutionArgs(packageManager, commandArgs, options);
|
|
351
378
|
return [execution.command, ...execution.args].join(" ");
|
|
352
379
|
}
|
|
353
380
|
function getPrismaCliArgs(packageManager, prismaArgs) {
|
|
@@ -361,6 +388,30 @@ function getPrismaCliArgs(packageManager, prismaArgs) {
|
|
|
361
388
|
...prismaArgs
|
|
362
389
|
]
|
|
363
390
|
};
|
|
391
|
+
if (packageManager === "bun") return {
|
|
392
|
+
command: "bun",
|
|
393
|
+
args: [
|
|
394
|
+
"--env-file=.env",
|
|
395
|
+
"./node_modules/.bin/prisma",
|
|
396
|
+
...prismaArgs
|
|
397
|
+
]
|
|
398
|
+
};
|
|
399
|
+
if (packageManager === "pnpm") return {
|
|
400
|
+
command: "pnpm",
|
|
401
|
+
args: [
|
|
402
|
+
"exec",
|
|
403
|
+
"prisma",
|
|
404
|
+
...prismaArgs
|
|
405
|
+
]
|
|
406
|
+
};
|
|
407
|
+
if (packageManager === "yarn") return {
|
|
408
|
+
command: "yarn",
|
|
409
|
+
args: [
|
|
410
|
+
"exec",
|
|
411
|
+
"prisma",
|
|
412
|
+
...prismaArgs
|
|
413
|
+
]
|
|
414
|
+
};
|
|
364
415
|
return getPackageExecutionArgs(packageManager, ["prisma", ...prismaArgs]);
|
|
365
416
|
}
|
|
366
417
|
function getPrismaCliCommand$1(packageManager, prismaArgs) {
|
|
@@ -804,7 +855,7 @@ async function promptForMigrateAndSeed() {
|
|
|
804
855
|
}
|
|
805
856
|
async function promptForPrismaPostgres() {
|
|
806
857
|
const shouldUsePrismaPostgres = await confirm({
|
|
807
|
-
message: "Use Prisma Postgres and
|
|
858
|
+
message: "Use Prisma Postgres and write DATABASE_URL automatically?",
|
|
808
859
|
initialValue: true
|
|
809
860
|
});
|
|
810
861
|
if (isCancel(shouldUsePrismaPostgres)) {
|
|
@@ -1723,17 +1774,13 @@ async function executeCreateAddonSetupContext(params) {
|
|
|
1723
1774
|
//#region src/tasks/deploy-to-compute.ts
|
|
1724
1775
|
const PRISMA_CLI_PACKAGE = "@prisma/cli@latest";
|
|
1725
1776
|
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" }
|
|
1777
|
+
hono: {},
|
|
1778
|
+
elysia: {},
|
|
1779
|
+
next: {},
|
|
1780
|
+
astro: {},
|
|
1781
|
+
nuxt: {},
|
|
1782
|
+
"tanstack-start": {},
|
|
1783
|
+
turborepo: { configTarget: "api" }
|
|
1737
1784
|
};
|
|
1738
1785
|
function getPrismaCliCommand(packageManager) {
|
|
1739
1786
|
return getPackageExecutionCommand(getPrismaCliExecutionPackageManager(packageManager), [PRISMA_CLI_PACKAGE]);
|
|
@@ -1743,25 +1790,24 @@ function getPrismaCliAppDeployCommand(packageManager) {
|
|
|
1743
1790
|
PRISMA_CLI_PACKAGE,
|
|
1744
1791
|
"app",
|
|
1745
1792
|
"deploy"
|
|
1746
|
-
]);
|
|
1793
|
+
], { silent: true });
|
|
1747
1794
|
}
|
|
1748
1795
|
function getComputeDeployScriptMap(context) {
|
|
1749
1796
|
const deployArgs = [
|
|
1797
|
+
...getComputeDeployTargetArgs(context),
|
|
1750
1798
|
"--prod",
|
|
1751
|
-
"--yes"
|
|
1752
|
-
"--env",
|
|
1753
|
-
".env",
|
|
1754
|
-
...getComputeDeployRuntimeArgs(context)
|
|
1799
|
+
"--yes"
|
|
1755
1800
|
];
|
|
1756
1801
|
const deployCommand = [getPrismaCliAppDeployCommand(context.packageManager), ...deployArgs].join(" ");
|
|
1757
1802
|
return { "compute:deploy": deployCommand };
|
|
1758
1803
|
}
|
|
1759
|
-
function
|
|
1760
|
-
return
|
|
1804
|
+
function getComputeDeployTargetArgs(context) {
|
|
1805
|
+
return context.configTarget ? [context.configTarget] : [];
|
|
1761
1806
|
}
|
|
1762
1807
|
function runPrismaCli(packageManager, args, options = {}) {
|
|
1763
|
-
const
|
|
1764
|
-
|
|
1808
|
+
const { silentPackageRunner, ...execaOptions } = options;
|
|
1809
|
+
const execution = getPackageExecutionArgs(getPrismaCliExecutionPackageManager(packageManager), [PRISMA_CLI_PACKAGE, ...args], { silent: silentPackageRunner });
|
|
1810
|
+
return execa(execution.command, execution.args, execaOptions);
|
|
1765
1811
|
}
|
|
1766
1812
|
function getPrismaCliExecutionPackageManager(packageManager) {
|
|
1767
1813
|
return packageManager === "deno" ? "npm" : packageManager;
|
|
@@ -1833,9 +1879,7 @@ async function collectComputeDeployContext(input, options) {
|
|
|
1833
1879
|
template: options.template,
|
|
1834
1880
|
packageManager: options.packageManager,
|
|
1835
1881
|
createProjectName: options.defaultServiceName,
|
|
1836
|
-
|
|
1837
|
-
httpPort: deployOptions.httpPort,
|
|
1838
|
-
requiresExplicitFramework: deployOptions.requiresExplicitFramework
|
|
1882
|
+
configTarget: deployOptions.configTarget
|
|
1839
1883
|
};
|
|
1840
1884
|
}
|
|
1841
1885
|
function redactSecrets(message) {
|
|
@@ -1871,7 +1915,8 @@ async function runPrismaCliJson(params) {
|
|
|
1871
1915
|
"ignore",
|
|
1872
1916
|
"pipe",
|
|
1873
1917
|
"pipe"
|
|
1874
|
-
]
|
|
1918
|
+
],
|
|
1919
|
+
silentPackageRunner: true
|
|
1875
1920
|
});
|
|
1876
1921
|
const parsed = parseJson(stdout);
|
|
1877
1922
|
if (!parsed) return {
|
|
@@ -1970,13 +2015,11 @@ async function executeComputeDeployContext(params) {
|
|
|
1970
2015
|
const args = [
|
|
1971
2016
|
"app",
|
|
1972
2017
|
"deploy",
|
|
2018
|
+
...getComputeDeployTargetArgs(params.context),
|
|
1973
2019
|
"--json",
|
|
1974
2020
|
"--yes",
|
|
1975
2021
|
"--prod",
|
|
1976
|
-
"--
|
|
1977
|
-
".env",
|
|
1978
|
-
...params.createProject === false ? [] : ["--create-project", params.context.createProjectName],
|
|
1979
|
-
...getComputeDeployRuntimeArgs(params.context)
|
|
2022
|
+
...params.createProject === false ? [] : ["--create-project", params.context.createProjectName]
|
|
1980
2023
|
];
|
|
1981
2024
|
const deployResult = await runPrismaCliJson({
|
|
1982
2025
|
packageManager: params.context.packageManager,
|
|
@@ -2002,21 +2045,12 @@ async function executeComputeDeployContext(params) {
|
|
|
2002
2045
|
|
|
2003
2046
|
//#endregion
|
|
2004
2047
|
//#region src/telemetry/client.ts
|
|
2005
|
-
const TELEMETRY_API_KEY = "
|
|
2048
|
+
const TELEMETRY_API_KEY = "";
|
|
2006
2049
|
const TELEMETRY_HOST = "https://us.i.posthog.com";
|
|
2007
2050
|
const TELEMETRY_CONFIG_FILE = "telemetry.json";
|
|
2008
2051
|
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
2052
|
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;
|
|
2053
|
+
return true;
|
|
2020
2054
|
}
|
|
2021
2055
|
function getTelemetryConfigDir() {
|
|
2022
2056
|
if (process.platform === "darwin") return path.join(os.homedir(), "Library", "Application Support", "create-prisma");
|
|
@@ -2038,7 +2072,7 @@ async function getAnonymousId() {
|
|
|
2038
2072
|
}
|
|
2039
2073
|
function getCommonProperties() {
|
|
2040
2074
|
return {
|
|
2041
|
-
"cli-version": "0.
|
|
2075
|
+
"cli-version": "0.6.0-pr.46.139.1",
|
|
2042
2076
|
"node-version": process.version,
|
|
2043
2077
|
platform: process.platform,
|
|
2044
2078
|
arch: process.arch
|
|
@@ -2327,9 +2361,10 @@ async function collectCreateContext(input) {
|
|
|
2327
2361
|
defaultServiceName: projectPackageName
|
|
2328
2362
|
});
|
|
2329
2363
|
if (computeDeployContext === void 0) return;
|
|
2330
|
-
const
|
|
2331
|
-
const prismaSetupContext = await completePrismaSetupContext(input, prismaSetupInitialContext, { useComputePostgres: useComputeDatabase });
|
|
2364
|
+
const prismaSetupContext = await completePrismaSetupContext(input, prismaSetupInitialContext);
|
|
2332
2365
|
if (!prismaSetupContext) return;
|
|
2366
|
+
const useComputeDatabase = Boolean(computeDeployContext && prismaSetupContext.shouldUsePrismaPostgres);
|
|
2367
|
+
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
2368
|
const addonSetupContext = await collectCreateAddonSetupContext(input, {
|
|
2334
2369
|
useDefaults,
|
|
2335
2370
|
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-Jsa6sGYx.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.46.139.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
|
+
});
|