create-prisma 0.14.4 → 0.14.5-pr.138.446.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/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { a as shouldRelaunchOnBun, i as runCreatePrismaCli, o as ApplicationLayer } from "./src-D-ltzP6P.mjs";
2
+ import { a as shouldRelaunchOnBun, i as runCreatePrismaCli, o as ApplicationLayer } from "./src-DrBdAtdL.mjs";
3
3
  import { Effect } from "effect";
4
4
  import { NodeRuntime } from "@effect/platform-node-shared";
5
5
  import { spawn } from "node:child_process";
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import { c as CreateCommandResultSchema, d as CreateCommandInputSchema, f as CreateTemplateSchema, i as runCreatePrismaCli, l as AgentSkillTargetSchema, m as PackageManagerSchema, n as createCreatePrismaCli, p as DatabaseProviderSchema, r as createPrismaCommand, s as CREATE_PRISMA_RESULT_SCHEMA_VERSION, t as create, u as AuthoringStyleSchema } from "./src-D-ltzP6P.mjs";
2
+ import { c as CreateCommandResultSchema, d as CreateCommandInputSchema, f as CreateTemplateSchema, i as runCreatePrismaCli, l as AgentSkillTargetSchema, m as PackageManagerSchema, n as createCreatePrismaCli, p as DatabaseProviderSchema, r as createPrismaCommand, s as CREATE_PRISMA_RESULT_SCHEMA_VERSION, t as create, u as AuthoringStyleSchema } from "./src-DrBdAtdL.mjs";
3
3
  export { AgentSkillTargetSchema, AuthoringStyleSchema, CREATE_PRISMA_RESULT_SCHEMA_VERSION, CreateCommandInputSchema, CreateCommandResultSchema, CreateTemplateSchema, DatabaseProviderSchema, PackageManagerSchema, create, createCreatePrismaCli, createPrismaCommand, runCreatePrismaCli };
@@ -464,20 +464,14 @@ function getPackageManagerErrorCode(command, output) {
464
464
  }
465
465
  //#endregion
466
466
  //#region src/telemetry/client.ts
467
- const TELEMETRY_API_KEY = "phc_cmc85avbWyuJ2JyKdGPdv7dxXli8xLdWDBPbvIXWJfs";
467
+ const TELEMETRY_API_KEY = "";
468
468
  const TELEMETRY_HOST = "https://us.i.posthog.com";
469
469
  const TELEMETRY_CONFIG_FILE = "telemetry.json";
470
470
  const TELEMETRY_TIMEOUT_MS = 2e3;
471
471
  const AnonymousId = Schema.String.check(Schema.isUUID(4));
472
472
  const decodeAnonymousId = Schema.decodeUnknownExit(AnonymousId);
473
- const isTruthyEnvValue = (value) => [
474
- "1",
475
- "true",
476
- "yes",
477
- "on"
478
- ].includes(String(value ?? "").trim().toLowerCase());
479
473
  function shouldDisableTelemetry() {
480
- return isTruthyEnvValue(process.env.CI) || isTruthyEnvValue(process.env.GITHUB_ACTIONS) || process.env.CREATE_PRISMA_DISABLE_TELEMETRY !== void 0 || process.env.CREATE_PRISMA_TELEMETRY_DISABLED !== void 0 || process.env.DO_NOT_TRACK !== void 0;
474
+ return true;
481
475
  }
482
476
  function getTelemetryConfigDir() {
483
477
  if (process.platform === "darwin") return path.join(os.homedir(), "Library", "Application Support", "create-prisma");
@@ -501,7 +495,7 @@ const getAnonymousIdEffect = Effect.fn("Telemetry.getAnonymousId")(function* ()
501
495
  return anonymousId;
502
496
  });
503
497
  const getCommonProperties = () => ({
504
- "cli-version": "0.14.4",
498
+ "cli-version": "0.14.5-pr.138.446.1",
505
499
  "node-version": process.version,
506
500
  platform: process.platform,
507
501
  arch: process.arch
@@ -643,8 +637,8 @@ const trackCreateCancelledEffect = Effect.fn("Telemetry.createCancelled")(functi
643
637
  const dependencyVersionMap = {
644
638
  "@astrojs/node": "^11.1.9",
645
639
  "@elysia/node": "^1.4.6",
646
- "@prisma/composer": "0.34.0",
647
- "@prisma/composer-prisma-cloud": "0.34.0",
640
+ "@prisma/composer": "0.35.0",
641
+ "@prisma/composer-prisma-cloud": "0.35.0",
648
642
  "@prisma/dev": "0.25.2",
649
643
  "@prisma/orm-mongo": "8.0.0-rc.20",
650
644
  "@prisma/orm-postgres": "8.0.0-rc.20",
@@ -658,7 +652,7 @@ const dependencyVersionMap = {
658
652
  mongodb: "^7.7.0",
659
653
  "mongodb-memory-server": "^11.3.0",
660
654
  nitro: "^3.0.260903-beta",
661
- prisma: "8.0.0-rc.27",
655
+ prisma: "8.0.0-rc.28",
662
656
  "temporal-polyfill": "^1.0.6",
663
657
  tsdown: "^0.23.1",
664
658
  turbo: "2.11.10",
@@ -1258,11 +1252,7 @@ function getPrismaScriptMap(packageManager, skillsSync) {
1258
1252
  }
1259
1253
  function getComposerScriptMap(packageManager) {
1260
1254
  if (packageManager === "deno") return {};
1261
- const composerCommand = (subcommand) => [
1262
- "prisma",
1263
- subcommand,
1264
- "module.ts"
1265
- ].join(" ");
1255
+ const composerCommand = (subcommand) => ["prisma", subcommand].join(" ");
1266
1256
  return {
1267
1257
  "composer:dev": composerCommand("dev"),
1268
1258
  "composer:deploy": composerCommand("deploy"),
@@ -1647,11 +1637,7 @@ const runComposerDeployEffect = Effect.fn("Deployment.runComposerDeploy")(functi
1647
1637
  return yield* runPrismaJsonCommandEffect({
1648
1638
  packageManager: options.packageManager,
1649
1639
  projectDir: options.projectDir,
1650
- args: [
1651
- "deploy",
1652
- "module.ts",
1653
- ...reportPath ? ["--report", reportPath] : []
1654
- ],
1640
+ args: ["deploy", ...reportPath ? ["--report", reportPath] : []],
1655
1641
  ...options.onStderrLine ? { onStderrLine: options.onStderrLine } : {}
1656
1642
  }).pipe(Effect.catchTag("PrismaCliCommandError", (error) => Effect.gen(function* () {
1657
1643
  const causeCode = reportPath ? yield* readComposerDeployFailureCode(reportPath) : void 0;
@@ -1785,7 +1771,7 @@ const deployNewProjectWithComposerEffect = Effect.fn("Deployment.deploy")(functi
1785
1771
  verbose: options.verbose,
1786
1772
  json: options.json === true
1787
1773
  }), "build", "build_failed");
1788
- const deployCommand = getLocalPackageBinaryCommand(options.packageManager, "prisma", ["deploy", "module.ts"]);
1774
+ const deployCommand = getLocalPackageBinaryCommand(options.packageManager, "prisma", ["deploy"]);
1789
1775
  yield* Effect.sync(() => {
1790
1776
  clearProgress();
1791
1777
  if (options.verbose) log.step(`Deploying to Prisma with ${deployCommand}.`, { output });
@@ -2814,7 +2800,7 @@ function isJsonOutputRequested(argv) {
2814
2800
  const writeJsonResult = Effect.fn("JsonOutput.write")((result) => Effect.sync(() => process.stdout.write(`${JSON.stringify(result)}\n`)));
2815
2801
  //#endregion
2816
2802
  //#region src/index.ts
2817
- const CLI_VERSION = "0.14.4";
2803
+ const CLI_VERSION = "0.14.5-pr.138.446.1";
2818
2804
  const optionalArgument = (name, description) => Argument.String(name).pipe(Argument.withDescription(description), Argument.optional, Argument.map(Option.getOrUndefined));
2819
2805
  const optionalBoolean = (name, description) => Flag.Boolean(name).pipe(Flag.withDescription(description), Flag.optional, Flag.map(Option.getOrUndefined));
2820
2806
  const optionalString = (name, description) => Flag.String(name).pipe(Flag.withDescription(description), Flag.optional, Flag.map(Option.getOrUndefined));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-prisma",
3
- "version": "0.14.4",
3
+ "version": "0.14.5-pr.138.446.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",
@@ -38,6 +38,7 @@ export default definePrismaConfig({
38
38
  },
39
39
  }),
40
40
  composer: composer({
41
+ entry: "./module.ts",
41
42
  extensions: [prismaCloud({ region: "us-east-1" }), nodeBuild(){{#if (eq template "next")}}, nextjsBuild(){{/if}}],
42
43
  state: prismaState(),
43
44
  }),
@@ -32,9 +32,9 @@ export default compute({
32
32
  {{else if (eq template "turborepo")}}
33
33
  build: node({ module: import.meta.url, entry: "./apps/server/dist/server.mjs" }),
34
34
  {{else if (eq template "svelte")}}
35
- build: node({ module: import.meta.url, dir: "./build", entry: "index.js" }),
35
+ build: node({ module: import.meta.url, dir: "./build", entry: "index.js", dependencies: "external" }),
36
36
  {{else if (eq template "astro")}}
37
- build: node({ module: import.meta.url, dir: "./dist", entry: "server/entry.mjs" }),
37
+ build: node({ module: import.meta.url, dir: "./dist", entry: "server/entry.mjs", dependencies: "external" }),
38
38
  {{else if (eq template "nuxt")}}
39
39
  build: node({ module: import.meta.url, dir: "./.output", entry: "server/index.mjs" }),
40
40
  {{else if (eq template "tanstack-start")}}
@@ -59,13 +59,3 @@ const databaseUrl = getDatabaseUrl();
59
59
 
60
60
  export const db = databaseUrl ? mongo({ contract, url: databaseUrl }) : mongo({ contract });
61
61
  {{/if}}
62
-
63
- let connection: Promise<void> | undefined;
64
-
65
- export function connectDatabase(): Promise<void> {
66
- connection ??= db.connect().then(() => undefined).catch((error: unknown) => {
67
- connection = undefined;
68
- throw error;
69
- });
70
- return connection;
71
- }
@@ -1,4 +1,4 @@
1
- import { connectDatabase, db } from "./db.ts";
1
+ import { db } from "./db.ts";
2
2
 
3
3
  const users = [
4
4
  { email: "alice@prisma.io", username: "alice", name: "Alice" },
@@ -9,8 +9,6 @@ const users = [
9
9
  let pendingSeed: Promise<void> | undefined;
10
10
 
11
11
  async function runSeed(): Promise<void> {
12
- await connectDatabase();
13
-
14
12
  {{#if (eq provider "mongo")}}
15
13
  for (const user of users) {
16
14
  const existingUser = await db.orm.users.where({ email: user.email }).first();
@@ -7,7 +7,10 @@ const formatter = new Intl.DateTimeFormat("en", {
7
7
  timeStyle: "short",
8
8
  });
9
9
 
10
- const users = await listUsers(10).catch(() => undefined);
10
+ const users = await listUsers(10).catch((error: unknown) => {
11
+ console.error("Failed to query users:", error);
12
+ return undefined;
13
+ });
11
14
 
12
15
  ---
13
16
 
@@ -40,8 +43,8 @@ const users = await listUsers(10).catch(() => undefined);
40
43
 
41
44
  {!users ? (
42
45
  <p class="empty">
43
- Could not query users yet. Run <code>contract:emit</code> and apply your schema,
44
- then refresh.
46
+ Could not query users. Check the server log for the error. If the schema isn't
47
+ applied yet, run <code>contract:emit</code> and apply it, then refresh.
45
48
  </p>
46
49
  ) : users.length === 0 ? (
47
50
  <p class="empty">No users found.</p>
@@ -16,14 +16,14 @@ const app = new Elysia({ adapter: "Bun" in globalThis ? undefined : node() })
16
16
  })
17
17
 
18
18
  .get("/users", async ({ set }) => {
19
- const users = await listUsers(10).catch((error) => {
19
+ const users = await listUsers(10).catch((error: unknown) => {
20
20
  console.error("Failed to query users:", error);
21
21
  return undefined;
22
22
  });
23
23
 
24
24
  if (!users) {
25
25
  set.status = 500;
26
- return { error: "Could not query users yet. Run contract:emit and apply your schema first." };
26
+ return { error: "Could not query users. Check the server log for the error." };
27
27
  }
28
28
 
29
29
  return users;
@@ -12,13 +12,13 @@ app.get("/", (c) => {
12
12
  });
13
13
 
14
14
  app.get("/users", async (c) => {
15
- const users = await listUsers(10).catch((error) => {
15
+ const users = await listUsers(10).catch((error: unknown) => {
16
16
  console.error("Failed to query users:", error);
17
17
  return undefined;
18
18
  });
19
19
 
20
20
  if (!users) {
21
- return c.json({ error: "Could not query users yet. Run contract:emit and apply your schema first." }, 500);
21
+ return c.json({ error: "Could not query users. Check the server log for the error." }, 500);
22
22
  }
23
23
 
24
24
  return c.json(users);
@@ -0,0 +1,11 @@
1
+ import type { NextConfig } from "next";
2
+
3
+ const nextConfig: NextConfig = {
4
+ output: "standalone",
5
+ {{#if (eq provider "mongo")}}
6
+ // Turbopack's ESM interop breaks mongodb-connection-string-url, which the Mongo runtime imports.
7
+ serverExternalPackages: ["@prisma/orm-mongo"],
8
+ {{/if}}
9
+ };
10
+
11
+ export default nextConfig;
@@ -7,7 +7,10 @@ export default async function Home() {
7
7
  dateStyle: "medium",
8
8
  timeStyle: "short",
9
9
  });
10
- const users = await listUsers(10).catch(() => undefined);
10
+ const users = await listUsers(10).catch((error: unknown) => {
11
+ console.error("Failed to query users:", error);
12
+ return undefined;
13
+ });
11
14
 
12
15
  return (
13
16
  <main className="shell">
@@ -29,8 +32,8 @@ export default async function Home() {
29
32
 
30
33
  {!users ? (
31
34
  <p className="empty">
32
- Could not query users yet. Run <code>contract:emit</code> and apply your schema,
33
- then refresh.
35
+ Could not query users. Check the server log for the error. If the schema isn't
36
+ applied yet, run <code>contract:emit</code> and apply it, then refresh.
34
37
  </p>
35
38
  ) : users.length === 0 ? (
36
39
  <p className="empty">No users found.</p>
@@ -49,7 +49,8 @@ function formatCreatedAt(value: string): string {
49
49
  </div>
50
50
 
51
51
  <p v-if="data?.error" class="empty">
52
- \{{ data.error }} Run <code>contract:emit</code> and apply your schema, then refresh.
52
+ \{{ data.error }} If the schema isn't applied yet, run <code>contract:emit</code> and apply
53
+ it, then refresh.
53
54
  </p>
54
55
  <p v-else-if="!data?.users?.length" class="empty">
55
56
  No users found.
@@ -8,14 +8,14 @@ export default defineEventHandler(async () => {
8
8
  createdAt: user.createdAt ?? null,
9
9
  }))
10
10
  )
11
- .catch((error) => {
11
+ .catch((error: unknown) => {
12
12
  console.error("Failed to query users:", error);
13
13
  return undefined;
14
14
  });
15
15
 
16
16
  if (!users) {
17
17
  return {
18
- error: "Could not query users yet.",
18
+ error: "Could not query users. Check the server log for the error.",
19
19
  users: [],
20
20
  };
21
21
  }
@@ -10,7 +10,10 @@ export const load: PageServerLoad = async () => {
10
10
  createdAt: user.createdAt ?? null,
11
11
  }))
12
12
  )
13
- .catch(() => undefined);
13
+ .catch((error: unknown) => {
14
+ console.error("Failed to query users:", error);
15
+ return undefined;
16
+ });
14
17
 
15
18
  return { users };
16
19
  };
@@ -34,8 +34,8 @@
34
34
 
35
35
  {#if !data.users}
36
36
  <p class="empty">
37
- Could not query users yet. Run <code>contract:emit</code> and apply your schema, then
38
- refresh.
37
+ Could not query users. Check the server log for the error. If the schema isn't applied
38
+ yet, run <code>contract:emit</code> and apply it, then refresh.
39
39
  </p>
40
40
  {:else if data.users.length === 0}
41
41
  <p class="empty">No users found.</p>
@@ -4,7 +4,4 @@ import { defineConfig } from "vite";
4
4
 
5
5
  export default defineConfig({
6
6
  plugins: [sveltekit({ adapter: adapter() })],
7
- ssr: {
8
- noExternal: true,
9
- },
10
7
  });
@@ -11,7 +11,10 @@ const listUsers = createServerFn({ method: "GET" }).handler(async () => {
11
11
  createdAt: user.createdAt ?? null,
12
12
  }))
13
13
  )
14
- .catch(() => undefined);
14
+ .catch((error: unknown) => {
15
+ console.error("Failed to query users:", error);
16
+ return undefined;
17
+ });
15
18
  });
16
19
 
17
20
  export const Route = createFileRoute("/")({
@@ -50,8 +53,8 @@ function Home() {
50
53
 
51
54
  {!users ? (
52
55
  <p className="empty">
53
- Could not query users yet. Run <code>contract:emit</code> and apply your schema,
54
- then refresh.
56
+ Could not query users. Check the server log for the error. If the schema isn't
57
+ applied yet, run <code>contract:emit</code> and apply it, then refresh.
55
58
  </p>
56
59
  ) : users.length === 0 ? (
57
60
  <p className="empty">No users found.</p>
@@ -1,7 +0,0 @@
1
- import type { NextConfig } from "next";
2
-
3
- const nextConfig: NextConfig = {
4
- output: "standalone",
5
- };
6
-
7
- export default nextConfig;