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) {
|
function createNewGitignoreFile(targetPath, templateLines, log) {
|
||||||
try {
|
try {
|
||||||
fs.writeFileSync(targetPath, templateLines.join('\n'));
|
fs.writeFileSync(targetPath, templateLines.join('\n') + '\n');
|
||||||
if (typeof log === 'function') {
|
if (typeof log === 'function') {
|
||||||
log('success', `Created ${targetPath} with full template`);
|
log('success', `Created ${targetPath} with full template`);
|
||||||
}
|
}
|
||||||
@@ -223,7 +223,7 @@ function mergeWithExistingFile(
|
|||||||
finalLines.push(...buildTaskFilesSection(storeTasksInGit));
|
finalLines.push(...buildTaskFilesSection(storeTasksInGit));
|
||||||
|
|
||||||
// Write result
|
// Write result
|
||||||
fs.writeFileSync(targetPath, finalLines.join('\n'));
|
fs.writeFileSync(targetPath, finalLines.join('\n') + '\n');
|
||||||
|
|
||||||
if (typeof log === 'function') {
|
if (typeof log === 'function') {
|
||||||
const hasNewContent =
|
const hasNewContent =
|
||||||
|
|||||||
@@ -179,7 +179,8 @@ logs
|
|||||||
|
|
||||||
# Task files
|
# Task files
|
||||||
# tasks.json
|
# tasks.json
|
||||||
# tasks/ `
|
# tasks/
|
||||||
|
`
|
||||||
);
|
);
|
||||||
expect(mockLog).toHaveBeenCalledWith(
|
expect(mockLog).toHaveBeenCalledWith(
|
||||||
'success',
|
'success',
|
||||||
@@ -200,7 +201,8 @@ logs
|
|||||||
|
|
||||||
# Task files
|
# Task files
|
||||||
tasks.json
|
tasks.json
|
||||||
tasks/ `
|
tasks/
|
||||||
|
`
|
||||||
);
|
);
|
||||||
expect(mockLog).toHaveBeenCalledWith(
|
expect(mockLog).toHaveBeenCalledWith(
|
||||||
'success',
|
'success',
|
||||||
@@ -432,7 +434,8 @@ tasks/ `;
|
|||||||
const writtenContent = writeFileSyncSpy.mock.calls[0][1];
|
const writtenContent = writeFileSyncSpy.mock.calls[0][1];
|
||||||
expect(writtenContent).toBe(`# Task files
|
expect(writtenContent).toBe(`# Task files
|
||||||
# tasks.json
|
# tasks.json
|
||||||
# tasks/ `);
|
# tasks/
|
||||||
|
`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user