Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to use different templates per template #1331

Open
ricardo-devis-agullo opened this issue Mar 25, 2023 · 3 comments
Open

Add ability to use different templates per template #1331

ricardo-devis-agullo opened this issue Mar 25, 2023 · 3 comments

Comments

@ricardo-devis-agullo
Copy link
Collaborator

ricardo-devis-agullo commented Mar 25, 2023

Right now, if you want to, let's say, use the react template you can only use a single one (the one specified in scaffold/src folder), but makes sense that we could have more than one, for example one with JavaScript and another one with TypeScript.

This could be supported by adding a new parameter to the init command (this also opens the possibility of the CLI asking you interactively what template do you want if you do not specify one specific)

oc init myoc oc-template-react --> default oc-template-react template located on src folder
oc init myoc oc-template-react --type ts --> oc-template-react typescript template located on ts folder

This might be a little verbose, so I was thinking we could allow not having to add the oc-template (does the "legacy template warning" still apply here?) to something like this:

oc init myoc react --> default oc-template-react template located on src folder
oc init myoc react --type ts --> oc-template-react typescript template located on ts folder

And since the names don't mean anymore a specific library outside, the type parameter could be moved to part of the name like

oc init myoc react --> default oc-template-react template located on src folder
oc init myoc react@ts --> oc-template-react typescript template located on ts folder

@diessica
Copy link

diessica commented May 15, 2023

It could also be nice to be able to reuse the template and the compiler, but specify a different scaffold/src path, in case you want to customise the final component that is generated, without having to fork all the helpers that come with a template, or the entire template monorepo for that matter.

Also, any plans to support modules that are not on npm? Let's say a local module

oc init myoc ./my-templates/oc-template-react

@ricardo-devis-agullo
Copy link
Collaborator Author

What would be the use case for that? If you have a local template, can't you just copy the scaffold folder directly?

@diessica
Copy link

@ricardo-devis-agullo Nevermind me :) That'd do it, I'd misunderstood the template system

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants