create-prisma 0.8.0 → 0.9.0-pr.58.221.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 CHANGED
@@ -7,10 +7,10 @@ Create a Prisma 8 app with Prisma Composer built in.
7
7
  Use your package manager:
8
8
 
9
9
  ```bash
10
- npx create-prisma@next my-app
11
- pnpm dlx create-prisma@next my-app
12
- yarn dlx create-prisma@next my-app
13
- bunx create-prisma@next my-app
10
+ npx create-prisma@latest my-app
11
+ pnpm dlx create-prisma@latest my-app
12
+ yarn dlx create-prisma@latest my-app
13
+ bunx create-prisma@latest my-app
14
14
  ```
15
15
 
16
16
  The CLI initializes Prisma 8 with `prisma@next`, installs dependencies, emits the contract, and generates a deployable Composer app. PostgreSQL projects use Composer's native Prisma Postgres provider, including migrations and a typed runtime client.
@@ -41,13 +41,21 @@ workspace. Choosing another workspace also updates the Prisma CLI's active works
41
41
 
42
42
  PostgreSQL and MongoDB are supported with PSL or TypeScript contract authoring. npm, pnpm, Yarn, and Bun are supported.
43
43
 
44
+ Deno is supported for local minimal PostgreSQL apps:
45
+
46
+ ```bash
47
+ deno run -A npm:create-prisma@latest my-deno-app --template minimal --provider postgres --package-manager deno --no-deploy
48
+ ```
49
+
50
+ Prisma Compute does not support Deno deployments yet.
51
+
44
52
  ## Options
45
53
 
46
54
  - positional project name or `--name`
47
55
  - `--template`
48
56
  - `--provider postgres|postgresql|mongo|mongodb`
49
57
  - `--authoring psl|typescript`
50
- - `--package-manager npm|pnpm|yarn|bun`
58
+ - `--package-manager npm|pnpm|yarn|bun|deno`
51
59
  - `--deploy` / `--no-deploy`
52
60
  - `--workspace <id-or-name>`
53
61
  - `--yes`
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import "./create-BeQ3QH6g.mjs";
2
+ import "./create-Crf7oTTQ.mjs";
3
3
  import { createCreatePrismaCli } from "./index.mjs";
4
4
 
5
5
  //#region src/cli.ts
@@ -13,21 +13,12 @@ import { execa } from "execa";
13
13
  import { styleText } from "node:util";
14
14
 
15
15
  //#region src/telemetry/client.ts
16
- const TELEMETRY_API_KEY = "phc_cmc85avbWyuJ2JyKdGPdv7dxXli8xLdWDBPbvIXWJfs";
16
+ const TELEMETRY_API_KEY = "";
17
17
  const TELEMETRY_HOST = "https://us.i.posthog.com";
18
18
  const TELEMETRY_CONFIG_FILE = "telemetry.json";
19
19
  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;
20
- function isTruthyEnvValue(value) {
21
- return [
22
- "1",
23
- "true",
24
- "yes",
25
- "on"
26
- ].includes(String(value ?? "").trim().toLowerCase());
27
- }
28
20
  function shouldDisableTelemetry() {
29
- if (isTruthyEnvValue(process.env.CI) || isTruthyEnvValue(process.env.GITHUB_ACTIONS)) return true;
30
- return process.env.CREATE_PRISMA_DISABLE_TELEMETRY !== void 0 || process.env.CREATE_PRISMA_TELEMETRY_DISABLED !== void 0 || process.env.DO_NOT_TRACK !== void 0;
21
+ return true;
31
22
  }
32
23
  function getTelemetryConfigDir() {
33
24
  if (process.platform === "darwin") return path.join(os.homedir(), "Library", "Application Support", "create-prisma");
@@ -49,7 +40,7 @@ async function getAnonymousId() {
49
40
  }
50
41
  function getCommonProperties() {
51
42
  return {
52
- "cli-version": "0.8.0",
43
+ "cli-version": "0.9.0-pr.58.221.1",
53
44
  "node-version": process.version,
54
45
  platform: process.platform,
55
46
  arch: process.arch
@@ -147,7 +138,8 @@ const packageManagers = [
147
138
  "npm",
148
139
  "pnpm",
149
140
  "yarn",
150
- "bun"
141
+ "bun",
142
+ "deno"
151
143
  ];
152
144
  const authoringStyles = ["psl", "typescript"];
153
145
  const createTemplates = [
@@ -201,6 +193,7 @@ function parseUserAgent(userAgent) {
201
193
  if (userAgent?.startsWith("pnpm")) return "pnpm";
202
194
  if (userAgent?.startsWith("yarn")) return "yarn";
203
195
  if (userAgent?.startsWith("bun")) return "bun";
196
+ if (userAgent?.startsWith("deno")) return "deno";
204
197
  if (userAgent?.startsWith("npm")) return "npm";
205
198
  return null;
206
199
  }
@@ -215,6 +208,10 @@ async function detectFromPackageJson(projectDir) {
215
208
  if (!await fs.pathExists(packageJsonPath)) return null;
216
209
  return parsePackageManagerField((await fs.readJson(packageJsonPath)).packageManager);
217
210
  }
211
+ async function detectFromDenoConfig(projectDir) {
212
+ for (const configFile of ["deno.json", "deno.jsonc"]) if (await fs.pathExists(path.join(projectDir, configFile))) return "deno";
213
+ return null;
214
+ }
218
215
  async function detectFromLockfile(projectDir) {
219
216
  for (const check of [
220
217
  {
@@ -240,6 +237,10 @@ async function detectFromLockfile(projectDir) {
240
237
  {
241
238
  manager: "npm",
242
239
  lockfile: "npm-shrinkwrap.json"
240
+ },
241
+ {
242
+ manager: "deno",
243
+ lockfile: "deno.lock"
243
244
  }
244
245
  ]) if (await fs.pathExists(path.join(projectDir, check.lockfile))) return check.manager;
245
246
  return null;
@@ -249,19 +250,24 @@ async function detectPackageManager(projectDir = process.cwd()) {
249
250
  if (fromPackageJson) return fromPackageJson;
250
251
  const fromLockfile = await detectFromLockfile(projectDir);
251
252
  if (fromLockfile) return fromLockfile;
253
+ const fromDenoConfig = await detectFromDenoConfig(projectDir);
254
+ if (fromDenoConfig) return fromDenoConfig;
252
255
  const fromUserAgent = parseUserAgent(process.env.npm_config_user_agent);
253
256
  if (fromUserAgent) return fromUserAgent;
254
257
  return "npm";
255
258
  }
256
259
  function getPackageManagerManifestValue(packageManager) {
257
260
  if (!packageManager) return;
261
+ if (packageManager === "deno") return;
258
262
  return packageManagerManifestValues[packageManager];
259
263
  }
260
264
  function getInstallCommand(packageManager) {
265
+ if (packageManager === "deno") return "deno install";
261
266
  return `${packageManager} install`;
262
267
  }
263
268
  function getRunScriptCommand(packageManager, scriptName) {
264
269
  switch (packageManager) {
270
+ case "deno": return `deno task ${scriptName}`;
265
271
  case "bun": return `bun run ${scriptName}`;
266
272
  case "pnpm": return `pnpm run ${scriptName}`;
267
273
  case "yarn": return `yarn run ${scriptName}`;
@@ -270,6 +276,11 @@ function getRunScriptCommand(packageManager, scriptName) {
270
276
  }
271
277
  function getRuntimeScriptCommand(packageManager, kind, options) {
272
278
  const { sourceEntrypoint, builtEntrypoint } = options;
279
+ if (packageManager === "deno") switch (kind) {
280
+ case "dev": return `deno run -A --env-file=.env --watch ${sourceEntrypoint}`;
281
+ case "build": return `deno check ${sourceEntrypoint}`;
282
+ case "start": return `deno run -A --env-file=.env ${sourceEntrypoint}`;
283
+ }
273
284
  if (packageManager === "bun") switch (kind) {
274
285
  case "dev": return `bun --watch ${sourceEntrypoint}`;
275
286
  case "build": return "tsc --noEmit";
@@ -282,6 +293,10 @@ function getRuntimeScriptCommand(packageManager, kind, options) {
282
293
  }
283
294
  }
284
295
  function getInstallArgs(packageManager) {
296
+ if (packageManager === "deno") return {
297
+ command: "deno",
298
+ args: ["install"]
299
+ };
285
300
  return {
286
301
  command: packageManager,
287
302
  args: ["install"]
@@ -289,6 +304,19 @@ function getInstallArgs(packageManager) {
289
304
  }
290
305
  function getPackageExecutionArgs(packageManager, commandArgs) {
291
306
  switch (packageManager) {
307
+ case "deno": {
308
+ const [packageName, ...args] = commandArgs;
309
+ if (!packageName) throw new Error("Package execution requires a package name.");
310
+ return {
311
+ command: "deno",
312
+ args: [
313
+ "run",
314
+ "-A",
315
+ `npm:${packageName}`,
316
+ ...args
317
+ ]
318
+ };
319
+ }
292
320
  case "pnpm": return {
293
321
  command: "pnpm",
294
322
  args: ["dlx", ...commandArgs]
@@ -313,6 +341,10 @@ function getPackageExecutionCommand(packageManager, commandArgs) {
313
341
  }
314
342
  function getRunScriptArgs(packageManager, scriptName) {
315
343
  switch (packageManager) {
344
+ case "deno": return {
345
+ command: "deno",
346
+ args: ["task", scriptName]
347
+ };
316
348
  case "bun": return {
317
349
  command: "bun",
318
350
  args: ["run", scriptName]
@@ -447,6 +479,7 @@ const dependencyVersionMap = {
447
479
  "@types/node": "^25.6.2",
448
480
  alchemy: "2.0.0-beta.67",
449
481
  arktype: "^2.2.3",
482
+ dotenv: "^17.4.2",
450
483
  esbuild: "^0.28.1",
451
484
  effect: "4.0.0-beta.103",
452
485
  mongodb: "^7.1.0",
@@ -456,6 +489,7 @@ const dependencyVersionMap = {
456
489
  typescript: "^5.9.3"
457
490
  };
458
491
  const PRISMA_PLATFORM_CLI_PACKAGE = "prisma@next";
492
+ const PRISMA_DENO_CLI_PACKAGE = "prisma-next";
459
493
  function getDependencyVersion(packageName) {
460
494
  return dependencyVersionMap[packageName];
461
495
  }
@@ -498,6 +532,24 @@ function getDbPackages(provider) {
498
532
  //#endregion
499
533
  //#region src/tasks/install.ts
500
534
  function getPrismaScriptMap(packageManager) {
535
+ if (packageManager === "deno") {
536
+ const prismaCommand = (needsDatabase, ...args) => [
537
+ "deno run -A",
538
+ ...needsDatabase ? ["--env-file=.env"] : [],
539
+ `npm:${PRISMA_DENO_CLI_PACKAGE}`,
540
+ ...args
541
+ ].join(" ");
542
+ return {
543
+ "contract:emit": prismaCommand(false, "contract", "emit"),
544
+ "db:init": prismaCommand(true, "db", "init"),
545
+ "db:update": prismaCommand(true, "db", "update"),
546
+ "db:verify": prismaCommand(true, "db", "verify"),
547
+ "migration:plan": prismaCommand(true, "migration", "plan"),
548
+ migrate: prismaCommand(true, "migrate"),
549
+ "migration:status": prismaCommand(true, "migration", "status"),
550
+ "migration:show": prismaCommand(true, "migration", "show")
551
+ };
552
+ }
501
553
  const prismaCommand = (...args) => getPackageExecutionCommand(packageManager, [PRISMA_PLATFORM_CLI_PACKAGE, ...args]);
502
554
  return {
503
555
  "contract:emit": prismaCommand("contract", "emit"),
@@ -511,6 +563,7 @@ function getPrismaScriptMap(packageManager) {
511
563
  };
512
564
  }
513
565
  function getComposerScriptMap(packageManager) {
566
+ if (packageManager === "deno") return {};
514
567
  const composerCommand = (subcommand, extraArgs = []) => getPackageExecutionCommand(packageManager, [
515
568
  PRISMA_PLATFORM_CLI_PACKAGE,
516
569
  "composer",
@@ -563,15 +616,17 @@ async function addPackageDependency(opts) {
563
616
  async function writePrismaDependencies(provider, packageManager, _authoring, projectDir = process.cwd()) {
564
617
  const dependencies = [getDbPackages(provider)];
565
618
  if (provider === "mongo") dependencies.push("arktype", "mongodb");
619
+ if (packageManager === "deno") dependencies.push("dotenv");
566
620
  await addPackageDependency({
567
621
  dependencies,
568
- devDependencies: ["@prisma/cli-engine", "@types/node"],
622
+ devDependencies: packageManager === "deno" ? ["@types/node"] : ["@prisma/cli-engine", "@types/node"],
569
623
  scripts: getPrismaScriptMap(packageManager),
570
624
  projectDir
571
625
  });
572
626
  }
573
627
  async function writeCreateTemplateDependencies(opts) {
574
628
  const { template, packageManager, projectDir = process.cwd() } = opts;
629
+ if (packageManager === "deno") return;
575
630
  for (const target of getCreateTemplateDependencies(template, packageManager)) await addPackageDependency({
576
631
  dependencies: target.dependencies,
577
632
  devDependencies: target.devDependencies,
@@ -908,7 +963,8 @@ function getPackageManagerHint(option, detected) {
908
963
  npm: "Node.js default",
909
964
  pnpm: "Fast, disk-efficient package manager",
910
965
  yarn: "Yarn package manager",
911
- bun: "Fast runtime and package manager"
966
+ bun: "Fast runtime and package manager",
967
+ deno: "Deno runtime (minimal PostgreSQL apps)"
912
968
  };
913
969
  return option === detected ? `Detected; ${hints[option]}` : hints[option];
914
970
  }
@@ -916,12 +972,7 @@ async function promptForPackageManager(detected) {
916
972
  const packageManager = await select({
917
973
  message: "Choose package manager",
918
974
  initialValue: detected,
919
- options: [
920
- "npm",
921
- "pnpm",
922
- "yarn",
923
- "bun"
924
- ].map((value) => ({
975
+ options: packageManagers.map((value) => ({
925
976
  value,
926
977
  label: value,
927
978
  hint: getPackageManagerHint(value, detected)
@@ -954,7 +1005,10 @@ async function collectPrismaSetupContext(input, options = {}) {
954
1005
  const detectedPackageManager = await detectPackageManager(projectDir);
955
1006
  const packageManager = input.packageManager ?? (useDefaults ? detectedPackageManager : await promptForPackageManager(detectedPackageManager));
956
1007
  if (!packageManager) return;
957
- const shouldDeploy = input.deploy ?? (useDefaults ? false : await promptForDeployment());
1008
+ if (packageManager === "deno" && databaseProvider !== "postgres") throw new Error("Deno support currently requires PostgreSQL.");
1009
+ if (packageManager === "deno" && options.template && options.template !== "minimal") throw new Error("Deno support currently requires the minimal template.");
1010
+ if (packageManager === "deno" && input.deploy === true) throw new Error("Prisma Compute does not support Deno deployments yet. Use --no-deploy.");
1011
+ const shouldDeploy = packageManager === "deno" ? false : input.deploy ?? (useDefaults ? false : await promptForDeployment());
958
1012
  if (shouldDeploy === void 0) return;
959
1013
  return {
960
1014
  projectDir,
@@ -981,10 +1035,22 @@ function getInitTarget(provider) {
981
1035
  return provider === "mongo" ? "mongodb" : "postgres";
982
1036
  }
983
1037
  function getPrismaCliInvocation(packageManager, args) {
984
- return getPackageExecutionArgs(packageManager, [PRISMA_PLATFORM_CLI_PACKAGE, ...args]);
1038
+ return getPackageExecutionArgs(packageManager, [packageManager === "deno" ? PRISMA_DENO_CLI_PACKAGE : PRISMA_PLATFORM_CLI_PACKAGE, ...args]);
985
1039
  }
986
1040
  async function runPrismaInit(context, projectDir) {
987
- const args = [
1041
+ const args = context.packageManager === "deno" ? [
1042
+ "init",
1043
+ "--yes",
1044
+ "--no-interactive",
1045
+ "--target",
1046
+ getInitTarget(context.databaseProvider),
1047
+ "--authoring",
1048
+ context.authoring,
1049
+ "--schema-path",
1050
+ getContractPath(context.authoring),
1051
+ "--no-install",
1052
+ "--no-skill"
1053
+ ] : [
988
1054
  "orm",
989
1055
  "init",
990
1056
  "--yes",
@@ -1008,6 +1074,7 @@ async function runPrismaInit(context, projectDir) {
1008
1074
  CI: "1"
1009
1075
  }
1010
1076
  });
1077
+ if (context.packageManager === "deno") await fs.remove(path.join(projectDir, "prisma-next.md"));
1011
1078
  }
1012
1079
  async function ensureGitignoreEntry(projectDir, entry) {
1013
1080
  const gitignorePath = path.join(projectDir, ".gitignore");
@@ -1065,9 +1132,10 @@ function buildNextSteps(context, options) {
1065
1132
  description: "Composer uses this secret when deploying the MongoDB template."
1066
1133
  });
1067
1134
  if (options.includeDevNextStep) nextSteps.push({
1068
- command: getRunScriptCommand(context.packageManager, "dev:composer"),
1069
- description: "Build and start the app with Prisma Composer locally."
1135
+ command: getRunScriptCommand(context.packageManager, context.packageManager === "deno" ? "dev" : "dev:composer"),
1136
+ description: context.packageManager === "deno" ? "Start the Deno app after setting DATABASE_URL in .env." : "Build and start the app with Prisma Composer locally."
1070
1137
  });
1138
+ if (context.packageManager === "deno") return nextSteps;
1071
1139
  nextSteps.push({
1072
1140
  command: getRunScriptCommand(context.packageManager, "deploy"),
1073
1141
  description: "Build and deploy the app with Prisma Composer."
@@ -1338,7 +1406,10 @@ async function collectCreateContext(input) {
1338
1406
  cancel(`Target directory ${formatPathForDisplay(targetDirectory)} is not empty. Use --force to continue.`);
1339
1407
  return;
1340
1408
  }
1341
- const prismaSetupContext = await collectPrismaSetupContext(input, { projectDir: targetDirectory });
1409
+ const prismaSetupContext = await collectPrismaSetupContext(input, {
1410
+ projectDir: targetDirectory,
1411
+ template
1412
+ });
1342
1413
  if (!prismaSetupContext) return;
1343
1414
  return {
1344
1415
  targetDirectory,
package/dist/index.d.mts CHANGED
@@ -186,6 +186,7 @@ declare const PackageManagerSchema: z.ZodEnum<{
186
186
  pnpm: "pnpm";
187
187
  yarn: "yarn";
188
188
  bun: "bun";
189
+ deno: "deno";
189
190
  }>;
190
191
  declare const AuthoringStyleSchema: z.ZodEnum<{
191
192
  psl: "psl";
@@ -220,6 +221,7 @@ declare const CreateCommandInputSchema: z.ZodObject<{
220
221
  pnpm: "pnpm";
221
222
  yarn: "yarn";
222
223
  bun: "bun";
224
+ deno: "deno";
223
225
  }>>;
224
226
  deploy: z.ZodOptional<z.ZodBoolean>;
225
227
  workspace: z.ZodOptional<z.ZodString>;
@@ -259,6 +261,7 @@ declare const router: {
259
261
  pnpm: "pnpm";
260
262
  yarn: "yarn";
261
263
  bun: "bun";
264
+ deno: "deno";
262
265
  }>>;
263
266
  deploy: z.ZodOptional<z.ZodBoolean>;
264
267
  workspace: z.ZodOptional<z.ZodString>;
package/dist/index.mjs CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
- import { a as DatabaseProviderSchema, i as CreateTemplateSchema, n as AuthoringStyleSchema, o as PackageManagerSchema, r as CreateCommandInputSchema, t as runCreateCommand } from "./create-BeQ3QH6g.mjs";
2
+ import { a as DatabaseProviderSchema, i as CreateTemplateSchema, n as AuthoringStyleSchema, o as PackageManagerSchema, r as CreateCommandInputSchema, t as runCreateCommand } from "./create-Crf7oTTQ.mjs";
3
3
  import { os } from "@orpc/server";
4
4
  import { createCli } from "trpc-cli";
5
5
  import { z } from "zod";
6
6
 
7
7
  //#region src/index.ts
8
- const CLI_VERSION = "0.8.0";
8
+ const CLI_VERSION = "0.9.0-pr.58.221.1";
9
9
  const CreateCliInputSchema = z.tuple([z.string().trim().min(1, "Please enter a valid project name").optional().describe("Project name / directory"), CreateCommandInputSchema]);
10
10
  function normalizeCreateCliInput(input) {
11
11
  const [projectName, options] = input;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-prisma",
3
- "version": "0.8.0",
3
+ "version": "0.9.0-pr.58.221.1",
4
4
  "private": false,
5
5
  "description": "Create Prisma 8 projects with first-party templates and great DX.",
6
6
  "homepage": "https://github.com/prisma/create-prisma",
@@ -1,5 +1,37 @@
1
1
  # {{projectName}}
2
2
 
3
+ {{#if (eq packageManager "deno")}}
4
+ A minimal Prisma 8 app for Deno and PostgreSQL.
5
+
6
+ ## Run locally
7
+
8
+ Copy `.env.example` to `.env`, set `DATABASE_URL`, then initialize the database:
9
+
10
+ ```bash
11
+ deno task db:init
12
+ ```
13
+
14
+ Start the app:
15
+
16
+ ```bash
17
+ deno task dev
18
+ ```
19
+
20
+ The starter users are inserted idempotently from `src/prisma/seed.ts` on the first database query.
21
+
22
+ ## Prisma
23
+
24
+ - Contract: `src/prisma/contract{{#if (eq authoring "typescript")}}.ts{{else}}.prisma{{/if}}`
25
+ - Prisma config: `prisma-next.config.ts`
26
+
27
+ After changing the contract, run:
28
+
29
+ ```bash
30
+ deno task contract:emit
31
+ ```
32
+
33
+ Prisma Compute does not support Deno deployments yet.
34
+ {{else}}
3
35
  A minimal {{template}} app with Prisma 8 and Prisma Composer.
4
36
 
5
37
  ## Run locally
@@ -37,3 +69,4 @@ After changing the contract, run:
37
69
  ```
38
70
 
39
71
  To use the framework's development server directly, run `{{runScriptCommand packageManager "dev"}}`. This direct mode requires `DATABASE_URL`.
72
+ {{/if}}
@@ -0,0 +1,5 @@
1
+ {{#if (eq packageManager "deno")}}
2
+ {
3
+ "nodeModulesDir": "auto"
4
+ }
5
+ {{/if}}
@@ -1,3 +1,4 @@
1
+ {{#unless (eq packageManager "deno")}}
1
2
  import { module } from "@prisma/composer";
2
3
  {{#if (eq provider "postgres")}}
3
4
  import { pnPostgres } from "@prisma/composer-prisma-cloud/prisma-next";
@@ -26,3 +27,4 @@ export default module("{{projectName}}", ({ provision }) => {
26
27
  });
27
28
  {{/if}}
28
29
  });
30
+ {{/unless}}
@@ -1,3 +1,4 @@
1
+ {{#unless (eq packageManager "deno")}}
1
2
  import { defineConfig } from "@prisma/composer/config";
2
3
  import { nodeBuild } from "@prisma/composer/node/control";
3
4
  {{#if (eq template "next")}}
@@ -9,3 +10,4 @@ export default defineConfig({
9
10
  extensions: [prismaCloud(), nodeBuild(){{#if (eq template "next")}}, nextjsBuild(){{/if}}],
10
11
  state: prismaState(),
11
12
  });
13
+ {{/unless}}
@@ -1,3 +1,4 @@
1
+ {{#unless (eq packageManager "deno")}}
1
2
  import { definePrismaConfig } from "@prisma/cli-engine";
2
3
  import { defineConfig as ormConfig } from "@prisma/orm-{{#if (eq provider "postgres")}}postgres{{else}}mongo{{/if}}/config";
3
4
 
@@ -15,3 +16,4 @@ export default definePrismaConfig({
15
16
  configPath: "./prisma-composer.config.ts",
16
17
  },
17
18
  });
19
+ {{/unless}}
@@ -1,3 +1,4 @@
1
+ {{#unless (eq packageManager "deno")}}
1
2
  {{#if (eq template "next")}}
2
3
  import nextjs from "@prisma/composer/nextjs";
3
4
  {{else}}
@@ -40,3 +41,4 @@ export default compute({
40
41
  build: node({ module: import.meta.url, entry: "./dist/server.mjs" }),
41
42
  {{/if}}
42
43
  });
44
+ {{/unless}}
@@ -1,3 +1,4 @@
1
+ {{#unless (eq packageManager "deno")}}
1
2
  {{#if (eq provider "postgres")}}
2
3
  import { pnContract } from "@prisma/composer-prisma-cloud/prisma-next";
3
4
 
@@ -6,3 +7,4 @@ import contractJson from "./{{#if (eq authoring "typescript")}}generated/{{/if}}
6
7
 
7
8
  export const appContract = pnContract<Contract>(contractJson);
8
9
  {{/if}}
10
+ {{/unless}}
@@ -1,6 +1,17 @@
1
1
  {{#if (eq provider "postgres")}}
2
2
  import postgres from "@prisma/orm-postgres/runtime";
3
3
 
4
+ {{#if (eq packageManager "deno")}}
5
+ import type { Contract } from "./{{#if (eq authoring "typescript")}}generated/{{/if}}contract.d.ts";
6
+ import contractJson from "./{{#if (eq authoring "typescript")}}generated/{{/if}}contract.json" with { type: "json" };
7
+
8
+ const databaseUrl = Deno.env.get("DATABASE_URL");
9
+ if (!databaseUrl) {
10
+ throw new Error("DATABASE_URL is not set. Add it to .env before starting the app.");
11
+ }
12
+
13
+ export const db = postgres<Contract>({ contractJson, url: databaseUrl });
14
+ {{else}}
4
15
  import service from "../../service.ts";
5
16
  import type { Contract } from "./{{#if (eq authoring "typescript")}}generated/{{/if}}contract.d.ts";
6
17
  import contractJson from "./{{#if (eq authoring "typescript")}}generated/{{/if}}contract.json" with { type: "json" };
@@ -18,6 +29,7 @@ export const db =
18
29
  (process.env.DATABASE_URL
19
30
  ? postgres<Contract>({ contractJson, url: process.env.DATABASE_URL })
20
31
  : postgres<Contract>({ contractJson }));
32
+ {{/if}}
21
33
  {{else}}
22
34
  import mongo from "@prisma/orm-mongo/runtime";
23
35
 
@@ -6,9 +6,15 @@
6
6
  {{/if}}
7
7
  "type": "module",
8
8
  "scripts": {
9
+ {{#if (eq packageManager "deno")}}
10
+ "dev": "{{runtimeScript packageManager "dev" "src/index.ts" "dist/server.mjs"}}",
11
+ "build": "{{runtimeScript packageManager "build" "src/index.ts" "dist/server.mjs"}}",
12
+ "start": "{{runtimeScript packageManager "start" "src/index.ts" "dist/server.mjs"}}"
13
+ {{else}}
9
14
  "dev": "tsx watch src/index.ts",
10
15
  "build": "esbuild src/index.ts --bundle --platform=node --format=esm --outfile=dist/server.mjs",
11
16
  "start": "node dist/server.mjs"
17
+ {{/if}}
12
18
  },
13
19
  "dependencies": {},
14
20
  "devDependencies": {}
@@ -1,8 +1,8 @@
1
1
  import { createServer } from "node:http";
2
2
 
3
- import { listUsers } from "./prisma/users";
3
+ import { listUsers } from "./prisma/users{{#if (eq packageManager "deno")}}.ts{{/if}}";
4
4
 
5
- const port = Number(process.env.PORT ?? 3000);
5
+ const port = Number({{#if (eq packageManager "deno")}}Deno.env.get("PORT"){{else}}process.env.PORT{{/if}} ?? 3000);
6
6
 
7
7
  createServer(async (_request, response) => {
8
8
  try {