create-prisma 0.14.4-pr.135.438.1 → 0.14.5

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-CZnzCeW8.mjs";
2
+ import { a as shouldRelaunchOnBun, i as runCreatePrismaCli, o as ApplicationLayer } from "./src-DYWWzIGK.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-CZnzCeW8.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-DYWWzIGK.mjs";
3
3
  export { AgentSkillTargetSchema, AuthoringStyleSchema, CREATE_PRISMA_RESULT_SCHEMA_VERSION, CreateCommandInputSchema, CreateCommandResultSchema, CreateTemplateSchema, DatabaseProviderSchema, PackageManagerSchema, create, createCreatePrismaCli, createPrismaCommand, runCreatePrismaCli };
@@ -464,14 +464,20 @@ function getPackageManagerErrorCode(command, output) {
464
464
  }
465
465
  //#endregion
466
466
  //#region src/telemetry/client.ts
467
- const TELEMETRY_API_KEY = "";
467
+ const TELEMETRY_API_KEY = "phc_cmc85avbWyuJ2JyKdGPdv7dxXli8xLdWDBPbvIXWJfs";
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());
473
479
  function shouldDisableTelemetry() {
474
- return true;
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;
475
481
  }
476
482
  function getTelemetryConfigDir() {
477
483
  if (process.platform === "darwin") return path.join(os.homedir(), "Library", "Application Support", "create-prisma");
@@ -495,7 +501,7 @@ const getAnonymousIdEffect = Effect.fn("Telemetry.getAnonymousId")(function* ()
495
501
  return anonymousId;
496
502
  });
497
503
  const getCommonProperties = () => ({
498
- "cli-version": "0.14.4-pr.135.438.1",
504
+ "cli-version": "0.14.5",
499
505
  "node-version": process.version,
500
506
  platform: process.platform,
501
507
  arch: process.arch
@@ -2808,7 +2814,7 @@ function isJsonOutputRequested(argv) {
2808
2814
  const writeJsonResult = Effect.fn("JsonOutput.write")((result) => Effect.sync(() => process.stdout.write(`${JSON.stringify(result)}\n`)));
2809
2815
  //#endregion
2810
2816
  //#region src/index.ts
2811
- const CLI_VERSION = "0.14.4-pr.135.438.1";
2817
+ const CLI_VERSION = "0.14.5";
2812
2818
  const optionalArgument = (name, description) => Argument.String(name).pipe(Argument.withDescription(description), Argument.optional, Argument.map(Option.getOrUndefined));
2813
2819
  const optionalBoolean = (name, description) => Flag.Boolean(name).pipe(Flag.withDescription(description), Flag.optional, Flag.map(Option.getOrUndefined));
2814
2820
  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-pr.135.438.1",
3
+ "version": "0.14.5",
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",
@@ -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;