create-better-t-stack 3.6.2 → 3.6.3

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.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { n as createBtsCli } from "./src-D7BpMan5.js";
2
+ import { n as createBtsCli } from "./src-BN3eh8p0.js";
3
3
 
4
4
  //#region src/cli.ts
5
5
  createBtsCli().run();
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import { a as router, i as init, n as createBtsCli, o as sponsors, r as docs, t as builder } from "./src-D7BpMan5.js";
2
+ import { a as router, i as init, n as createBtsCli, o as sponsors, r as docs, t as builder } from "./src-BN3eh8p0.js";
3
3
 
4
4
  export { builder, createBtsCli, docs, init, router, sponsors };
@@ -88,6 +88,7 @@ const dependencyVersionMap = {
88
88
  "@prisma/adapter-better-sqlite3": "^7.0.0",
89
89
  "@prisma/adapter-pg": "^7.0.0",
90
90
  "@prisma/adapter-planetscale": "^7.0.0",
91
+ "@prisma/adapter-ppg": "^7.0.0",
91
92
  mongoose: "^8.14.0",
92
93
  "vite-plugin-pwa": "^1.0.1",
93
94
  "@vite-pwa/assets-generator": "^1.0.0",
@@ -5233,31 +5234,6 @@ async function setupWithCreateDb(serverDir, packageManager) {
5233
5234
  return null;
5234
5235
  }
5235
5236
  }
5236
- async function initPrismaDatabase(serverDir, packageManager) {
5237
- try {
5238
- const prismaDir = path.join(serverDir, "prisma");
5239
- await fs.ensureDir(prismaDir);
5240
- log.info("Starting Prisma PostgreSQL setup.");
5241
- await execa(getPackageExecutionCommand(packageManager, "prisma init --db"), {
5242
- cwd: serverDir,
5243
- stdio: "inherit",
5244
- shell: true
5245
- });
5246
- log.info(pc.yellow("Please copy the Prisma Postgres URL.\nIt looks like: postgresql://user:password@host:5432/db?sslmode=require"));
5247
- const databaseUrl = await text({
5248
- message: "Paste your Prisma Postgres database URL:",
5249
- validate(value) {
5250
- if (!value) return "Please enter a database URL";
5251
- if (!value.startsWith("postgresql://")) return "URL should start with postgresql://";
5252
- }
5253
- });
5254
- if (isCancel(databaseUrl)) return null;
5255
- return { databaseUrl };
5256
- } catch (error) {
5257
- if (error instanceof Error) consola$1.error(error.message);
5258
- return null;
5259
- }
5260
- }
5261
5237
  async function writeEnvFile$1(projectDir, backend, config) {
5262
5238
  try {
5263
5239
  const targetApp = backend === "self" ? "apps/web" : "apps/server";
@@ -5277,16 +5253,6 @@ async function writeEnvFile$1(projectDir, backend, config) {
5277
5253
  consola$1.error("Failed to update environment configuration");
5278
5254
  }
5279
5255
  }
5280
- async function addDotenvImportToPrismaConfig(projectDir, backend) {
5281
- try {
5282
- const prismaConfigPath = path.join(projectDir, "packages/db/prisma.config.ts");
5283
- let content = await fs.readFile(prismaConfigPath, "utf8");
5284
- content = `import dotenv from "dotenv";\ndotenv.config({ path: "${backend === "self" ? "../../apps/web/.env" : "../../apps/server/.env"}" });\n${content}`;
5285
- await fs.writeFile(prismaConfigPath, content);
5286
- } catch (_error) {
5287
- consola$1.error("Failed to update prisma.config.ts");
5288
- }
5289
- }
5290
5256
  function displayManualSetupInstructions$1(target) {
5291
5257
  log.info(`Manual Prisma PostgreSQL Setup Instructions:
5292
5258
 
@@ -5298,7 +5264,7 @@ function displayManualSetupInstructions$1(target) {
5298
5264
  DATABASE_URL="your_database_url"`);
5299
5265
  }
5300
5266
  async function setupPrismaPostgres(config, cliInput) {
5301
- const { packageManager, projectDir, orm, backend } = config;
5267
+ const { packageManager, projectDir, backend } = config;
5302
5268
  const manualDb = cliInput?.manualDb ?? false;
5303
5269
  const dbDir = path.join(projectDir, "packages/db");
5304
5270
  try {
@@ -5308,47 +5274,28 @@ async function setupPrismaPostgres(config, cliInput) {
5308
5274
  displayManualSetupInstructions$1(backend === "self" ? "apps/web" : "apps/server");
5309
5275
  return;
5310
5276
  }
5311
- const mode = await select({
5277
+ const setupMode = await select({
5312
5278
  message: "Prisma Postgres setup: choose mode",
5313
5279
  options: [{
5314
- label: "Automatic",
5280
+ label: "Automatic (create-db)",
5315
5281
  value: "auto",
5316
- hint: "Automated setup with provider CLI, sets .env"
5282
+ hint: "Provision a database via Prisma's create-db CLI"
5317
5283
  }, {
5318
5284
  label: "Manual",
5319
5285
  value: "manual",
5320
- hint: "Manual setup, add env vars yourself"
5286
+ hint: "Add your own DATABASE_URL later"
5321
5287
  }],
5322
5288
  initialValue: "auto"
5323
5289
  });
5324
- if (isCancel(mode)) return exitCancelled("Operation cancelled");
5325
- if (mode === "manual") {
5290
+ if (isCancel(setupMode)) return;
5291
+ if (setupMode === "manual") {
5326
5292
  await writeEnvFile$1(projectDir, backend);
5327
5293
  displayManualSetupInstructions$1(backend === "self" ? "apps/web" : "apps/server");
5328
5294
  return;
5329
5295
  }
5330
- const setupOptions = [{
5331
- label: "Quick setup with create-db",
5332
- value: "create-db",
5333
- hint: "Fastest, automated database creation (no auth)"
5334
- }];
5335
- if (orm === "prisma") setupOptions.push({
5336
- label: "Custom setup with Prisma Init",
5337
- value: "custom",
5338
- hint: "More control (requires auth)"
5339
- });
5340
- const setupMethod = await select({
5341
- message: "Choose your Prisma Postgres setup method:",
5342
- options: setupOptions,
5343
- initialValue: "create-db"
5344
- });
5345
- if (isCancel(setupMethod)) return exitCancelled("Operation cancelled");
5346
- let prismaConfig = null;
5347
- if (setupMethod === "create-db") prismaConfig = await setupWithCreateDb(dbDir, packageManager);
5348
- else prismaConfig = await initPrismaDatabase(dbDir, packageManager);
5296
+ const prismaConfig = await setupWithCreateDb(dbDir, packageManager);
5349
5297
  if (prismaConfig) {
5350
5298
  await writeEnvFile$1(projectDir, backend, prismaConfig);
5351
- if (orm === "prisma") await addDotenvImportToPrismaConfig(projectDir, backend);
5352
5299
  log.success(pc.green("Prisma Postgres database configured successfully!"));
5353
5300
  if (prismaConfig.claimUrl) log.info(pc.blue(`Claim URL saved to .env: ${prismaConfig.claimUrl}`));
5354
5301
  } else {
@@ -5765,7 +5712,8 @@ async function setupDatabase(config, cliInput) {
5765
5712
  else if (database === "postgres") if (dbSetup === "neon") {
5766
5713
  prismaDependencies.push("@prisma/adapter-neon", "@neondatabase/serverless", "ws");
5767
5714
  prismaDevDependencies.push("@types/ws");
5768
- } else {
5715
+ } else if (dbSetup === "prisma-postgres") prismaDependencies.push("@prisma/adapter-ppg");
5716
+ else {
5769
5717
  prismaDependencies.push("@prisma/adapter-pg");
5770
5718
  prismaDependencies.push("pg");
5771
5719
  prismaDevDependencies.push("@types/pg");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-better-t-stack",
3
- "version": "3.6.2",
3
+ "version": "3.6.3",
4
4
  "description": "A modern CLI tool for scaffolding end-to-end type-safe TypeScript projects with best practices and customizable configurations",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1,6 +1,5 @@
1
1
  import path from "node:path";
2
2
  import { defineConfig, env } from 'prisma/config'
3
- {{#unless (eq dbSetup "prisma-postgres")}}
4
3
  import dotenv from 'dotenv'
5
4
 
6
5
  dotenv.config({
@@ -10,7 +9,6 @@ dotenv.config({
10
9
  path: "../../apps/server/.env",
11
10
  {{/if}}
12
11
  })
13
- {{/unless}}
14
12
 
15
13
  export default defineConfig({
16
14
  schema: path.join("prisma", "schema"),
@@ -13,6 +13,15 @@ const prisma = new PrismaClient({
13
13
  }),
14
14
  });
15
15
 
16
+ {{else if (eq dbSetup "prisma-postgres")}}
17
+ import { PrismaPostgresAdapter } from "@prisma/adapter-ppg";
18
+
19
+ const adapter = new PrismaPostgresAdapter({
20
+ connectionString: env.DATABASE_URL || "",
21
+ });
22
+
23
+ const prisma = new PrismaClient({ adapter });
24
+
16
25
  {{else}}
17
26
  import { PrismaPg } from "@prisma/adapter-pg";
18
27
 
@@ -38,6 +47,15 @@ const adapter = new PrismaNeon({
38
47
 
39
48
  const prisma = new PrismaClient({ adapter });
40
49
 
50
+ {{else if (eq dbSetup "prisma-postgres")}}
51
+ import { PrismaPostgresAdapter } from "@prisma/adapter-ppg";
52
+
53
+ const adapter = new PrismaPostgresAdapter({
54
+ connectionString: process.env.DATABASE_URL || "",
55
+ });
56
+
57
+ const prisma = new PrismaClient({ adapter });
58
+
41
59
  {{else}}
42
60
  import { PrismaPg } from "@prisma/adapter-pg";
43
61