create-better-t-stack 2.26.5 → 2.27.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/index.js +65 -22
- package/package.json +1 -1
- package/templates/addons/pwa/apps/web/next/public/favicon/apple-touch-icon.png +0 -0
- package/templates/addons/pwa/apps/web/next/public/favicon/favicon-96x96.png +0 -0
- package/templates/addons/pwa/apps/web/next/public/favicon/web-app-manifest-192x192.png +0 -0
- package/templates/addons/pwa/apps/web/next/public/favicon/web-app-manifest-512x512.png +0 -0
- package/templates/addons/pwa/apps/web/vite/public/logo.png +0 -0
- package/templates/backend/server/server-base/package.json.hbs +1 -1
- package/templates/frontend/native/native-base/assets/favicon.png +0 -0
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { cancel, confirm, group, intro, isCancel, log, multiselect, outro,
|
|
2
|
+
import { cancel, confirm, group, intro, isCancel, log, multiselect, outro, select, spinner, text } from "@clack/prompts";
|
|
3
3
|
import consola, { consola as consola$1 } from "consola";
|
|
4
4
|
import pc from "picocolors";
|
|
5
5
|
import { createCli, trpcServer } from "trpc-cli";
|
|
@@ -60,8 +60,9 @@ const dependencyVersionMap = {
|
|
|
60
60
|
"@types/ws": "^8.18.1",
|
|
61
61
|
ws: "^8.18.3",
|
|
62
62
|
mysql2: "^3.14.0",
|
|
63
|
-
"@prisma/client": "^6.
|
|
64
|
-
prisma: "^6.
|
|
63
|
+
"@prisma/client": "^6.12.0",
|
|
64
|
+
prisma: "^6.12.0",
|
|
65
|
+
"@prisma/extension-accelerate": "^2.0.2",
|
|
65
66
|
mongoose: "^8.14.0",
|
|
66
67
|
"vite-plugin-pwa": "^1.0.1",
|
|
67
68
|
"@vite-pwa/assets-generator": "^1.0.0",
|
|
@@ -91,7 +92,6 @@ const dependencyVersionMap = {
|
|
|
91
92
|
"@ai-sdk/vue": "^1.2.8",
|
|
92
93
|
"@ai-sdk/svelte": "^2.1.9",
|
|
93
94
|
"@ai-sdk/react": "^1.2.12",
|
|
94
|
-
"@prisma/extension-accelerate": "^1.3.0",
|
|
95
95
|
"@orpc/server": "^1.5.0",
|
|
96
96
|
"@orpc/client": "^1.5.0",
|
|
97
97
|
"@orpc/tanstack-query": "^1.5.0",
|
|
@@ -546,11 +546,11 @@ async function getDBSetupChoice(databaseType, dbSetup, orm, backend, runtime) {
|
|
|
546
546
|
label: "Supabase",
|
|
547
547
|
hint: "Local Supabase stack (requires Docker)"
|
|
548
548
|
},
|
|
549
|
-
|
|
549
|
+
{
|
|
550
550
|
value: "prisma-postgres",
|
|
551
551
|
label: "Prisma Postgres",
|
|
552
552
|
hint: "Instant Postgres for Global Applications"
|
|
553
|
-
}
|
|
553
|
+
},
|
|
554
554
|
{
|
|
555
555
|
value: "docker",
|
|
556
556
|
label: "Docker",
|
|
@@ -3470,13 +3470,38 @@ async function setupNeonPostgres(config) {
|
|
|
3470
3470
|
|
|
3471
3471
|
//#endregion
|
|
3472
3472
|
//#region src/helpers/database-providers/prisma-postgres-setup.ts
|
|
3473
|
+
async function setupWithCreateDb(serverDir, packageManager, orm) {
|
|
3474
|
+
try {
|
|
3475
|
+
log.info("Starting Prisma PostgreSQL setup. Please follow the instructions below:");
|
|
3476
|
+
const createDbCommand = getPackageExecutionCommand(packageManager, "create-db@latest -i");
|
|
3477
|
+
await execa(createDbCommand, {
|
|
3478
|
+
cwd: serverDir,
|
|
3479
|
+
stdio: "inherit",
|
|
3480
|
+
shell: true
|
|
3481
|
+
});
|
|
3482
|
+
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."));
|
|
3483
|
+
const databaseUrl = await text({
|
|
3484
|
+
message: orm === "drizzle" ? "Paste your database URL (append ?sslmode=require for Drizzle):" : "Paste your Prisma Postgres database URL:",
|
|
3485
|
+
validate(value) {
|
|
3486
|
+
if (!value) return "Please enter a database URL";
|
|
3487
|
+
if (orm === "drizzle" && !value.includes("?sslmode=require")) return "Please append ?sslmode=require to your database URL when using Drizzle";
|
|
3488
|
+
}
|
|
3489
|
+
});
|
|
3490
|
+
if (isCancel(databaseUrl)) {
|
|
3491
|
+
cancel("Database setup cancelled");
|
|
3492
|
+
return null;
|
|
3493
|
+
}
|
|
3494
|
+
return { databaseUrl };
|
|
3495
|
+
} catch (error) {
|
|
3496
|
+
if (error instanceof Error) consola$1.error(error.message);
|
|
3497
|
+
return null;
|
|
3498
|
+
}
|
|
3499
|
+
}
|
|
3473
3500
|
async function initPrismaDatabase(serverDir, packageManager) {
|
|
3474
|
-
const s = spinner();
|
|
3475
3501
|
try {
|
|
3476
|
-
s.start("Initializing Prisma PostgreSQL...");
|
|
3477
3502
|
const prismaDir = path.join(serverDir, "prisma");
|
|
3478
3503
|
await fs.ensureDir(prismaDir);
|
|
3479
|
-
|
|
3504
|
+
log.info("Starting Prisma PostgreSQL setup. Please follow the instructions below:");
|
|
3480
3505
|
const prismaInitCommand = getPackageExecutionCommand(packageManager, "prisma init --db");
|
|
3481
3506
|
await execa(prismaInitCommand, {
|
|
3482
3507
|
cwd: serverDir,
|
|
@@ -3484,7 +3509,7 @@ async function initPrismaDatabase(serverDir, packageManager) {
|
|
|
3484
3509
|
shell: true
|
|
3485
3510
|
});
|
|
3486
3511
|
log.info(pc.yellow("Please copy the Prisma Postgres URL from the output above.\nIt looks like: prisma+postgres://accelerate.prisma-data.net/?api_key=..."));
|
|
3487
|
-
const databaseUrl = await
|
|
3512
|
+
const databaseUrl = await text({
|
|
3488
3513
|
message: "Paste your Prisma Postgres database URL:",
|
|
3489
3514
|
validate(value) {
|
|
3490
3515
|
if (!value) return "Please enter a database URL";
|
|
@@ -3497,7 +3522,6 @@ async function initPrismaDatabase(serverDir, packageManager) {
|
|
|
3497
3522
|
}
|
|
3498
3523
|
return { databaseUrl };
|
|
3499
3524
|
} catch (error) {
|
|
3500
|
-
s.stop(pc.red("Prisma PostgreSQL initialization failed"));
|
|
3501
3525
|
if (error instanceof Error) consola$1.error(error.message);
|
|
3502
3526
|
return null;
|
|
3503
3527
|
}
|
|
@@ -3557,19 +3581,39 @@ export default prisma;
|
|
|
3557
3581
|
}
|
|
3558
3582
|
}
|
|
3559
3583
|
async function setupPrismaPostgres(config) {
|
|
3560
|
-
const { packageManager, projectDir } = config;
|
|
3584
|
+
const { packageManager, projectDir, orm } = config;
|
|
3561
3585
|
const serverDir = path.join(projectDir, "apps/server");
|
|
3562
|
-
const s = spinner();
|
|
3563
|
-
s.start("Setting up Prisma PostgreSQL...");
|
|
3564
3586
|
try {
|
|
3565
3587
|
await fs.ensureDir(serverDir);
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3588
|
+
const setupOptions = [{
|
|
3589
|
+
label: "Quick setup with create-db",
|
|
3590
|
+
value: "create-db",
|
|
3591
|
+
hint: "Fastest, automated database creation"
|
|
3592
|
+
}];
|
|
3593
|
+
if (orm === "prisma") setupOptions.push({
|
|
3594
|
+
label: "Custom setup with Prisma Console",
|
|
3595
|
+
value: "custom",
|
|
3596
|
+
hint: "More control - use existing Prisma account"
|
|
3597
|
+
});
|
|
3598
|
+
const setupMethod = await select({
|
|
3599
|
+
message: "Choose your Prisma setup method:",
|
|
3600
|
+
options: setupOptions,
|
|
3601
|
+
initialValue: "create-db"
|
|
3602
|
+
});
|
|
3603
|
+
if (isCancel(setupMethod)) {
|
|
3604
|
+
cancel(pc.red("Operation cancelled"));
|
|
3605
|
+
process.exit(0);
|
|
3606
|
+
}
|
|
3607
|
+
let prismaConfig = null;
|
|
3608
|
+
if (setupMethod === "create-db") prismaConfig = await setupWithCreateDb(serverDir, packageManager, orm);
|
|
3609
|
+
else prismaConfig = await initPrismaDatabase(serverDir, packageManager);
|
|
3610
|
+
if (prismaConfig) {
|
|
3611
|
+
await writeEnvFile$1(projectDir, prismaConfig);
|
|
3612
|
+
if (orm === "prisma") {
|
|
3613
|
+
await addPrismaAccelerateExtension(serverDir);
|
|
3614
|
+
log.info(pc.cyan("NOTE: Make sure to uncomment `import \"dotenv/config\";` in `apps/server/src/prisma.config.ts` to load environment variables."));
|
|
3615
|
+
}
|
|
3571
3616
|
log.success(pc.green("Prisma PostgreSQL database configured successfully!"));
|
|
3572
|
-
log.info(pc.cyan("NOTE: Make sure to uncomment `import \"dotenv/config\";` in `apps/server/src/prisma.config.ts` to load environment variables."));
|
|
3573
3617
|
} else {
|
|
3574
3618
|
const fallbackSpinner = spinner();
|
|
3575
3619
|
fallbackSpinner.start("Setting up fallback configuration...");
|
|
@@ -3578,7 +3622,6 @@ async function setupPrismaPostgres(config) {
|
|
|
3578
3622
|
displayManualSetupInstructions$1();
|
|
3579
3623
|
}
|
|
3580
3624
|
} catch (error) {
|
|
3581
|
-
s.stop(pc.red("Prisma PostgreSQL setup failed"));
|
|
3582
3625
|
consola$1.error(pc.red(`Error during Prisma PostgreSQL setup: ${error instanceof Error ? error.message : String(error)}`));
|
|
3583
3626
|
try {
|
|
3584
3627
|
await writeEnvFile$1(projectDir);
|
|
@@ -3982,7 +4025,7 @@ async function setupDatabase(config) {
|
|
|
3982
4025
|
else if (database === "sqlite" && dbSetup === "turso") await setupTurso(config);
|
|
3983
4026
|
else if (database === "sqlite" && dbSetup === "d1") await setupCloudflareD1(config);
|
|
3984
4027
|
else if (database === "postgres") {
|
|
3985
|
-
if (
|
|
4028
|
+
if (dbSetup === "prisma-postgres") await setupPrismaPostgres(config);
|
|
3986
4029
|
else if (dbSetup === "neon") await setupNeonPostgres(config);
|
|
3987
4030
|
else if (dbSetup === "supabase") await setupSupabase(config);
|
|
3988
4031
|
} else if (database === "mongodb" && dbSetup === "mongodb-atlas") await setupMongoDBAtlas(config);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-better-t-stack",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.27.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",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|