create-prisma 0.11.1 → 0.11.2-pr.84.299.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 { c as createCommandFailureResult } from "./create-CT9uJcQ1.mjs";
2
+ import { c as createCommandFailureResult } from "./create-DgeSOT2M.mjs";
3
3
  import { createCreatePrismaCli } from "./index.mjs";
4
4
 
5
5
  //#region src/ui/json-output.ts
@@ -52,21 +52,12 @@ function createCommandFailureResult(stage, message, project) {
52
52
 
53
53
  //#endregion
54
54
  //#region src/telemetry/client.ts
55
- const TELEMETRY_API_KEY = "phc_cmc85avbWyuJ2JyKdGPdv7dxXli8xLdWDBPbvIXWJfs";
55
+ const TELEMETRY_API_KEY = "";
56
56
  const TELEMETRY_HOST = "https://us.i.posthog.com";
57
57
  const TELEMETRY_CONFIG_FILE = "telemetry.json";
58
58
  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;
59
- function isTruthyEnvValue(value) {
60
- return [
61
- "1",
62
- "true",
63
- "yes",
64
- "on"
65
- ].includes(String(value ?? "").trim().toLowerCase());
66
- }
67
59
  function shouldDisableTelemetry() {
68
- if (isTruthyEnvValue(process.env.CI) || isTruthyEnvValue(process.env.GITHUB_ACTIONS)) return true;
69
- return process.env.CREATE_PRISMA_DISABLE_TELEMETRY !== void 0 || process.env.CREATE_PRISMA_TELEMETRY_DISABLED !== void 0 || process.env.DO_NOT_TRACK !== void 0;
60
+ return true;
70
61
  }
71
62
  function getTelemetryConfigDir() {
72
63
  if (process.platform === "darwin") return path.join(os.homedir(), "Library", "Application Support", "create-prisma");
@@ -88,7 +79,7 @@ async function getAnonymousId() {
88
79
  }
89
80
  function getCommonProperties() {
90
81
  return {
91
- "cli-version": "0.11.1",
82
+ "cli-version": "0.11.2-pr.84.299.1",
92
83
  "node-version": process.version,
93
84
  platform: process.platform,
94
85
  arch: process.arch
@@ -386,42 +377,49 @@ function getInstallArgs(packageManager) {
386
377
  args: ["install"]
387
378
  };
388
379
  }
389
- function getPackageExecutionArgs(packageManager, commandArgs) {
380
+ function getLocalPackageBinaryArgs(packageManager, binaryName, binaryArgs) {
390
381
  switch (packageManager) {
391
- case "deno": {
392
- const [packageName, ...args] = commandArgs;
393
- if (!packageName) throw new Error("Package execution requires a package name.");
394
- return {
395
- command: "deno",
396
- args: [
397
- "run",
398
- "-A",
399
- DENO_ALLOW_FRESH_DEPENDENCIES,
400
- `npm:${packageName}`,
401
- ...args
402
- ]
403
- };
404
- }
382
+ case "deno": return {
383
+ command: "deno",
384
+ args: [
385
+ "run",
386
+ "-A",
387
+ "--frozen",
388
+ `npm:${binaryName}@latest`,
389
+ ...binaryArgs
390
+ ]
391
+ };
405
392
  case "pnpm": return {
406
393
  command: "pnpm",
407
- args: ["dlx", ...commandArgs]
394
+ args: [
395
+ "exec",
396
+ binaryName,
397
+ ...binaryArgs
398
+ ]
408
399
  };
409
400
  case "yarn": return {
410
401
  command: "yarn",
411
- args: ["dlx", ...commandArgs]
402
+ args: [binaryName, ...binaryArgs]
412
403
  };
413
404
  case "bun": return {
414
- command: "bunx",
415
- args: [...commandArgs]
405
+ command: "bun",
406
+ args: [binaryName, ...binaryArgs]
416
407
  };
417
408
  default: return {
418
- command: "npx",
419
- args: ["--yes", ...commandArgs]
409
+ command: "npm",
410
+ args: [
411
+ "exec",
412
+ "--offline",
413
+ "--yes=false",
414
+ "--",
415
+ binaryName,
416
+ ...binaryArgs
417
+ ]
420
418
  };
421
419
  }
422
420
  }
423
- function getPackageExecutionCommand(packageManager, commandArgs) {
424
- const execution = getPackageExecutionArgs(packageManager, commandArgs);
421
+ function getLocalPackageBinaryCommand(packageManager, binaryName, binaryArgs) {
422
+ const execution = getLocalPackageBinaryArgs(packageManager, binaryName, binaryArgs);
425
423
  return [execution.command, ...execution.args].join(" ");
426
424
  }
427
425
  function getRunScriptArgs(packageManager, scriptName) {
@@ -518,6 +516,12 @@ async function renderTemplateTree(opts) {
518
516
 
519
517
  //#endregion
520
518
  //#region src/templates/render-create-template.ts
519
+ const tsdownEntries = {
520
+ minimal: "src/index.ts",
521
+ hono: "src/index.ts",
522
+ elysia: "src/index.ts",
523
+ nest: "src/main.ts"
524
+ };
521
525
  function getCreateTemplateDir(template) {
522
526
  return resolveTemplatesDir(`templates/create/${template}`);
523
527
  }
@@ -530,7 +534,8 @@ function createTemplateContext(projectName, template, provider, authoring, packa
530
534
  template,
531
535
  provider,
532
536
  authoring,
533
- packageManager
537
+ packageManager,
538
+ tsdownEntry: tsdownEntries[template] ?? null
534
539
  };
535
540
  }
536
541
  async function scaffoldCreateSharedTemplates(opts) {
@@ -564,13 +569,13 @@ const dependencyVersionMap = {
564
569
  alchemy: "2.0.0-beta.74",
565
570
  arktype: "^2.2.3",
566
571
  dotenv: "^17.4.2",
567
- esbuild: "^0.28.1",
568
572
  effect: "4.0.0-rc.112",
569
573
  mongodb: "^7.1.0",
570
574
  "mongodb-memory-server": "^11.1.0",
571
575
  nitro: "^3.0.260610-beta",
572
576
  prisma: "latest",
573
577
  "temporal-polyfill": "^1.0.4",
578
+ tsdown: "^0.22.14",
574
579
  tsx: "^4.21.0",
575
580
  typescript: "^5.9.3"
576
581
  };
@@ -579,7 +584,7 @@ const PRISMA_DENO_CLI_PACKAGE = PRISMA_PLATFORM_CLI_PACKAGE;
579
584
  function getDependencyVersion(packageName) {
580
585
  return dependencyVersionMap[packageName];
581
586
  }
582
- function usesEsbuild(template) {
587
+ function usesTsdown(template) {
583
588
  return template === "minimal" || template === "hono" || template === "elysia" || template === "nest";
584
589
  }
585
590
  function getCreateTemplateDependencies(template, _packageManager) {
@@ -589,8 +594,10 @@ function getCreateTemplateDependencies(template, _packageManager) {
589
594
  "alchemy"
590
595
  ];
591
596
  const devDependencies = [];
592
- if (usesEsbuild(template)) devDependencies.push("esbuild");
593
- if (template === "minimal" || usesEsbuild(template)) devDependencies.push("tsx");
597
+ if (usesTsdown(template)) {
598
+ devDependencies.push("tsdown");
599
+ devDependencies.push("tsx");
600
+ }
594
601
  if (template === "minimal") devDependencies.push("typescript");
595
602
  if (template === "elysia") {
596
603
  dependencies.push("@elysiajs/node");
@@ -822,7 +829,7 @@ function parsePrismaCliEnvelope(output) {
822
829
  throw new Error("Prisma CLI returned output that is not a valid result envelope.");
823
830
  }
824
831
  function getPrismaCliArgs(packageManager, args) {
825
- return getPackageExecutionArgs(packageManager, [PRISMA_PLATFORM_CLI_PACKAGE, ...args]);
832
+ return getLocalPackageBinaryArgs(packageManager, "prisma", args);
826
833
  }
827
834
  async function runPrismaJsonCommand(options) {
828
835
  const invocation = getPrismaCliArgs(options.packageManager, [
@@ -875,11 +882,7 @@ async function ensureAuthentication(options) {
875
882
  });
876
883
  const authState = await whoami();
877
884
  if (authState.authenticated) return authState;
878
- const loginCommand = getPackageExecutionCommand(options.packageManager, [
879
- PRISMA_PLATFORM_CLI_PACKAGE,
880
- "auth",
881
- "login"
882
- ]);
885
+ const loginCommand = getLocalPackageBinaryCommand(options.packageManager, "prisma", ["auth", "login"]);
883
886
  if (!options.allowInteractiveLogin || process.stdin.isTTY !== true) throw new ClassifiedCreateError("not_authenticated", `Sign in first with ${loginCommand}, then run ${getRunScriptCommand(options.packageManager, "deploy")}.`);
884
887
  options.beforeInteractiveLogin?.();
885
888
  log.info("Sign in to Prisma to deploy.", { output: options.output });
@@ -1091,11 +1094,7 @@ async function deployNewProjectWithComposer(options) {
1091
1094
  clearProgress();
1092
1095
  failureStage = "composer_deploy";
1093
1096
  failureReason = "composer_deploy_failed";
1094
- const deployCommand = getPackageExecutionCommand(options.packageManager, [
1095
- PRISMA_PLATFORM_CLI_PACKAGE,
1096
- "deploy",
1097
- "module.ts"
1098
- ]);
1097
+ const deployCommand = getLocalPackageBinaryCommand(options.packageManager, "prisma", ["deploy", "module.ts"]);
1099
1098
  if (options.verbose) log.step(`Deploying to Prisma with ${deployCommand}.`, { output });
1100
1099
  else {
1101
1100
  deploymentLog = taskLog({
@@ -1326,8 +1325,8 @@ function getContractPath(authoring) {
1326
1325
  function getInitTarget(provider) {
1327
1326
  return provider === "mongo" ? "mongodb" : "postgres";
1328
1327
  }
1329
- function getPrismaCliInvocation(packageManager, args) {
1330
- return getPackageExecutionArgs(packageManager, [packageManager === "deno" ? PRISMA_DENO_CLI_PACKAGE : PRISMA_PLATFORM_CLI_PACKAGE, ...args]);
1328
+ function getInstalledPrismaCliInvocation(packageManager, args) {
1329
+ return getLocalPackageBinaryArgs(packageManager, "prisma", args);
1331
1330
  }
1332
1331
  async function runPrismaInit(context, projectDir) {
1333
1332
  const args = [
@@ -1343,7 +1342,7 @@ async function runPrismaInit(context, projectDir) {
1343
1342
  getContractPath(context.authoring),
1344
1343
  "--skip-install"
1345
1344
  ];
1346
- const invocation = getPrismaCliInvocation(context.packageManager, args);
1345
+ const invocation = getInstalledPrismaCliInvocation(context.packageManager, args);
1347
1346
  if (context.verbose) log.step(`Running ${[invocation.command, ...invocation.args].join(" ")}`, { output: context.output });
1348
1347
  await runSetupCommand({
1349
1348
  command: invocation.command,
@@ -1360,7 +1359,7 @@ async function runPrismaInit(context, projectDir) {
1360
1359
  }
1361
1360
  async function initializeAgentSkills(context, projectDir) {
1362
1361
  if (context.packageManager === "deno") return;
1363
- const invocation = getPrismaCliInvocation(context.packageManager, [
1362
+ const invocation = getInstalledPrismaCliInvocation(context.packageManager, [
1364
1363
  "init",
1365
1364
  "--yes",
1366
1365
  "--no-interactive"
@@ -1403,7 +1402,7 @@ async function ensureComposerTypeScriptOptions(projectDir) {
1403
1402
  await fs.writeFile(tsconfigPath, updated, "utf8");
1404
1403
  }
1405
1404
  async function runPrismaCli(context, projectDir, args) {
1406
- const invocation = getPrismaCliInvocation(context.packageManager, args);
1405
+ const invocation = getInstalledPrismaCliInvocation(context.packageManager, args);
1407
1406
  if (context.verbose) log.step([invocation.command, ...invocation.args].join(" "), { output: context.output });
1408
1407
  await runSetupCommand({
1409
1408
  command: invocation.command,
@@ -1469,11 +1468,21 @@ async function executePrismaSetupContext(context, options = {}) {
1469
1468
  const progress = context.verbose ? void 0 : options.progressSpinner ?? spinner({ output: context.output });
1470
1469
  const ownsProgress = progress !== void 0 && !options.progressSpinner;
1471
1470
  let gitInitialization;
1472
- let setupStage = "initialize_prisma";
1473
- let setupReason = "prisma_init_failed";
1471
+ let setupStage = "configure_project";
1472
+ let setupReason = "project_configuration_failed";
1474
1473
  if (ownsProgress) progress.start("Creating Prisma 8 project...");
1475
1474
  try {
1475
+ await writePrismaDependencies(context.databaseProvider, context.packageManager, context.authoring, projectDir);
1476
+ progress?.message(`Installing dependencies with ${getInstallCommand(context.packageManager)}...`);
1477
+ setupStage = "install_dependencies";
1478
+ setupReason = "dependency_install_failed";
1479
+ await installProjectDependencies(context.packageManager, projectDir, {
1480
+ verbose: context.verbose,
1481
+ json: context.json
1482
+ });
1476
1483
  progress?.message("Preparing Prisma 8 project files...");
1484
+ setupStage = "initialize_prisma";
1485
+ setupReason = "prisma_init_failed";
1477
1486
  await runPrismaInit(context, projectDir);
1478
1487
  setupStage = "configure_project";
1479
1488
  setupReason = "project_configuration_failed";
@@ -1485,20 +1494,12 @@ async function executePrismaSetupContext(context, options = {}) {
1485
1494
  authoring: context.authoring,
1486
1495
  packageManager: context.packageManager
1487
1496
  });
1488
- await writePrismaDependencies(context.databaseProvider, context.packageManager, context.authoring, projectDir);
1489
1497
  await ensureComposerTypeScriptOptions(projectDir);
1490
1498
  if (context.databaseProvider === "mongo") await ensureMongoEnvironment(projectDir);
1491
1499
  if (context.packageManager !== "deno") {
1492
1500
  await ensureGitignoreEntry(projectDir, "/.alchemy");
1493
1501
  await ensureGitignoreEntry(projectDir, "/.prisma-composer");
1494
1502
  }
1495
- progress?.message(`Installing dependencies with ${getInstallCommand(context.packageManager)}...`);
1496
- setupStage = "install_dependencies";
1497
- setupReason = "dependency_install_failed";
1498
- await installProjectDependencies(context.packageManager, projectDir, {
1499
- verbose: context.verbose,
1500
- json: context.json
1501
- });
1502
1503
  progress?.message("Installing Prisma agent skills...");
1503
1504
  setupStage = "initialize_agent_skills";
1504
1505
  setupReason = "agent_skills_init_failed";
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, s as CREATE_PRISMA_RESULT_SCHEMA_VERSION, t as runCreateCommand } from "./create-CT9uJcQ1.mjs";
2
+ import { a as DatabaseProviderSchema, i as CreateTemplateSchema, n as AuthoringStyleSchema, o as PackageManagerSchema, r as CreateCommandInputSchema, s as CREATE_PRISMA_RESULT_SCHEMA_VERSION, t as runCreateCommand } from "./create-DgeSOT2M.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.11.1";
8
+ const CLI_VERSION = "0.11.2-pr.84.299.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.11.1",
3
+ "version": "0.11.2-pr.84.299.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",
@@ -0,0 +1,37 @@
1
+ {{#unless (eq packageManager "deno")}}
2
+ {{#if tsdownEntry}}
3
+ import { isBuiltin } from "node:module";
4
+ import { defineConfig } from "tsdown";
5
+
6
+ {{#if (eq template "nest")}}
7
+ const optionalNestDependencies = [
8
+ /^@nestjs\/microservices(?:\/|$)/,
9
+ /^@nestjs\/platform-socket\.io(?:\/|$)/,
10
+ /^@nestjs\/websockets(?:\/|$)/,
11
+ /^class-transformer(?:\/|$)/,
12
+ /^class-validator(?:\/|$)/,
13
+ ];
14
+
15
+ {{/if}}
16
+ export default defineConfig({
17
+ entry: { server: "{{tsdownEntry}}" },
18
+ platform: "node",
19
+ target: "node22.18",
20
+ format: "esm",
21
+ clean: true,
22
+ hash: false,
23
+ outputOptions: {
24
+ codeSplitting: false,
25
+ },
26
+ deps: {
27
+ onlyBundle: false,
28
+ alwaysBundle: (id) =>
29
+ !isBuiltin(id){{#if (eq template "nest")}} &&
30
+ !optionalNestDependencies.some((pattern) => pattern.test(id)){{/if}},
31
+ {{#if (eq template "nest")}}
32
+ neverBundle: optionalNestDependencies,
33
+ {{/if}}
34
+ },
35
+ });
36
+ {{/if}}
37
+ {{/unless}}
@@ -5,9 +5,12 @@
5
5
  "packageManager": "{{packageManagerManifestValue packageManager}}",
6
6
  {{/if}}
7
7
  "type": "module",
8
+ "engines": {
9
+ "node": "^22.18.0 || >=24.11.0"
10
+ },
8
11
  "scripts": {
9
12
  "dev": "tsx watch src/index.ts",
10
- "build": "esbuild src/index.ts --bundle --platform=node --format=esm --outfile=dist/server.mjs",
13
+ "build": "tsdown",
11
14
  "start": "node dist/server.mjs"
12
15
  },
13
16
  "dependencies": {
@@ -5,9 +5,12 @@
5
5
  "packageManager": "{{packageManagerManifestValue packageManager}}",
6
6
  {{/if}}
7
7
  "type": "module",
8
+ "engines": {
9
+ "node": "^22.18.0 || >=24.11.0"
10
+ },
8
11
  "scripts": {
9
12
  "dev": "{{runtimeScript packageManager "dev" "src/index.ts" "dist/src/index.js"}}",
10
- "build": "esbuild src/index.ts --bundle --platform=node --format=esm --outfile=dist/server.mjs",
13
+ "build": "tsdown",
11
14
  "start": "node dist/server.mjs"
12
15
  },
13
16
  "dependencies": {
@@ -5,6 +5,11 @@
5
5
  "packageManager": "{{packageManagerManifestValue packageManager}}",
6
6
  {{/if}}
7
7
  "type": "module",
8
+ {{#unless (eq packageManager "deno")}}
9
+ "engines": {
10
+ "node": "^22.18.0 || >=24.11.0"
11
+ },
12
+ {{/unless}}
8
13
  "scripts": {
9
14
  {{#if (eq packageManager "deno")}}
10
15
  "dev": "{{runtimeScript packageManager "dev" "src/index.ts" "dist/server.mjs"}}",
@@ -12,7 +17,7 @@
12
17
  "start": "{{runtimeScript packageManager "start" "src/index.ts" "dist/server.mjs"}}"
13
18
  {{else}}
14
19
  "dev": "tsx watch src/index.ts",
15
- "build": "esbuild src/index.ts --bundle --platform=node --format=esm --outfile=dist/server.mjs",
20
+ "build": "tsdown",
16
21
  "start": "node dist/server.mjs"
17
22
  {{/if}}
18
23
  },
@@ -5,9 +5,12 @@
5
5
  "packageManager": "{{packageManagerManifestValue packageManager}}",
6
6
  {{/if}}
7
7
  "type": "module",
8
+ "engines": {
9
+ "node": "^22.18.0 || >=24.11.0"
10
+ },
8
11
  "scripts": {
9
12
  "dev": "{{runtimeScript packageManager "dev" "src/main.ts" "dist/main.js"}}",
10
- "build": "esbuild src/main.ts --bundle --platform=node --format=esm --outfile=dist/server.mjs --banner:js=\"import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);\" --external:'@nestjs/websockets/*' --external:@nestjs/microservices --external:'@nestjs/microservices/*' --external:@nestjs/platform-socket.io --external:class-transformer --external:class-validator",
13
+ "build": "tsdown",
11
14
  "start": "node dist/server.mjs"
12
15
  },
13
16
  "dependencies": {