mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
refactor(cli): simplify database selection flags
This commit is contained in:
5
.changeset/real-pillows-beam.md
Normal file
5
.changeset/real-pillows-beam.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"create-better-t-stack": patch
|
||||
---
|
||||
|
||||
refactor(cli): simplify database selection flags
|
||||
@@ -8,7 +8,7 @@ export const PKG_ROOT = path.join(distPath, "../");
|
||||
|
||||
export const DEFAULT_CONFIG: ProjectConfig = {
|
||||
projectName: "my-better-t-app",
|
||||
database: "libsql",
|
||||
database: "sqlite",
|
||||
auth: true,
|
||||
features: [],
|
||||
git: true,
|
||||
|
||||
@@ -50,7 +50,7 @@ export async function createProject(options: ProjectConfig) {
|
||||
|
||||
await tasks(tasksList);
|
||||
|
||||
if (options.database === "libsql") {
|
||||
if (options.database === "sqlite") {
|
||||
await setupTurso(projectDir);
|
||||
}
|
||||
|
||||
|
||||
@@ -90,9 +90,9 @@ async function gatherConfig(
|
||||
message: "Which database would you like to use?",
|
||||
options: [
|
||||
{
|
||||
value: "libsql",
|
||||
label: "libSQL",
|
||||
hint: "Turso's embedded SQLite database (recommended)",
|
||||
value: "sqlite",
|
||||
label: "SQLite",
|
||||
hint: "by Turso (recommended)",
|
||||
},
|
||||
{
|
||||
value: "postgres",
|
||||
@@ -232,7 +232,8 @@ async function main() {
|
||||
.version(getVersion())
|
||||
.argument("[project-directory]", "Project name/directory")
|
||||
.option("-y, --yes", "Use default configuration")
|
||||
.option("--database <type>", "Database type (libsql or postgres)")
|
||||
.option("--sqlite", "Use SQLite database")
|
||||
.option("--postgres", "Use PostgreSQL database")
|
||||
.option("--auth", "Include authentication")
|
||||
.option("--no-auth", "Exclude authentication")
|
||||
.option("--docker", "Include Docker setup")
|
||||
@@ -251,7 +252,11 @@ async function main() {
|
||||
|
||||
const flagConfig: Partial<ProjectConfig> = {
|
||||
projectName: projectDirectory || undefined,
|
||||
database: options.database as ProjectDatabase | undefined,
|
||||
database: options.sqlite
|
||||
? "sqlite"
|
||||
: options.postgres
|
||||
? "postgres"
|
||||
: undefined,
|
||||
auth: "auth" in options ? options.auth : undefined,
|
||||
packageManager: options.npm
|
||||
? "npm"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export type ProjectFeature = "docker" | "github-actions" | "SEO";
|
||||
|
||||
export type ProjectDatabase = "libsql" | "postgres";
|
||||
export type ProjectDatabase = "sqlite" | "postgres";
|
||||
|
||||
export type PackageManager = "npm" | "yarn" | "pnpm" | "bun";
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ export function generateReproducibleCommand(config: ProjectConfig): string {
|
||||
}
|
||||
|
||||
if (config.database !== DEFAULT_CONFIG.database) {
|
||||
flags.push(`--database ${config.database}`);
|
||||
flags.push(config.database === "sqlite" ? "--sqlite" : "--postgres");
|
||||
}
|
||||
|
||||
if (config.auth !== DEFAULT_CONFIG.auth) {
|
||||
|
||||
@@ -17,8 +17,6 @@ export const TITLE_TEXT = `
|
||||
║ ██║ ███████║ ██║ ██║ ██║╚██████╗██║ ██╗ ║
|
||||
║ ╚═╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ║
|
||||
║ ║
|
||||
║ The Modern Full-Stack Framework ║
|
||||
║ ║
|
||||
╚════════════════════════════════════════════════════════════╝
|
||||
`;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user