DEV Community

Neil An
Neil An

Posted on

My second PR for Hacktoberfest

Hi everyone,

This week I created my second PR for Hacktoberfest. The repo is found was metaxa, a command line speed reader, for fast reading one word at a time written in NodeJS.

The issue I chose was to add a new feature, specifically adding a stats argument which displays the number of words, sentences, and the absolute path of the file given.

To get started, I forked the repo, created a new branch, and built the application. Since my SSG setup was similar to this repo, it was easy to setup.

Writing the code wasn't too difficult because of the SSG project that we created and maintained in our labs. To start, I made sure to read the other code in the repo so I knew how to follow the owner's coding style. After, I created the option for the user to use the "stats" argument. The function to read from a file was already created, so I used that function to help me get the information for that file. After reading the data, I used some regex to split the data into sentences and words and counted the sentences and words found. Finally, I displayed that information to the screen. To get the absolute path, I used the .resolve() method found in the path module and displayed that to the screen also. Finally, I updated another option -h or --help to include the newly added stats argument.

The results of my initial pull request:

Image description

Contribution

After I submitted my pull request, the owner of the repo wanted me to change the colouring style. After changing the style, I made sure that the style was suitable and then committed the new code.

The new colouring:

Image description

Image description

Finally, the owner accepted my code and closed the PR. Overall, I had a fun time contributing to this repo.

Top comments (0)