I’m a contributor to the Apache Cordova project, which uses npm for handling the installation of output platforms and plugins. As part of this, we store some additional project-specific configuration information in package.json under a
One frequent complaint is that whenever Cordova makes changes to package.json, things like indents and newlines can end up getting reformatted due to
JSON.stringify behaviour. Ideally we want to match the behaviour of the npm CLI.
I spent some time yesterday digging into how npm formats the package.json after updating it, and conveniently there’s a util for stringifying and formatting the package: stringify-package
Unfortunately, it’s internal to the CLI, so I need to duplicate it if I want to have the same behaviour, and then it runs the risk of getting out of sync with npm’s version. I’d like to propose splitting stringify-package out into its own module so that it could be used by other projects without the risk of implementations getting out of sync.
I’m happy to do the work of making a new repo (preserving commit history for that file) and setting it up, but I feel like it probably makes sense for the npm team to own the repo and package. Is there interest in me setting up a repo for this, to be transferred to the npm team when everyone’s happy with it?