hygen
hygen copied to clipboard
Use hygen to generate entire projects
Hello,
I'm wondering what are the best practices or is it even possible to generate entire projects? We tend to create a lot of node.js projects so I want to share some basic templates with my team.
Currently I use self-written package to generate projects from ejs templates, like this npx @org/generator -n new-app
.
I can't figure out how to do the same with hygen except keeping up-to-date templates folder on each local machine. Is there any way to point to remote templates folder?
Thanks in advance for any insights
I solved this problem by making my own CLI package and embedding hygen within it as stated in the readme. Basically copying the bin file used by hygen and making it point to your own set of generators to generate a project (instead of the default init self
set).
You can even take note of how the init self
generators were made and use it to generate the project structure with additional templates to scaffold things like components within it. (aka, generating generators)
@mjansen-dc thanks for the tip👍🏻 Btw, is your solution open-sourced? I'd love to see it
@MikeYermolayev I can't share the solution I was referring to in my original comment, but I quickly made a stripped down version which is available over here.
Thanks @mjansen-dc and @MikeYermolayev For v7 I'm planning easy (and smart) cloning for template repositories, which I think can help even further!
You might be interested in projen instead.