From a820dd1362f48cd262060505d85e445e179b84e0 Mon Sep 17 00:00:00 2001 From: gonzaloriestra <14979109+gonzaloriestra@users.noreply.github.com> Date: Sat, 18 Jul 2026 00:21:52 +0000 Subject: [PATCH] [Refactor] Declarative createGitIgnore content construction Refactors `createGitIgnore` to build the `.gitignore` content using a declarative `.map().join('')` chain instead of an imperative `for...of` loop with string accumulator. --- packages/cli-kit/src/public/node/git.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/cli-kit/src/public/node/git.ts b/packages/cli-kit/src/public/node/git.ts index 94c10c74aed..a4ad1ebe07b 100644 --- a/packages/cli-kit/src/public/node/git.ts +++ b/packages/cli-kit/src/public/node/git.ts @@ -89,11 +89,9 @@ export function createGitIgnore(directory: string, template: GitIgnoreTemplate): outputDebug(outputContent`Creating .gitignore at ${outputToken.path(directory)}...`) const filePath = `${directory}/.gitignore` - let fileContent = '' - for (const [section, lines] of Object.entries(template)) { - fileContent += `# ${section}\n` - fileContent += `${lines.join('\n')}\n\n` - } + const fileContent = Object.entries(template) + .map(([section, lines]) => `# ${section}\n${lines.join('\n')}\n\n`) + .join('') appendFileSync(filePath, fileContent) }