Skip to content

Fix TOML path targeting and formatting loss with toml-patch - #53

Merged
webpro merged 4 commits into
release-it:masterfrom
JamesMBarr:52-fix-handing-path-for-toml-files
May 23, 2026
Merged

Fix TOML path targeting and formatting loss with toml-patch#53
webpro merged 4 commits into
release-it:masterfrom
JamesMBarr:52-fix-handing-path-for-toml-files

Conversation

@JamesMBarr

Copy link
Copy Markdown
Contributor

This MR replaces the use of regex, which was introduced to maintain the original file format, with a TOML patching engine via “@decimalturn/toml-patch”. This ensures that only values under the path(s) are modified whilst preserving file comments and format.

Additionally, the tests for TOML files were aligned to match the tests for JSON files with some refactoring to reduce the boierplate in each test.

Note, “@decimalturn/toml-patch” has a reasonably small community footprint but appears to be actively maintained. Another option could be “@shopify/toml-patch” but I felt like it might be too immature.

Introduces `@decimalturn/toml-patch` to update TOML versions without
destroying original formatting or stripping inline comments.

While this package has a smaller community footprint than alternative
options (like `@shopify/toml-patch`), it offers a stable semver release.
@webpro
webpro merged commit 5ee5ad6 into release-it:master May 23, 2026
6 checks passed
@JamesMBarr
JamesMBarr deleted the 52-fix-handing-path-for-toml-files branch May 26, 2026 18:56
@webpro

webpro commented May 30, 2026

Copy link
Copy Markdown
Contributor

🚀 This pull request is included in v7.0.6. See Release 7.0.6 for release notes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants