practicajs / practica

Node.js solution starter boilerplate that is production-ready, packed with ✅ best practices and built with simplicity in mind
https://practica.dev/
MIT License
1.49k stars 135 forks source link

Code the code generator #149

Open goldbergyoni opened 2 years ago

goldbergyoni commented 2 years ago

🎯 Goal: - Currently our code generator does almost nothing but copying the code-templates folder to the destination as-is. We need to perform some logic to support future cases (e.g. remove some code blocks). We should code a small module that performs this logic during code generation

For a start, we should support:

🤔 Things to consider:

🏭 Proposed design: - Our code generator should act on .ts files, apply its logic based on custom code and identify areas of change using regex/comments

mikicho commented 2 years ago

Why not use tools like yeoman or plopjs?

goldbergyoni commented 2 years ago

Because we want to have full control. I've tried plopjs, it's great for simple and quick skeleton. We're different - A robust generator that might end with some complex logic. Consider replacing the express layer with fastify layer. Also, plopjs is based on templating - the issue explains why templating won't work for us

Yeoman is the front DX which the developer uses, we want to have our own UI/DX/CLI. You can tweak it but it never built to serve as the back layer.

Does it make sense?

mikicho commented 2 years ago

Yes. Must say that it sounds like a package by itself, and we may want separate it to another repo