create-better-t-stack 2.16.4 → 2.16.6

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/index.js CHANGED
@@ -1549,6 +1549,24 @@ async function writeEnvFile(projectDir, config) {
1549
1549
  await addEnvVariablesToFile(envPath, variables);
1550
1550
  return true;
1551
1551
  }
1552
+ async function setupWithNeonDb(projectDir, packageManager) {
1553
+ try {
1554
+ const s = spinner();
1555
+ s.start("Creating Neon database using neondb...");
1556
+ const serverDir = path.join(projectDir, "apps/server");
1557
+ await fs.ensureDir(serverDir);
1558
+ const packageCmd = getPackageExecutionCommand(packageManager, "neondb --yes");
1559
+ await execa(packageCmd, {
1560
+ shell: true,
1561
+ cwd: serverDir
1562
+ });
1563
+ s.stop(pc.green("Neon database created successfully!"));
1564
+ return true;
1565
+ } catch (error) {
1566
+ consola$1.error(pc.red("Failed to create database with neondb"));
1567
+ throw error;
1568
+ }
1569
+ }
1552
1570
  function displayManualSetupInstructions() {
1553
1571
  log.info(`Manual Neon PostgreSQL Setup Instructions:
1554
1572
 
@@ -1562,28 +1580,48 @@ DATABASE_URL="your_connection_string"`);
1562
1580
  async function setupNeonPostgres(config) {
1563
1581
  const { packageManager, projectDir } = config;
1564
1582
  try {
1565
- const suggestedProjectName = path.basename(projectDir);
1566
- const projectName = await text({
1567
- message: "Enter a name for your Neon project:",
1568
- defaultValue: suggestedProjectName,
1569
- initialValue: suggestedProjectName
1570
- });
1571
- const regionId = await select({
1572
- message: "Select a region for your Neon project:",
1573
- options: NEON_REGIONS,
1574
- initialValue: NEON_REGIONS[0].value
1583
+ const setupMethod = await select({
1584
+ message: "Choose your Neon setup method:",
1585
+ options: [{
1586
+ label: "Quick setup with neondb",
1587
+ value: "neondb",
1588
+ hint: "fastest, no auth required"
1589
+ }, {
1590
+ label: "Custom setup with neonctl",
1591
+ value: "neonctl",
1592
+ hint: "More control - choose project name and region"
1593
+ }],
1594
+ initialValue: "neondb"
1575
1595
  });
1576
- if (isCancel(projectName) || isCancel(regionId)) {
1596
+ if (isCancel(setupMethod)) {
1577
1597
  cancel(pc.red("Operation cancelled"));
1578
1598
  process.exit(0);
1579
1599
  }
1580
- const config$1 = await createNeonProject(projectName, regionId, packageManager);
1581
- if (!config$1) throw new Error("Failed to create project - couldn't get connection information");
1582
- const finalSpinner = spinner();
1583
- finalSpinner.start("Configuring database connection");
1584
- await fs.ensureDir(path.join(projectDir, "apps/server"));
1585
- await writeEnvFile(projectDir, config$1);
1586
- finalSpinner.stop("Neon database configured!");
1600
+ if (setupMethod === "neondb") await setupWithNeonDb(projectDir, packageManager);
1601
+ else {
1602
+ const suggestedProjectName = path.basename(projectDir);
1603
+ const projectName = await text({
1604
+ message: "Enter a name for your Neon project:",
1605
+ defaultValue: suggestedProjectName,
1606
+ initialValue: suggestedProjectName
1607
+ });
1608
+ const regionId = await select({
1609
+ message: "Select a region for your Neon project:",
1610
+ options: NEON_REGIONS,
1611
+ initialValue: NEON_REGIONS[0].value
1612
+ });
1613
+ if (isCancel(projectName) || isCancel(regionId)) {
1614
+ cancel(pc.red("Operation cancelled"));
1615
+ process.exit(0);
1616
+ }
1617
+ const neonConfig = await createNeonProject(projectName, regionId, packageManager);
1618
+ if (!neonConfig) throw new Error("Failed to create project - couldn't get connection information");
1619
+ const finalSpinner = spinner();
1620
+ finalSpinner.start("Configuring database connection");
1621
+ await fs.ensureDir(path.join(projectDir, "apps/server"));
1622
+ await writeEnvFile(projectDir, neonConfig);
1623
+ finalSpinner.stop("Neon database configured!");
1624
+ }
1587
1625
  } catch (error) {
1588
1626
  if (error instanceof Error) consola$1.error(pc.red(error.message));
1589
1627
  await writeEnvFile(projectDir);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-better-t-stack",
3
- "version": "2.16.4",
3
+ "version": "2.16.6",
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",
@@ -11,6 +11,11 @@
11
11
  "next": "15.3.0",
12
12
  "dotenv": "^16.5.0"
13
13
  },
14
+ {{#if (eq dbSetup 'supabase')}}
15
+ "trustedDependencies": [
16
+ "supabase"
17
+ ],
18
+ {{/if}}
14
19
  "devDependencies": {
15
20
  "@types/node": "^20",
16
21
  "@types/react": "^19",
@@ -16,6 +16,11 @@
16
16
  "dotenv": "^16.4.7",
17
17
  "zod": "^3.25.16"
18
18
  },
19
+ {{#if (eq dbSetup 'supabase')}}
20
+ "trustedDependencies": [
21
+ "supabase"
22
+ ],
23
+ {{/if}}
19
24
  "devDependencies": {
20
25
  "tsc-alias": "^1.8.11",
21
26
  "typescript": "^5.8.2"