Skip to content

Conversation

felipecrs
Copy link
Contributor

@felipecrs felipecrs commented Oct 15, 2025

Changes

This PR leverages the jsonc-morph library to preserve comments and formatting when migrating renovate.json configuration files.

In my opinion this is the last piece missing to make renovate.json the go-to configuration file format for Renovate. Perhaps deprecation of renovate.json5 can be even considered in the future.

Context

Please select one of the below:

AI assistance disclosure

Did you use AI tools to create any part of this pull request?

Please select one option and, if yes, briefly describe how AI was used (e.g., code, tests, docs) and which tool(s) you used.

  • No — I did not use AI for this contribution.
  • Yes — minimal assistance (e.g., IDE autocomplete, small code completions, grammar fixes).
  • Yes — substantive assistance (AI generated non‑trivial portions of code, tests, or documentation).
  • Yes — other (please describe):

Note

I used Claude Sonnet 4.5 to kickstart json-morph magic, and then used it to generate the tests.

However, I carefully reviewed and made substantial modifications to the generated code afterwards.

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

@felipecrs felipecrs marked this pull request as draft October 15, 2025 17:08
@felipecrs felipecrs force-pushed the retain-comments-when-migrating branch from c83ff25 to 9955a91 Compare October 15, 2025 17:52
@felipecrs felipecrs marked this pull request as ready for review October 15, 2025 17:52
@felipecrs felipecrs force-pushed the retain-comments-when-migrating branch from 9955a91 to b8b170f Compare October 15, 2025 18:31
@felipecrs felipecrs force-pushed the retain-comments-when-migrating branch from b8b170f to ed31804 Compare October 15, 2025 18:32
@felipecrs felipecrs marked this pull request as draft October 15, 2025 22:39
@felipecrs
Copy link
Contributor Author

felipecrs commented Oct 16, 2025

This was a lot more complicated than I thought. I can probably cleanup the logic a little more, but it's already too late here.

I'm marking this as ready to review anyway to maybe collect some feedback.

@felipecrs felipecrs marked this pull request as ready for review October 16, 2025 04:33
@felipecrs
Copy link
Contributor Author

felipecrs commented Oct 16, 2025

I'll probably create a library out of this, and name it jsonc-patch or something like that.

This is generic and useful enough. The very few Renovate-specific things can be parameterized.

Would keep the code in Renovate tidy as well.

Please let me know if you have any objection with that.

@jamietanna
Copy link
Contributor

IMO, that sounds reasonable, @felipecrs!

One thing to be cautious around is whether you'll be taking the net-new code into a new library, or if there's any code from inside Renovate that will need to go alongside it into the library.

Given Renovate is AGPL-3.0-only licensed, that'll have implications for the license on the library

Happy to help work out what makes sense here!

@felipecrs
Copy link
Contributor Author

felipecrs commented Oct 16, 2025

Nothing from Renovate itself would compose the library, so no need to worry about that. But thanks for the hint! :D

@jamietanna
Copy link
Contributor

You're welcome!

OK, in which case, wanna put this into a Draft PR state, so you can split the library out + then bring it back in here when that's ready?

@felipecrs felipecrs marked this pull request as draft October 16, 2025 13:03
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