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
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
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(
|
|
1596
|
+
if (isCancel(setupMethod)) {
|
|
1577
1597
|
cancel(pc.red("Operation cancelled"));
|
|
1578
1598
|
process.exit(0);
|
|
1579
1599
|
}
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
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.
|
|
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",
|