New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prefer package.json5 over package.json #3027
Comments
I guess the order change would be done in these two places? pnpm/packages/read-project-manifest/src/index.ts Lines 60 to 89 in f9befbf
pnpm/packages/find-packages/src/index.ts Lines 76 to 81 in f9befbf
|
Ooooh, this seems like a blocker #2008 before this precedence would matter much. |
I guess I don't have objections to change the order but I am also not sure it was a good idea to add json5/yaml support. I received a lot of criticism on Twitter for that. cc @pnpm/collaborators |
Let's imagine you have |
pnpm converts those files to regular json files before publish |
What was exactly the thoughts other shared? |
I'd vote for not doing anything that can break workflows. So could this maybe be solved with an opt-in CLI flag? |
I recommend JSOX/JSON6: https://github.com/d3x0r/jsox |
Whatever new format are chosen for support, the benefits of human-readability crucially include ordered-member and trivia (whitespace and comments) preservation when the package file is subjected to automated changes (like I imagine that the simplest way to support this is for the package file updater to merge the newly calculated javascript object data into the original file as a final step - and this will require a parser library with support for merging ASTs with trivia. Are there any next gen notation formats that can provide this? I don't see these features in json5, json6, jsox, jsonc. hjson has |
IMO it's nice to have in theory, but it's not really useful in practice if you need or want to:
There are probably a lot of people -- maybe even most -- that are fine with the tradeoffs, but I think the presence of a However, removing support would also be a large breaking change for people that rely on it, so if |
@bdchauvette the world as to keep turning somehow! If pnpm is the near future of package management, then it seems that support for a new format would have to start here, no? |
I must be missing something, but what I see in your link is a short criticism from a single individual (and nothing unexpected). Thank you for that addition (and thanks Jason for this report) |
I think its worthy of a config setting. When using We should add a hook called |
I agree with this change for the reasons I've explained in #5541 (comment) (which seems to be a duplicate issue).
Some would agree with this, others wouldn't. Personally, I've forked |
pnpm version: 5.13.6
Code to reproduce the issue:
"preinstall": "npx only-allow pnpm"
documented at https://pnpm.js.org/en/only-allow-pnpm is awesome! However it seems impossible to use it in conjunction withpackage.json5
's file extension and its lovely support for comments AND protect against package managers such as yarn which do not recognize .json5.I thought I'd be clever and create a package.json file that has ONLY the following (in addition to the same script in my package.json5):
But unfortunately, pnpm seems to prefer package.json over package.json5. Also, as appropriate, pnpm errors on comments in .json files, so we can't just pretend it's json5/jsonc.
Expected behavior:
pnpm should prefer package.json5 (and yaml) over package.json as the newer and more capable formats.
Actual behavior:
pnpm seems to prefer package.json over package.json5 (and yaml)
The text was updated successfully, but these errors were encountered: