Skip to content

Commit

Permalink
Add a newline at the end of generated composer.json
Browse files Browse the repository at this point in the history
It is frustrating that every time I edit `composer.json` with a text editor, I get "generated files are out of sync" errors due to `generator` _not_ putting a newline there

(FWIW, POSIX says that text files should always end with a newline character too)
  • Loading branch information
shish committed Feb 10, 2025
1 parent de722d9 commit 0624454
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,4 @@
"cs-fix": "phpcbf",
"cs-check": "phpcs"
}
}
}
2 changes: 1 addition & 1 deletion generator/src/Generator/ComposerJsonEditor.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static function editComposerFileForGeneration(array $modules): void
$composerJson = \json_decode($composerContent, true);
$composerJson['autoload']['files'] = self::editFilesListForGeneration($composerJson['autoload']['files'], $modules);

$newContent = \json_encode($composerJson, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES);
$newContent = \json_encode($composerJson, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES) . "\n";
\file_put_contents(FileCreator::getSafeRootDir() . '/composer.json', $newContent);
}

Expand Down

0 comments on commit 0624454

Please sign in to comment.