DEV Community

Oscar Ortiz
Oscar Ortiz

Posted on • Edited on

How I created my first Open Source project

πŸ§‘β€πŸ’» After using Linux for more than 2 years, I had to go back to using Windows as my only operating system, leaving behind the good times I had in Linux.

One of the things I haven't been able to overcome, and it's not my ex, has been the use of the terminal, as I could do anything quickly and easily.

Here's where I found a problem, specifically with the New-Item command, which only allows me to create one file per command. For example:

> New-Item src\index.js
Enter fullscreen mode Exit fullscreen mode

You might ask me, "What's the problem?" Well, in Linux we have a command called touch which allows us to generate as many files as we want using only one command. For example:

> touch src/index.js src/components/Component.jsx src/utils/util.js
Enter fullscreen mode Exit fullscreen mode

So I decided to create a CLI program called touch-win, which is written entirely in JavaScript. Someone might comment, "There are already programs that are an alternative to the touch command in windows," and that's really true. There are many programs, and they're not hard to find. You can look for them on npm, scoop, or any other package manager.

At this point, I present to you Touch-Win, my improved version of the touch command for all operating systems.

If I enjoy working in the terminal, one of the tasks I find most repetitive is creating folders and generating three or more files inside them. For example:

# Create folders
> mkdir -p ./src/components/Search

# Create files
> touch ./src/components/Search/index.js ./src/components/Search/Search.test.js ./src/components/Search/Search.css
Enter fullscreen mode Exit fullscreen mode

I realized that this was a waste of time and energy, so I looked for a more effective solution.
This is where Touch-Win comes into play, as it perfectly solved the aforementioned tasks:

> touch-win ./src/components/Search/index.js ./src/components/Search.css ./src/components/Search.test.js
Enter fullscreen mode Exit fullscreen mode

What's the difference? Well, Touch-Win has the ability to generate the missing folders, so you no longer need to use mkdir!

Another repetitive task is the file paths that need to be generated, in this case, .src/components/Search.

With the --base or -b option followed by the path, you no longer need to write the path again for each file, Touch-Win takes care of it for you. For example:

> touch-win -b ./src/components/Search index.js Search.test Search.css
Enter fullscreen mode Exit fullscreen mode

Before publishing this blog, Touch-Win already has more than 500 downloads. Will you be the next to use it?
πŸ‘‰ Download Here

πŸ§‘β€πŸ’» For a couple of months, I wanted to create something for the community after 2 years of dedicating myself professionally to software development. Today, with Touch-Win, I write my first Hello Open Source!.

Made with love by Oscar Ortiz, a technology enthusiast and passionate about open source code. This project is a personal effort to share knowledge and skills with the community. I hope it's useful for other developers and technology enthusiasts. Feel free to contribute or use this project in any way you want. Thank you for your interest and support!.

Top comments (0)