Skip to content

Commit

Permalink
get rid of extra variable
Browse files Browse the repository at this point in the history
  • Loading branch information
dario-piotrowicz committed Mar 1, 2024
1 parent 1d52383 commit 4f17d75
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/create-cloudflare/src/templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -480,18 +480,17 @@ export const getCopyFilesDestinationDir = (

export const addWranglerToGitIgnore = (ctx: C3Context) => {
const gitIgnorePath = `${ctx.project.path}/.gitignore`;
const gitIgnoreExists = existsSync(gitIgnorePath);
const gitIgnorePreExisted = existsSync(gitIgnorePath);

const gitDirExists = directoryExists(`${ctx.project.path}/.git`);

if (!gitIgnoreExists && !gitDirExists) {
if (!gitIgnorePreExisted && !gitDirExists) {
// if there is no .gitIgnore file and neither a .git directory
// bail as the project is likely not targeting/using git
return;
}

const fileExisted = gitIgnoreExists;
if (!fileExisted) {
if (!gitIgnorePreExisted) {
writeFile(gitIgnorePath, "");
}

Expand Down Expand Up @@ -528,7 +527,7 @@ export const addWranglerToGitIgnore = (ctx: C3Context) => {
appendFile(gitIgnorePath, linesToAppend.join("\n"));

s.stop(
`${brandColor(fileExisted ? "updated" : "created")} ${dim(
`${brandColor(gitIgnorePreExisted ? "updated" : "created")} ${dim(
".gitignore file"
)}`
);
Expand Down

0 comments on commit 4f17d75

Please sign in to comment.