Skip to content

Commit 64fc644

Browse files
refactor(cli): simplify database selection flags
1 parent 6d03d6b commit 64fc644

File tree

7 files changed

+19
-11
lines changed

7 files changed

+19
-11
lines changed

.changeset/real-pillows-beam.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"create-better-t-stack": patch
3+
---
4+
5+
refactor(cli): simplify database selection flags

apps/cli/src/consts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const PKG_ROOT = path.join(distPath, "../");
88

99
export const DEFAULT_CONFIG: ProjectConfig = {
1010
projectName: "my-better-t-app",
11-
database: "libsql",
11+
database: "sqlite",
1212
auth: true,
1313
features: [],
1414
git: true,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export async function createProject(options: ProjectConfig) {
5050

5151
await tasks(tasksList);
5252

53-
if (options.database === "libsql") {
53+
if (options.database === "sqlite") {
5454
await setupTurso(projectDir);
5555
}
5656

apps/cli/src/index.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ async function gatherConfig(
9090
message: "Which database would you like to use?",
9191
options: [
9292
{
93-
value: "libsql",
94-
label: "libSQL",
95-
hint: "Turso's embedded SQLite database (recommended)",
93+
value: "sqlite",
94+
label: "SQLite",
95+
hint: "by Turso (recommended)",
9696
},
9797
{
9898
value: "postgres",
@@ -232,7 +232,8 @@ async function main() {
232232
.version(getVersion())
233233
.argument("[project-directory]", "Project name/directory")
234234
.option("-y, --yes", "Use default configuration")
235-
.option("--database <type>", "Database type (libsql or postgres)")
235+
.option("--sqlite", "Use SQLite database")
236+
.option("--postgres", "Use PostgreSQL database")
236237
.option("--auth", "Include authentication")
237238
.option("--no-auth", "Exclude authentication")
238239
.option("--docker", "Include Docker setup")
@@ -251,7 +252,11 @@ async function main() {
251252

252253
const flagConfig: Partial<ProjectConfig> = {
253254
projectName: projectDirectory || undefined,
254-
database: options.database as ProjectDatabase | undefined,
255+
database: options.sqlite
256+
? "sqlite"
257+
: options.postgres
258+
? "postgres"
259+
: undefined,
255260
auth: "auth" in options ? options.auth : undefined,
256261
packageManager: options.npm
257262
? "npm"

apps/cli/src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export type ProjectFeature = "docker" | "github-actions" | "SEO";
22

3-
export type ProjectDatabase = "libsql" | "postgres";
3+
export type ProjectDatabase = "sqlite" | "postgres";
44

55
export type PackageManager = "npm" | "yarn" | "pnpm" | "bun";
66

apps/cli/src/utils/generate-reproducible-command.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export function generateReproducibleCommand(config: ProjectConfig): string {
1515
}
1616

1717
if (config.database !== DEFAULT_CONFIG.database) {
18-
flags.push(`--database ${config.database}`);
18+
flags.push(config.database === "sqlite" ? "--sqlite" : "--postgres");
1919
}
2020

2121
if (config.auth !== DEFAULT_CONFIG.auth) {

apps/cli/src/utils/render-title.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ export const TITLE_TEXT = `
1717
║ ██║ ███████║ ██║ ██║ ██║╚██████╗██║ ██╗ ║
1818
║ ╚═╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ║
1919
║ ║
20-
║ The Modern Full-Stack Framework ║
21-
║ ║
2220
╚════════════════════════════════════════════════════════════╝
2321
`;
2422

0 commit comments

Comments
 (0)