plasmicapp / plasmic

Visual builder for React. Build apps, websites, and content. Integrate with your codebase.
https://www.plasmic.app
MIT License
4.72k stars 382 forks source link

Can we write and use our own code generator? #71

Closed aleksandrlat closed 2 weeks ago

aleksandrlat commented 1 year ago

Is it possible to write and use our own code generator from Plasmic UI builder? It would be nice if we could get some abstract model of components and render whatever code we want to render ourselves

yang commented 1 year ago

Hi @aleksandrlat , yes it's possible - the full underlying model is available here:

https://docs.plasmic.app/learn/model-quickstart/

Note that this is still quite early. First, the schema does evolve, but usually pretty incrementally/non-violently. Second, the main thing that's missing is documentation of the types. But sharing this in case it helps unblock you.

Out of curiosity, what are you thinking of doing with that?

aleksandrlat commented 1 year ago

Thank you @yang!

Out of curiosity, what are you thinking of doing with that?

We have our design system and we use styled components in the code. Styled components is strict requirement for code base. So to get buy in from the team to use Plasmic I want to try to generate react styled components.

I will read the docs. Do you have open source react code code generation? This can be a good example for me to see implementation. And I can re-use part of it for sure.

yang commented 1 year ago

Not at the moment, we do want to provide an open source codegen pipeline but it is probably not landing soon enough, I'm sorry to say....

On Mon, Mar 6, 2023, 12:28 PM Alexander Shartdinov @.***> wrote:

Thank you @yang https://github.com/yang!

Out of curiosity, what are you thinking of doing with that?

We have our design system and we use styled components in the code. Styled components is strict requirement for code base. So to get buy in from the team I want to try to generate react styled components.

I will read the docs. Do you have open source react code code generation? This can be a good example for me to see implementation. And I can re-use part of it for sure.

— Reply to this email directly, view it on GitHub https://github.com/plasmicapp/plasmic/issues/71#issuecomment-1456927943, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAABXWIOS7SVDCZFZ3Z4SYDW2ZCG7ANCNFSM6AAAAAAVPXDISM . You are receiving this because you were mentioned.Message ID: @.***>

aleksandrlat commented 2 weeks ago

Hello @yang! Is codegen.plasmic.app open source too now? Could you please point me to where it is located?

IcaroG commented 2 weeks ago

You can see some of the codegen code here, https://github.com/plasmicapp/plasmic/blob/master/platform/wab/src/wab/shared/codegen/react-p/index.ts