mitosis icon indicating copy to clipboard operation
mitosis copied to clipboard

Support for custom generators / targets

Open commax89 opened this issue 2 years ago • 2 comments

I am interested in helping provide a feature!

Yes

Which generators are impacted?

  • [X] All
  • [ ] Angular
  • [ ] HTML
  • [ ] Qwik
  • [ ] React
  • [ ] React-Native
  • [ ] Solid
  • [ ] Stencil
  • [ ] Svelte
  • [ ] Vue
  • [ ] Web components

What problem does this feature solve?

Some projects may need to customize, rewrite or write generators from scratch in order to achieve some specific business requirements that are not compatible with current coding standards.

What does the proposed API look like?

From an initial high level investigation it should be possibile to load custom targets directly from the config file, in the cli package it should be enough to merge the current targets with the ones from the options. This should also enable generator replacements.

Additional Information

No response

commax89 avatar Dec 19 '23 16:12 commax89

I'm open to adding this! How to do so:

  • Add a generators dictionary prop to the MitosisConfig: https://github.com/BuilderIO/mitosis/blob/e862056eca675887bd975bf5696c61666d0f3532/packages/core/src/types/config.ts#L19

  • Update this call to take into account options.generators, by checking for options.generators[target] before relying on the default generators: https://github.com/BuilderIO/mitosis/blob/e862056eca675887bd975bf5696c61666d0f3532/packages/cli/src/build/build.ts#L278

samijaber avatar Jan 18 '24 21:01 samijaber

I will do it

JerryWu1234 avatar Feb 20 '24 08:02 JerryWu1234