This story was originally published on HackerNoon at:
https://hackernoon.com/build-customizable-reusable-project-templates-with-nodejs.
Build an interactive repository scaffolder with Inquirer and replace-in-file, with practical limits around file paths, replacements, and setup.
Check more stories related to programming at:
https://hackernoon.com/c/programming.
You can also check exclusive content about
#nodejs,
#nodejs-scaffolding,
#repository-templates,
#yeoman,
#cookiecutter,
#interactive-cli,
#developer-tooling,
#inquirer-prompts, and more.
This story was written by:
@lucastonelli. Learn more about this writer by checking
@lucastonelli's about page,
and for more stories, please visit
hackernoon.com.
The script uses a template with placeholders to create a new project, asking for each value and rewriting every occurrence across the repo with two libraries. This approach solves the problem of missing hardcoded values in a cloned project template.
The script is customizable and can be used as a drop-in solution, but it has limitations, such as not being able to rename directories and not being transactional, requiring a review step