Skip to content

Commit 5e20990

Browse files
committed
Merge branch 'main' into fix/tests
# Conflicts: # apps/cli/test/config-package.test.ts # apps/cli/test/deployment.test.ts
2 parents 3eb883d + 3a23b07 commit 5e20990

File tree

97 files changed

+1536
-1922
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+1536
-1922
lines changed

apps/cli/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Follow the prompts to configure your project or use the `--yes` flag for default
3838
| **Runtime** | • Bun<br>• Node.js<br>• Cloudflare Workers<br>• None |
3939
| **Database** | • SQLite<br>• PostgreSQL<br>• MySQL<br>• MongoDB<br>• None |
4040
| **ORM** | • Drizzle (TypeScript-first)<br>• Prisma (feature-rich)<br>• Mongoose (for MongoDB)<br>• None |
41-
| **Database Setup** | • Turso (SQLite)<br>• Cloudflare D1 (SQLite)<br>• Neon (PostgreSQL)<br>• Supabase (PostgreSQL)<br>• Prisma Postgres (via Prisma Accelerate)<br>• MongoDB Atlas<br>• None (manual setup) |
41+
| **Database Setup** | • Turso (SQLite)<br>• Cloudflare D1 (SQLite)<br>• Neon (PostgreSQL)<br>• Supabase (PostgreSQL)<br>• Prisma Postgres<br>• MongoDB Atlas<br>• None (manual setup) |
4242
| **Authentication** | Better-Auth (email/password, with more options coming soon) |
4343
| **Styling** | Tailwind CSS with shadcn/ui components |
4444
| **Addons** | • PWA support<br>• Tauri (desktop applications)<br>• Starlight (documentation site)<br>• Biome (linting and formatting)<br>• Husky (Git hooks)<br>• Turborepo (optimized builds) |

apps/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "create-better-t-stack",
3-
"version": "3.4.1",
3+
"version": "3.6.4",
44
"description": "A modern CLI tool for scaffolding end-to-end type-safe TypeScript projects with best practices and customizable configurations",
55
"type": "module",
66
"license": "MIT",

apps/cli/src/constants.ts

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ export function getDefaultConfig() {
4040
export const DEFAULT_CONFIG = getDefaultConfig();
4141

4242
export const dependencyVersionMap = {
43-
"better-auth": "^1.3.28",
44-
"@better-auth/expo": "^1.3.28",
43+
"better-auth": "^1.4.0",
44+
"@better-auth/expo": "^1.4.0",
4545

4646
"@clerk/nextjs": "^6.31.5",
4747
"@clerk/clerk-react": "^5.45.0",
@@ -53,22 +53,26 @@ export const dependencyVersionMap = {
5353
"@planetscale/database": "^1.19.0",
5454

5555
"@libsql/client": "^0.14.0",
56+
libsql: "^0.5.22",
5657

57-
"@neondatabase/serverless": "^1.0.1",
58+
"@neondatabase/serverless": "^1.0.2",
5859
pg: "^8.14.1",
5960
"@types/pg": "^8.11.11",
6061
"@types/ws": "^8.18.1",
6162
ws: "^8.18.3",
6263

6364
mysql2: "^3.14.0",
6465

65-
"@prisma/client": "^6.15.0",
66-
prisma: "^6.15.0",
67-
"@prisma/adapter-d1": "^6.15.0",
68-
"@prisma/extension-accelerate": "^2.0.2",
69-
"@prisma/adapter-libsql": "^6.15.0",
70-
71-
"@prisma/adapter-planetscale": "^6.15.0",
66+
"@prisma/client": "^7.0.0",
67+
prisma: "^7.0.0",
68+
"@prisma/adapter-d1": "^7.0.0",
69+
"@prisma/adapter-neon": "^7.0.0",
70+
"@prisma/adapter-mariadb": "^7.0.0",
71+
"@prisma/adapter-libsql": "^7.0.0",
72+
"@prisma/adapter-better-sqlite3": "^7.0.0",
73+
"@prisma/adapter-pg": "^7.0.0",
74+
"@prisma/adapter-planetscale": "^7.0.0",
75+
"@prisma/adapter-ppg": "^7.0.0",
7276

7377
mongoose: "^8.14.0",
7478

@@ -128,12 +132,12 @@ export const dependencyVersionMap = {
128132

129133
next: "15.5.4",
130134

131-
convex: "^1.27.0",
132-
"@convex-dev/react-query": "^0.0.0-alpha.8",
133-
"convex-svelte": "^0.0.11",
135+
convex: "^1.29.3",
136+
"@convex-dev/react-query": "^0.1.0",
137+
"convex-svelte": "^0.0.12",
134138
"convex-nuxt": "0.1.5",
135139
"convex-vue": "^0.1.5",
136-
"@convex-dev/better-auth": "^0.9.1",
140+
"@convex-dev/better-auth": "^0.9.7",
137141

138142
"@tanstack/svelte-query": "^5.85.3",
139143
"@tanstack/svelte-query-devtools": "^5.85.3",
@@ -158,7 +162,7 @@ export const dependencyVersionMap = {
158162
alchemy: "^0.77.0",
159163

160164
dotenv: "^17.2.2",
161-
tsdown: "^0.15.5",
165+
tsdown: "^0.16.5",
162166
zod: "^4.1.11",
163167
srvx: "0.8.15",
164168

apps/cli/src/helpers/core/auth-setup.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ export async function setupAuth(config: ProjectConfig) {
5959
if (convexBackendDirExists) {
6060
await addPackageDependency({
6161
dependencies: ["better-auth", "@convex-dev/better-auth"],
62-
customDependencies: { "better-auth": "1.3.27" },
62+
customDependencies: { "better-auth": "1.3.34" },
6363
projectDir: convexBackendDir,
6464
});
6565
if (hasNativeForBA) {
6666
await addPackageDependency({
6767
dependencies: ["@better-auth/expo"],
68-
customDependencies: { "@better-auth/expo": "1.3.27" },
68+
customDependencies: { "@better-auth/expo": "1.3.34" },
6969
projectDir: convexBackendDir,
7070
});
7171
}
@@ -81,19 +81,19 @@ export async function setupAuth(config: ProjectConfig) {
8181
if (hasNextJs) {
8282
await addPackageDependency({
8383
dependencies: ["better-auth", "@convex-dev/better-auth"],
84-
customDependencies: { "better-auth": "1.3.27" },
84+
customDependencies: { "better-auth": "1.3.34" },
8585
projectDir: clientDir,
8686
});
8787
} else if (hasTanStackStart) {
8888
await addPackageDependency({
8989
dependencies: ["better-auth", "@convex-dev/better-auth"],
90-
customDependencies: { "better-auth": "1.3.27" },
90+
customDependencies: { "better-auth": "1.3.34" },
9191
projectDir: clientDir,
9292
});
9393
} else if (hasViteReactOther) {
9494
await addPackageDependency({
9595
dependencies: ["better-auth", "@convex-dev/better-auth"],
96-
customDependencies: { "better-auth": "1.3.27" },
96+
customDependencies: { "better-auth": "1.3.34" },
9797
projectDir: clientDir,
9898
});
9999
}
@@ -113,8 +113,8 @@ export async function setupAuth(config: ProjectConfig) {
113113
"@convex-dev/better-auth",
114114
],
115115
customDependencies: {
116-
"better-auth": "1.3.27",
117-
"@better-auth/expo": "1.3.27",
116+
"better-auth": "1.3.34",
117+
"@better-auth/expo": "1.3.34",
118118
},
119119
projectDir: nativeDir,
120120
});

apps/cli/src/helpers/core/backend-setup.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ export async function setupBackendDependencies(config: ProjectConfig) {
77
const { backend, runtime, api, auth, examples, projectDir } = config;
88

99
if (backend === "convex") {
10+
const convexBackendDir = path.join(projectDir, "packages/backend");
11+
await addPackageDependency({
12+
dependencies: ["convex"],
13+
projectDir: convexBackendDir,
14+
});
1015
return;
1116
}
1217

apps/cli/src/helpers/core/command-handlers.ts

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ import {
2525
setupProjectDirectory,
2626
} from "../../utils/project-directory";
2727
import { renderTitle } from "../../utils/render-title";
28+
import {
29+
getTemplateConfig,
30+
getTemplateDescription,
31+
} from "../../utils/templates";
2832
import {
2933
getProvidedFlags,
3034
processAndValidateFlags,
@@ -126,15 +130,41 @@ export async function createProjectHandler(
126130
shouldClearDirectory,
127131
);
128132

129-
const cliInput = {
133+
const originalInput = {
130134
...input,
131135
projectDirectory: input.projectName,
132136
};
133137

134-
const providedFlags = getProvidedFlags(cliInput);
138+
const providedFlags = getProvidedFlags(originalInput);
139+
140+
let cliInput = originalInput;
141+
142+
if (input.template && input.template !== "none") {
143+
const templateConfig = getTemplateConfig(input.template);
144+
if (templateConfig) {
145+
const templateName = input.template.toUpperCase();
146+
const templateDescription = getTemplateDescription(input.template);
147+
log.message(
148+
pc.bold(pc.cyan(`Using template: ${pc.white(templateName)}`)),
149+
);
150+
log.message(pc.dim(` ${templateDescription}`));
151+
const userOverrides: Record<string, unknown> = {};
152+
for (const [key, value] of Object.entries(originalInput)) {
153+
if (value !== undefined) {
154+
userOverrides[key] = value;
155+
}
156+
}
157+
cliInput = {
158+
...templateConfig,
159+
...userOverrides,
160+
template: input.template,
161+
projectDirectory: originalInput.projectDirectory,
162+
};
163+
}
164+
}
135165

136166
let config: ProjectConfig;
137-
if (input.yes) {
167+
if (cliInput.yes) {
138168
const flagConfig = processProvidedFlagsWithoutValidation(
139169
cliInput,
140170
finalBaseName,
@@ -152,7 +182,6 @@ export async function createProjectHandler(
152182

153183
log.info(pc.yellow("Using default/flag options (config prompts skipped):"));
154184
log.message(displayConfig(config));
155-
log.message("");
156185
} else {
157186
const flagConfig = processAndValidateFlags(
158187
cliInput,
@@ -175,7 +204,9 @@ export async function createProjectHandler(
175204
);
176205
}
177206

178-
await createProject(config, { manualDb: input.manualDb });
207+
await createProject(config, {
208+
manualDb: cliInput.manualDb ?? input.manualDb,
209+
});
179210

180211
const reproducibleCommand = generateReproducibleCommand(config);
181212
log.success(

apps/cli/src/helpers/core/create-project.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,12 @@ export async function createProject(
6767

6868
await setupApi(options);
6969

70+
if (isConvex || needsServerSetup) {
71+
await setupBackendDependencies(options);
72+
}
73+
7074
if (!isConvex) {
7175
if (needsServerSetup) {
72-
await setupBackendDependencies(options);
7376
await setupRuntime(options);
7477
}
7578
await setupDatabase(options, cliInput);

apps/cli/src/helpers/core/create-readme.ts

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ function generateDatabaseSetup(
540540
packageManagerRunCmd: string,
541541
orm: ORM,
542542
dbSetup: DatabaseSetup,
543-
serverDeploy?: string,
543+
_serverDeploy?: string,
544544
backend?: string,
545545
) {
546546
if (database === "none") {
@@ -549,7 +549,7 @@ function generateDatabaseSetup(
549549

550550
const isBackendSelf = backend === "self";
551551
const envPath = isBackendSelf ? "apps/web/.env" : "apps/server/.env";
552-
const dbLocalPath = isBackendSelf ? "apps/web" : "apps/server";
552+
const dbLocalPath = "packages/db";
553553

554554
let setup = "## Database Setup\n\n";
555555

@@ -565,9 +565,7 @@ function generateDatabaseSetup(
565565
1. Start the local SQLite database:
566566
${
567567
dbSetup === "d1"
568-
? serverDeploy === "alchemy"
569-
? "D1 local development and migrations are handled automatically by Alchemy during dev and deploy."
570-
: "Local development for a Cloudflare D1 database will already be running as part of the `wrangler dev` command."
568+
? "D1 local development and migrations are handled automatically by Alchemy during dev and deploy."
571569
: `\`\`\`bash
572570
cd ${dbLocalPath} && ${packageManagerRunCmd} db:local
573571
\`\`\`
@@ -679,9 +677,8 @@ function generateScriptsList(
679677
- \`${packageManagerRunCmd} db:studio\`: Open database studio UI`;
680678

681679
if (database === "sqlite" && orm === "drizzle") {
682-
const dbLocalPath = isBackendSelf ? "apps/web" : "apps/server";
683680
scripts += `
684-
- \`cd ${dbLocalPath} && ${packageManagerRunCmd} db:local\`: Start the local SQLite database`;
681+
- \`cd packages/db && ${packageManagerRunCmd} db:local\`: Start the local SQLite database`;
685682
}
686683
}
687684

@@ -765,18 +762,5 @@ function generateDeploymentCommands(
765762
}
766763
}
767764

768-
if (webDeploy === "wrangler" || serverDeploy === "wrangler") {
769-
lines.push("\n## Deployment (Cloudflare Wrangler)");
770-
if (webDeploy === "wrangler") {
771-
lines.push(`- Web deploy: cd apps/web && ${packageManagerRunCmd} deploy`);
772-
}
773-
if (serverDeploy === "wrangler") {
774-
lines.push(
775-
`- Server dev: cd apps/server && ${packageManagerRunCmd} dev`,
776-
`- Server deploy: cd apps/server && ${packageManagerRunCmd} deploy`,
777-
);
778-
}
779-
}
780-
781765
return lines.length ? `\n${lines.join("\n")}\n` : "";
782766
}

0 commit comments

Comments
 (0)