fix: .gitignore missing trailing newline during project initialization (#855)
This commit is contained in:
5
.changeset/major-dogs-admire.md
Normal file
5
.changeset/major-dogs-admire.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"task-master-ai": patch
|
||||
---
|
||||
|
||||
Fix .gitignore missing trailing newline during project initialization
|
||||
@@ -170,7 +170,7 @@ function validateInputs(targetPath, content, storeTasksInGit) {
|
||||
*/
|
||||
function createNewGitignoreFile(targetPath, templateLines, log) {
|
||||
try {
|
||||
fs.writeFileSync(targetPath, templateLines.join('\n'));
|
||||
fs.writeFileSync(targetPath, templateLines.join('\n') + '\n');
|
||||
if (typeof log === 'function') {
|
||||
log('success', `Created ${targetPath} with full template`);
|
||||
}
|
||||
@@ -223,7 +223,7 @@ function mergeWithExistingFile(
|
||||
finalLines.push(...buildTaskFilesSection(storeTasksInGit));
|
||||
|
||||
// Write result
|
||||
fs.writeFileSync(targetPath, finalLines.join('\n'));
|
||||
fs.writeFileSync(targetPath, finalLines.join('\n') + '\n');
|
||||
|
||||
if (typeof log === 'function') {
|
||||
const hasNewContent =
|
||||
|
||||
@@ -179,7 +179,8 @@ logs
|
||||
|
||||
# Task files
|
||||
# tasks.json
|
||||
# tasks/ `
|
||||
# tasks/
|
||||
`
|
||||
);
|
||||
expect(mockLog).toHaveBeenCalledWith(
|
||||
'success',
|
||||
@@ -200,7 +201,8 @@ logs
|
||||
|
||||
# Task files
|
||||
tasks.json
|
||||
tasks/ `
|
||||
tasks/
|
||||
`
|
||||
);
|
||||
expect(mockLog).toHaveBeenCalledWith(
|
||||
'success',
|
||||
@@ -432,7 +434,8 @@ tasks/ `;
|
||||
const writtenContent = writeFileSyncSpy.mock.calls[0][1];
|
||||
expect(writtenContent).toBe(`# Task files
|
||||
# tasks.json
|
||||
# tasks/ `);
|
||||
# tasks/
|
||||
`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user