Closed johnnytomcat closed 4 years ago
Seems like a sensible thing to do. NPM actually uses this package: https://www.npmjs.com/package/stringify-package to write out package.json files. Maybe we should consider using it instead?
You can see the usage here: https://github.com/npm/cli/blob/latest/lib/install/save.js#L127
That is an old version of NPM - the repo moved.
Whoever changed CRA must have looked at the same thing you did.
I'm not sure whether we care about supporting different line endings, but stringify-package does: https://github.com/npm/stringify-package/blob/latest/index.js
Also, this would make it easier if they change the default formatting of the package json, since we would just have to update the package.
Either way we end up doing it should fix the problem though so it looks good to me.
@johnnytomcat sorry, i don't really understand the problem, can u explain what's broken without this?
There are few things that I can think of:
I was on a team with an individual who for months would get so frustrated because he couldn't figure out who kept removing the newline from the package.json.
@johnnytomcat did I miss anything?
@brysgo thanks for explaining. Just fyi, the package.json
files are only written if rn-nodeify
modifies them, which should only happen when you call rn-nodeify
for the first time or after changing its call arguments. Still, for those cases, this should help, thanks @johnnytomcat :)
Thanks! @brysgo you nailed the issue we were running into. This is the exact reason for this change.
@mvayngrib Can we make a release with this in it?
@johnnytomcat yep, released immediately after merging, see version 10.2.0
Thank you!
Related to https://github.com/yarnpkg/yarn/issues/2675