Bolt is opinionated about the line endings style – it always uses \n to denote line endings. This PR enables bolt to automatically detect line endings style (\n vs \r\n) using detect-newline and preserve the style when updating / writing to a package.json file
Whenever bolt writes a package.json, it now adds a newline character to the last line, in accordance with the POSIX definition of a line.
Note that these issues have already been fixed by npm (here) and yarn (here), and this just brings bolt's implementation on par.
Motivation
When using prettier or an opinionated editor alongside bolt, there is a constant push and pull between these tools that leads to ghost diffs like these –
This PR fixes a couple of issues with bolt -
Bolt is opinionated about the line endings style – it always uses
\n
to denote line endings. This PR enables bolt to automatically detect line endings style (\n
vs\r\n
) usingdetect-newline
and preserve the style when updating / writing to a package.json fileWhenever bolt writes a package.json, it now adds a newline character to the last line, in accordance with the POSIX definition of a line.
Note that these issues have already been fixed by
npm
(here) andyarn
(here), and this just brings bolt's implementation on par.Motivation
When using prettier or an opinionated editor alongside bolt, there is a constant push and pull between these tools that leads to ghost diffs like these –