Conversation
…space.yaml Ensure that the original formatting (quotes, etc.) in pnpm-workspace.yaml is preserved when running commands like \`pnpm update\`. Closes pnpm#10425
zkochan
left a comment
There was a problem hiding this comment.
I checked locally and your change is not doing anything. The quotes are currently preserved without your fix. I even added a test.
Thanks for checking and for adding a test — I appreciate it. I’ll take another look on my side to better understand why the change isn’t having an effect. Once I’ve verified the behavior and have something concrete, I’ll follow up and mention you again. |
|
@zkochan Thank you for your patience. I've identified the root cause and pushed a fix. The issue was in the The fix ensures
I've verified that the test you added ( When you have a moment, could you please take another look? I'd really appreciate your feedback. |
|
Congrats on merging your first pull request! 🎉🎉🎉 |
….yaml when updating catalogs (#10430) * fix(workspace.manifest-writer): preserve yaml formatting in pnpm-workspace.yaml Ensure that the original formatting (quotes, etc.) in pnpm-workspace.yaml is preserved when running commands like \`pnpm update\`. Close #10425 * docs: add changeset * fix(workspace/manifest-writer): restore formats * test: manifest writer preservers quotes in catalogs * fix(workspace.manifest-writer): only update catalog when values change * fix: remove redundant code * test: adding catalog --------- Co-authored-by: Zoltan Kochan <z@kochan.io>
Description
Fixes an issue where running commands like
pnpm updatecauses unintentional formatting changes inpnpm-workspace.yaml.Problem
When updating dependencies, the
catalogsection lost its original quoting style even when values remained unchanged:Before
pnpm update:After
pnpm update:Root Cause
The issue was in the addCatalogs function (workspace/manifest-writer/src/index.ts):
Solution
Modified addCatalogs to only flag updates when necessary:
This prevents unnecessary in-memory modifications, allowing patchDocument to preserve original YAML formatting.
Closes #10425