Feliz.MaterialUI icon indicating copy to clipboard operation
Feliz.MaterialUI copied to clipboard

Rewrite generator / make generator library

Open cmeeren opened this issue 4 years ago • 3 comments

I'm rewriting the generator to something more solid.

In order to simplify creation of other Feliz bindings, I plan on publishing a NuGet with the generator domain model (containing information about components and props) and writer (essentially converts the API model to strings for a component file and props file).

Binding authors can then just instantiate the domain model (either manually or by parsing docs or TS types however they want) and use the model data to generate standard Feliz bindings, which will automatically fix stuff such as erasing types with only inline members etc.

This also makes it easier to change Feliz implementations, e.g. for the new inheritance syntax suggested in #20.

cmeeren avatar Oct 06 '19 07:10 cmeeren

This is now implemented, though currently undocumented (except for doc comments in code) and unpublished. Interested parties can, for now, check out the code in the fairly simple Feliz.Generator and particularly how it's used and extended in the more complicated Feliz.Generator.MaterialUI (an example of a 3rd party client making use of Feliz.Generator):

https://github.com/cmeeren/Feliz.MaterialUI/blob/e54e57cce525039b2a2dc818bf43465dcaee8663/src/Feliz.Generator.MaterialUI/Domain.fs#L1-L23

https://github.com/cmeeren/Feliz.MaterialUI/blob/e54e57cce525039b2a2dc818bf43465dcaee8663/src/Feliz.Generator.MaterialUI/ApiParser.fs#L670-L706

https://github.com/cmeeren/Feliz.MaterialUI/blob/e54e57cce525039b2a2dc818bf43465dcaee8663/src/Feliz.Generator.MaterialUI/Program.fs#L16-L21

cmeeren avatar Oct 07 '19 19:10 cmeeren

Thanks for this cmeeren, I've made plotly.js bindings for Feliz by butchering the code you wrote for the generator. https://github.com/Shmew/Feliz.Plotly I'd love some advice on how I can improve things, I'm pretty sure it creates a rather large bundle at the moment.

Shmew avatar Oct 16 '19 14:10 Shmew

The generator is in a good state as of now, but it's not yet published to NuGet or documented. If anybody needs it, please let me know and I'll try to prioritize publishing and adding docs. I have a lot on my place and probably won't prioritize it until anyone actually needs it.

(Regardless of this, anyone is of course free to simply clone this repo and experiment using a simple project reference to see if the generator fits their needs.)

cmeeren avatar Feb 09 '20 19:02 cmeeren