create-better-t-stack 2.39.0 → 2.40.0

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 { createBtsCli } from "./src-DV2p8gsC.js";
2
+ import { createBtsCli } from "./src-DO2f6nII.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 { builder, createBtsCli, docs, init, router, sponsors } from "./src-DV2p8gsC.js";
2
+ import { builder, createBtsCli, docs, init, router, sponsors } from "./src-DO2f6nII.js";
3
3
 
4
4
  export { builder, createBtsCli, docs, init, router, sponsors };
@@ -4697,25 +4697,61 @@ async function setupNeonPostgres(config) {
4697
4697
 
4698
4698
  //#endregion
4699
4699
  //#region src/helpers/database-providers/prisma-postgres-setup.ts
4700
+ const AVAILABLE_REGIONS = [
4701
+ {
4702
+ value: "ap-southeast-1",
4703
+ label: "Asia Pacific (Singapore)"
4704
+ },
4705
+ {
4706
+ value: "ap-northeast-1",
4707
+ label: "Asia Pacific (Tokyo)"
4708
+ },
4709
+ {
4710
+ value: "eu-central-1",
4711
+ label: "Europe (Frankfurt)"
4712
+ },
4713
+ {
4714
+ value: "eu-west-3",
4715
+ label: "Europe (Paris)"
4716
+ },
4717
+ {
4718
+ value: "us-east-1",
4719
+ label: "US East (N. Virginia)"
4720
+ },
4721
+ {
4722
+ value: "us-west-1",
4723
+ label: "US West (N. California)"
4724
+ }
4725
+ ];
4700
4726
  async function setupWithCreateDb(serverDir, packageManager, orm) {
4701
4727
  try {
4702
- log.info("Starting Prisma Postgres setup. Please follow the instructions below:");
4703
- const createDbCommand = getPackageExecutionCommand(packageManager, "create-db@latest -i");
4704
- await execa(createDbCommand, {
4728
+ log.info("Starting Prisma Postgres setup with create-db. Please follow the instructions below:");
4729
+ const selectedRegion = await select({
4730
+ message: "Select your preferred region:",
4731
+ options: AVAILABLE_REGIONS,
4732
+ initialValue: "ap-southeast-1"
4733
+ });
4734
+ if (isCancel(selectedRegion)) return null;
4735
+ const createDbCommand = getPackageExecutionCommand(packageManager, `create-db@latest --json --region ${selectedRegion}`);
4736
+ const s = spinner();
4737
+ s.start("Creating Prisma Postgres database...");
4738
+ const { stdout } = await execa(createDbCommand, {
4705
4739
  cwd: serverDir,
4706
- stdio: "inherit",
4707
4740
  shell: true
4708
4741
  });
4709
- log.info(orm === "drizzle" ? pc.yellow("Please copy the database URL from the output above and append ?sslmode=require for Drizzle.") : pc.yellow("Please copy the Prisma Postgres URL from the output above."));
4710
- const databaseUrl = await text({
4711
- message: orm === "drizzle" ? "Paste your database URL (append ?sslmode=require for Drizzle):" : "Paste your Prisma Postgres database URL:",
4712
- validate(value) {
4713
- if (!value) return "Please enter a database URL";
4714
- if (orm === "drizzle" && !value.includes("?sslmode=require")) return "Please append ?sslmode=require to your database URL when using Drizzle";
4715
- }
4716
- });
4717
- if (isCancel(databaseUrl)) return null;
4718
- return { databaseUrl };
4742
+ s.stop("Database created successfully!");
4743
+ let createDbResponse;
4744
+ try {
4745
+ createDbResponse = JSON.parse(stdout);
4746
+ } catch {
4747
+ consola$1.error("Failed to parse create-db response");
4748
+ return null;
4749
+ }
4750
+ const databaseUrl = orm === "drizzle" ? createDbResponse.directConnectionString : createDbResponse.connectionString;
4751
+ return {
4752
+ databaseUrl,
4753
+ claimUrl: createDbResponse.claimUrl
4754
+ };
4719
4755
  } catch (error) {
4720
4756
  if (error instanceof Error) consola$1.error(error.message);
4721
4757
  return null;
@@ -4755,6 +4791,11 @@ async function writeEnvFile$1(projectDir, config) {
4755
4791
  value: config?.databaseUrl ?? "postgresql://postgres:postgres@localhost:5432/mydb?schema=public",
4756
4792
  condition: true
4757
4793
  }];
4794
+ if (config?.claimUrl) variables.push({
4795
+ key: "CLAIM_URL",
4796
+ value: config.claimUrl,
4797
+ condition: true
4798
+ });
4758
4799
  await addEnvVariablesToFile(envPath, variables);
4759
4800
  } catch (_error) {
4760
4801
  consola$1.error("Failed to update environment configuration");
@@ -4841,7 +4882,9 @@ async function setupPrismaPostgres(config) {
4841
4882
  await addDotenvImportToPrismaConfig(projectDir);
4842
4883
  await addPrismaAccelerateExtension(serverDir);
4843
4884
  }
4844
- log.success(pc.green("Prisma Postgres database configured successfully!"));
4885
+ const connectionType = orm === "drizzle" ? "direct connection" : "Prisma Accelerate";
4886
+ log.success(pc.green(`Prisma Postgres database configured successfully with ${connectionType}!`));
4887
+ if (prismaConfig.claimUrl) log.info(pc.blue(`Claim URL saved to .env: ${prismaConfig.claimUrl}`));
4845
4888
  } else {
4846
4889
  await writeEnvFile$1(projectDir);
4847
4890
  displayManualSetupInstructions$1();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-better-t-stack",
3
- "version": "2.39.0",
3
+ "version": "2.40.0",
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",