rojo-rbx / rbx-dom

Roblox DOM and (de)serialization implementation in Rust
MIT License
105 stars 42 forks source link

Make pretty JSON optional for `generate` subcommand (`rbx_reflector`) #401

Closed DervexDev closed 4 months ago

DervexDev commented 4 months ago

This PR makes writing of database from generate subcommand in pretty-printed JSON optional by adding --pretty option. I think that it makes sense as these files are not intended to be read by humans and it reduces the file size from 1.6MB to 796KB.

DervexDev commented 4 months ago

it may be useful once we start publishing databases to GitHub releases

I think that it is already pretty useful e.g. when including rbx_dom_lua in other projects.

I slightly disagree with "not intended to be read by humans." We do want to diff and read the database with our eyes quite frequently (whenever we open PRs to update it)

Oh I thought that e.g. rbx_dom_lua uses 100% auto generated database from rbx_reflector, makes sense then.

some editors don't perform well on extremely long lines

That's good to now!

kennethloeffler commented 4 months ago

Oh I thought that e.g. rbx_dom_lua uses 100% auto generated database from rbx_reflector, makes sense then.

We do use rbx_reflector to generate the database in rbx_dom_lua - I'd just like to be able to easily see how the database has changed after an update. Pretty printed JSON diffs pretty well, but it's much harder to see what changed when it's all slammed into a single line. It's certainly possible to prettify it manually after the fact... but I'd rather not add another step 😄