From 3124a6a571ebfdb82aa1c446793cdf22b8dfa01b Mon Sep 17 00:00:00 2001 From: Aman Varshney Date: Sat, 22 Mar 2025 00:59:10 +0530 Subject: [PATCH] Rename .gitignore to _gitignore and add renaming logic in CLI --- .changeset/huge-cobras-dig.md | 5 +++++ apps/cli/src/helpers/create-project.ts | 9 +++++---- apps/cli/template/base/{.gitignore => _gitignore} | 0 3 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 .changeset/huge-cobras-dig.md rename apps/cli/template/base/{.gitignore => _gitignore} (100%) diff --git a/.changeset/huge-cobras-dig.md b/.changeset/huge-cobras-dig.md new file mode 100644 index 0000000..c5328b9 --- /dev/null +++ b/.changeset/huge-cobras-dig.md @@ -0,0 +1,5 @@ +--- +"create-better-t-stack": patch +--- + +fix .gitignore diff --git a/apps/cli/src/helpers/create-project.ts b/apps/cli/src/helpers/create-project.ts index 7d14439..8620686 100644 --- a/apps/cli/src/helpers/create-project.ts +++ b/apps/cli/src/helpers/create-project.ts @@ -18,13 +18,17 @@ export async function createProject(options: ProjectConfig): Promise { try { await fs.ensureDir(projectDir); - const templateDir = path.join(PKG_ROOT, "template/base"); if (!(await fs.pathExists(templateDir))) { throw new Error(`Template directory not found: ${templateDir}`); } await fs.copy(templateDir, projectDir); + const gitignorePath = path.join(projectDir, "_gitignore"); + if (await fs.pathExists(gitignorePath)) { + await fs.move(gitignorePath, path.join(projectDir, ".gitignore")); + } + if (options.auth) { const authTemplateDir = path.join(PKG_ROOT, "template/with-auth"); if (await fs.pathExists(authTemplateDir)) { @@ -40,7 +44,6 @@ export async function createProject(options: ProjectConfig): Promise { if (await fs.pathExists(ormTemplateDir)) { await fs.copy(ormTemplateDir, projectDir, { overwrite: true }); - const serverSrcPath = path.join(projectDir, "packages/server/src"); const baseLibPath = path.join(serverSrcPath, "lib"); const withAuthLibPath = path.join(serverSrcPath, "with-auth-lib"); @@ -80,7 +83,6 @@ export async function createProject(options: ProjectConfig): Promise { } } else { await fs.remove(withAuthLibPath); - if (options.orm === "prisma") { const withAuthSchema = path.join( projectDir, @@ -108,7 +110,6 @@ export async function createProject(options: ProjectConfig): Promise { options.orm, options.turso ?? options.database === "sqlite", ); - await setupAuth(projectDir, options.auth); await setupEnvironmentVariables(projectDir, options); diff --git a/apps/cli/template/base/.gitignore b/apps/cli/template/base/_gitignore similarity index 100% rename from apps/cli/template/base/.gitignore rename to apps/cli/template/base/_gitignore