Menu

Creating customizable and reusable project templates with Node
📰

Creating customizable and reusable project templates with Node

DEV Community: node·Lucas Tonelli·14 days ago
#lkgGWx7I
#devtonodejs#devto#dev#script#template
Reading 0:00
15s threshold

At some point in your life you end up with a repo that is the starting point. It has the CI pipeline you like, your preferred linting and formatting configs and the Terraform layout that works like a charm. Then a new project shows up, you clone the base template and spend the next twenty minutes doing find-and-replace on the project name, ids, the domain name and whatever else is hardcoded in there. It works, until you miss a thing and find out your project is failing - but is it because of the template or because you missed something!? However, a small script and two npm packages solve this problem pretty well.

Prompt and replace

Instead of hardcoding values, you create a template with placeholders, using whatever delimiter is unlikely to show up naturally in your code.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.