How I dreamed of creating boilerplates with no struggle

In the previous post, I was sharing the struggle of creating boilerplates: folders, files, writing the same code, imports, exports… All of these, when I just needed a new simple component. So, I decided to create a tool that will help me to automate the process.

I started dreaming.

How the process of creating boilerplates would look in the perfect world? An important question to ask. Here's how I saw it.

The user presses the keys, enters a boilerplate name, and voilà! All folders & files are created in the desired directory, fulfilled with the boilerplate data and the user is ready to continue his work. Sounds simple.

Most of the “creating boilerplate” tools I saw on the internet are based on bash or other terminal scripts. If I go the same way, each time I wanna create a boilerplate, I should open the terminal, which is not optimal for me, since the “user path” gonna get longer.

The main goal of the tool is to save my time and energy.

But okay, let’s move on. How should I know where to create a boilerplate? When I write the component name (ex. Button) and press enter, the tool should create files exactly where it’s needed.

Also, I might have different types of boilerplates in one project. For example, this website has components, pages and blog posts entities and each of them has its own shape. I think it will be cool to have the option to create many boilerplates.

The logic is getting more complex as we’re defining the features we’d like to have. Love it.

The next question is how to manage paths? The terminal is opened in the root by default. Well, if a developer uses IDE, like VS Code for example, then a new terminal window will be opened in a project directory…

...wait a minute...

...it all of a sudden dawned on me.

Why don’t I create a VS Code extension?!

I use VS Code most of the time*. My main goal is to solve the problem I have, in the best way possible. VS Code extension seems like a very good step forward to the dreamed UX: cmd+shift+p, type the name of the extension, type the name of boilerplate’s entity, and voilà — boilerplate is created.

It feels natural, damn it!

I never created a VS Code extension before and saw it as a great opportunity to learn. Also, I believe knowing how the IDE works under the hood will be useful.

I felt this fire inside me and it was a call to get it started. Couple of seconds later I was reading the VS Code API docs and was trying to create my first extension...

Stay tuned.

Last updated 15.03.2023