@prisma/cli-init 0.0.0-dev.202510210851 → 0.0.0-dev.202510211449

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.
@@ -15,7 +15,7 @@ import {
15
15
  platformParameters,
16
16
  poll,
17
17
  printPpgInitOutput
18
- } from "./chunk-ME4LSRTC.js";
18
+ } from "./chunk-GZGPC4YJ.js";
19
19
  import "./chunk-YX4UTTNJ.js";
20
20
  export {
21
21
  __exports as Accelerate,
@@ -344,7 +344,7 @@ import internals5 from "@prisma/internals";
344
344
  import * as Checkpoint from "checkpoint-client";
345
345
 
346
346
  // package.json
347
- var version = "0.0.0-dev.202510210851";
347
+ var version = "0.0.0-dev.202510211449";
348
348
 
349
349
  // src/platform/_lib/userAgent.ts
350
350
  var debug = Debug("prisma:cli:platform:_lib:userAgent");
package/dist/index.js CHANGED
@@ -28,7 +28,7 @@ import {
28
28
  printPpgInitOutput,
29
29
  requestOrThrow,
30
30
  successMessage
31
- } from "./chunk-ME4LSRTC.js";
31
+ } from "./chunk-GZGPC4YJ.js";
32
32
  import {
33
33
  __commonJS,
34
34
  __require,
@@ -3152,6 +3152,10 @@ function printError(text) {
3152
3152
  }
3153
3153
 
3154
3154
  // src/Init.ts
3155
+ var isBun = (
3156
+ // @ts-ignore
3157
+ !!globalThis.Bun || !!globalThis.process?.versions?.bun
3158
+ );
3155
3159
  var defaultSchema = (props) => {
3156
3160
  const {
3157
3161
  datasourceProvider = "postgresql",
@@ -3176,7 +3180,6 @@ ${previewFeatures.length > 0 ? ` previewFeatures = [${previewFeatures.map((feat
3176
3180
 
3177
3181
  datasource db {
3178
3182
  provider = "${datasourceProvider}"
3179
- url = env("DATABASE_URL")
3180
3183
  }
3181
3184
  `;
3182
3185
  if (withModel) {
@@ -3226,8 +3229,10 @@ var defaultEnv = async (url2, debug = false, comments = true) => {
3226
3229
  });
3227
3230
  url2 = server.ppg.url;
3228
3231
  }
3229
- let env = comments ? `# Environment variables declared in this file are automatically made available to Prisma.
3230
- # See the documentation for more detail: https://pris.ly/d/prisma-schema#accessing-environment-variables-from-the-schema
3232
+ let env = comments ? `# Environment variables declared in this file are NOT automatically loaded by Prisma.
3233
+ # Please add \`import "dotenv/config";\` to your \`prisma.config.ts\` file, or use the Prisma CLI with Bun
3234
+ # to load environment variables from .env files:
3235
+ # https://www.prisma.io/docs/orm/reference/prisma-config-reference#using-environment-variables.
3231
3236
 
3232
3237
  # Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.
3233
3238
  # See the documentation for all the connection string options: https://pris.ly/d/connection-strings
@@ -3281,8 +3286,26 @@ var defaultGitIgnore = () => {
3281
3286
  .env
3282
3287
  `;
3283
3288
  };
3284
- var defaultGeneratorProvider = "prisma-client-js";
3289
+ var defaultGeneratorProvider = "prisma-client";
3285
3290
  var defaultPreviewFeatures = [];
3291
+ var defaultConfig = (props) => {
3292
+ const { prismaFolder } = props;
3293
+ const schemaPath = path2.relative(process.cwd(), path2.join(prismaFolder, "schema.prisma"));
3294
+ const migrationsPath = path2.relative(process.cwd(), path2.join(prismaFolder, "migrations"));
3295
+ return `import { defineConfig, env } from "prisma/config";
3296
+
3297
+ export default defineConfig({
3298
+ schema: ${JSON.stringify(schemaPath)},
3299
+ migrations: {
3300
+ path: ${JSON.stringify(migrationsPath)},
3301
+ },
3302
+ engine: "classic",
3303
+ datasource: {
3304
+ url: env("DATABASE_URL"),
3305
+ },
3306
+ });
3307
+ `;
3308
+ };
3286
3309
  var Init = class _Init {
3287
3310
  static new() {
3288
3311
  return new _Init();
@@ -3408,7 +3431,7 @@ var Init = class _Init {
3408
3431
  let generatedSchema;
3409
3432
  let generatedName;
3410
3433
  if (isPpgCommand) {
3411
- const PlatformCommands = await import("./_-FB6OYCCZ.js");
3434
+ const PlatformCommands = await import("./_-Y2BO25HZ.js");
3412
3435
  const credentials = await credentialsFile.load();
3413
3436
  if (internals.isError(credentials))
3414
3437
  throw credentials;
@@ -3561,6 +3584,12 @@ var Init = class _Init {
3561
3584
  );
3562
3585
  const databaseUrl = prismaPostgresDatabaseUrl || url2;
3563
3586
  const warnings = [];
3587
+ fs2.writeFileSync(
3588
+ path2.join(outputDir, "prisma.config.ts"),
3589
+ defaultConfig({
3590
+ prismaFolder
3591
+ })
3592
+ );
3564
3593
  const envPath = path2.join(outputDir, ".env");
3565
3594
  if (!fs2.existsSync(envPath)) {
3566
3595
  fs2.writeFileSync(envPath, await defaultEnv(databaseUrl, args["--debug"]));
@@ -3606,6 +3635,9 @@ var Init = class _Init {
3606
3635
  console.error("Failed to append client path to .gitignore file, reason: ", e);
3607
3636
  }
3608
3637
  const steps = [];
3638
+ if (!isBun) {
3639
+ steps.push(`Install \`dotenv\`, and add \`import "dotenv/config";\` to your \`prisma.config.ts\` file to load environment variables from \`.env\`.`);
3640
+ }
3609
3641
  const isPrismaDev = !args["--url"] && (datasourceProvider === "postgres" || datasourceProvider === "postgresql");
3610
3642
  if (isPrismaDev) {
3611
3643
  steps.push(
@@ -3641,9 +3673,13 @@ var Init = class _Init {
3641
3673
  "ORM"
3642
3674
  )} with scalable connection pooling, global caching, and a managed serverless Postgres database. Read: https://pris.ly/cli/beyond-orm`
3643
3675
  );
3676
+ if (!isBun) {
3677
+ warnings.push(`Environment variables declared in the \`.env\` file are NOT automatically loaded by Prisma.`);
3678
+ }
3644
3679
  const defaultOutput = `
3645
3680
  \u2714 Your Prisma schema was created at ${green("prisma/schema.prisma")}
3646
- You can now open it in your favorite editor.
3681
+ \u2714 Your Prisma config was created at ${green("prisma.config.ts")}
3682
+ You can now open them in your favorite editor.
3647
3683
  ${warnings.length > 0 && internals.logger.should.warn() ? `
3648
3684
  ${warnings.join("\n")}
3649
3685
  ` : ""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/cli-init",
3
- "version": "0.0.0-dev.202510210851",
3
+ "version": "0.0.0-dev.202510211449",
4
4
  "description": "Init CLI for Prisma",
5
5
  "type": "module",
6
6
  "sideEffects": false,