Skip to content

Commit

Permalink
fix: add newline in package.json (#94)
Browse files Browse the repository at this point in the history
The initial version of the package.json file does not contain a newline at the end. This means that the first time a user modifies the file using either an IDE that inserts trailing newlines or using Yarn, the last line will be changed and visible in version control. This is not a big deal, but it is annoying and shows a lack of polish.

I tested this by manually patching this file in a current version of React Native because there is currently no way to test the master of RN and RN cli together.
  • Loading branch information
cpojer authored and thymikee committed Jan 16, 2019
1 parent 1cb78bb commit 90b9d83
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/local-cli/init/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,10 @@ function addJestToPackageJson(destinationRoot) {
packageJSON.jest = {
preset: 'react-native',
};
fs.writeFileSync(packageJSONPath, JSON.stringify(packageJSON, null, 2));
fs.writeFileSync(
packageJSONPath,
`${JSON.stringify(packageJSON, null, 2)}\n`
);
}

module.exports = init;

0 comments on commit 90b9d83

Please sign in to comment.