create-better-t-stack 2.16.3 → 2.16.5

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.
Files changed (2) hide show
  1. package/dist/index.js +58 -36
  2. package/package.json +1 -1
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);
@@ -1920,7 +1958,7 @@ function generateScriptsList(packageManagerRunCmd, database, orm, _auth, hasNati
1920
1958
 
1921
1959
  //#endregion
1922
1960
  //#region src/helpers/project-generation/install-dependencies.ts
1923
- async function installDependencies({ projectDir, packageManager, addons = [] }) {
1961
+ async function installDependencies({ projectDir, packageManager }) {
1924
1962
  const s = spinner();
1925
1963
  try {
1926
1964
  s.start(`Running ${packageManager} install...`);
@@ -1929,26 +1967,11 @@ async function installDependencies({ projectDir, packageManager, addons = [] })
1929
1967
  stderr: "inherit"
1930
1968
  })`${packageManager} install`;
1931
1969
  s.stop("Dependencies installed successfully");
1932
- if (addons.includes("biome") || addons.includes("husky")) await runBiomeCheck(projectDir, packageManager);
1933
1970
  } catch (error) {
1934
1971
  s.stop(pc.red("Failed to install dependencies"));
1935
1972
  if (error instanceof Error) consola.error(pc.red(`Installation error: ${error.message}`));
1936
1973
  }
1937
1974
  }
1938
- async function runBiomeCheck(projectDir, packageManager) {
1939
- const s = spinner();
1940
- try {
1941
- s.start("Running Biome format check...");
1942
- await $({
1943
- cwd: projectDir,
1944
- stderr: "inherit"
1945
- })`${packageManager} biome check --write .`;
1946
- s.stop("Biome check completed successfully");
1947
- } catch (_error) {
1948
- s.stop(pc.yellow("Biome check encountered issues"));
1949
- log.warn(pc.yellow("Some files may need manual formatting"));
1950
- }
1951
- }
1952
1975
 
1953
1976
  //#endregion
1954
1977
  //#region src/helpers/project-generation/post-installation.ts
@@ -2616,8 +2639,7 @@ async function createProject(options) {
2616
2639
  log.success("Project template successfully scaffolded!");
2617
2640
  if (options.install) await installDependencies({
2618
2641
  projectDir,
2619
- packageManager: options.packageManager,
2620
- addons: options.addons
2642
+ packageManager: options.packageManager
2621
2643
  });
2622
2644
  displayPostInstallInstructions({
2623
2645
  ...options,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-better-t-stack",
3
- "version": "2.16.3",
3
+ "version": "2.16.5",
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",