TL;DR: Make flexible and consistent folder-based modular boilerplate with Maki Module :)
In programming there is boilerplate:
sections of code that have to be included in many places with little or no alteration.Wikipedia
Since most things being made follow a pattern of things made before them, boilerplate gives a project consistency and sets the expectations of what you may find in other files, functions, classes, etc.
There has always been a boilerplate problem in most of the projects I’ve been on: there is no standard boilerplate mechanism. Boilerplate becomes something pasted from documentation or another file in the code base and renamed and updated into its new form. This is OK until the proverbial flies appear in the ointment:
- Previous names have not been updated for the current context.
- Previous comments have not been update or removed.
- The worst: code blocks are copied from files that follow old or outdated pattern.
What if there was a standard mechanism for boilerplate? Some nice things to have might be:
- A way to ensure all new files follow the most current standard.
- No pasting; no errant artifacts.
Recent projects have migrated toward modularity: related files in a single folder. This might include things like: view, styles, models, etc. Modularity makes it easier to refactor the application and possibly position for potential packages. Hmm good alliteration on that last one! Modularity also gives us a great way to capture the structure of a given piece of our app.
But what if I have different case conventions for my files? What if views are kebab case, reducers are camel case, and model classes are Pascal? That would be a nice-to-have too! Let’s update that feature list:
- Folder-based modularity.
- Supports multiple case conventions.
- New modules follow the most current standard.
- Consistent mechanism with no pasting; no errant artifacts.
This led to the Maki Module tool. By using consistent
__BaseName__ token replacements in the template filenames and inside the files, it provides flexibility for any type of structure and supports popular case conventions: camel, constant, kebab, pascal, snake. If you have Node >= 8.5 and NPM >= 5.3, get started on your CLI:
npx maki-module help
For more details:
If you have any feature suggestions or find any bugs, please open a Github issue!