Preserve more of the orignal YAML formatting. #829
Joshua-Beatty
started this conversation in
Feature Request
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
🏷️ Feature Request Type
Other
🔖 Feature description
Currently dockge uses the
yaml
npm library and converts the yaml to js using thedoc.toJS()
to generate a JSON config method which then is used to create a new document and stringifies that. In essence it does:It does this so the config can be modified so the yaml can be regenerated. (It does do some other work to maintain comments)
Ideally the original YAML should be modified as little as possible.
For example, this:
Gets turned into:
✔️ Solution
In a perfect world as little of the YAML would get modified little as possible. Theoretically this is possible by generating a CST with the yaml library, then modifying the CST directly only changing the nodes that are directly changed. This though I do not think is super feasible, or at least is too difficult for me to attempt. I did consider trying to do this a little, and have some example code in case anyone is interested.
❓ Alternatives
Alternatively there are two other solutions that I have thought of:
📝 Additional Context
Related Bugs/Discussions:
dockerfile_inline
element when editing #673Beta Was this translation helpful? Give feedback.
All reactions