So this week for our lab we did more practice with working with another person's repo. This week I decided to mix it up a bit and work on a SSG in JavaScript, so I made a pull request for Ritik's repository. Our task was to add a new feature that would allow the user to input a JSON config file as an argument, that config file would contain a JSON object with all the arguments the user wanted to use for the HTML output. Such as input file, output location, stylesheet, language, etc.
It was pretty easy to get back into JavaScript, although I never made many command line programs using JavaScript. I mainly only had used JavaScript for web development projects. So it was cool to see how Ritik did this using the Commander package. The feature was pretty simple to add because of Commander. It made it easy to add a new command line flag to accept -c
or --config
and then all I had to do was check if this flag existed. If it did then it would update the options to match the ones given in the config.json file, while setting defaults if no setting was given. Otherwise, it would run like normal using given command line arguments. You can find the branch I made here and the PR here.
The process of forking and creating a issue branch of the repo was pretty simple after doing it last time. Same thing with the commit/merging process. However, I think the biggest problem I have is remembering the commands to do everything. I can't count the number of times I tried to type the command and mixed them up like typing git add -"message"
or git commit origin main
. Thankfully Git Bash has keeps a history of previously used commands, but it still is annoying to keep pressing the up arrow key just to find the command I was trying to type. But I think over time I will begin to remember how to type each command with practice. For now I think should create a sticky note on my computer that has the main commands I need.
From this lab I got some nice practice using remote repos in Git and was able to practice some JavaScript as well. I'm excited to keep working on Git and also doing some pull requests for Hacktoberfest! I will be posting about my first PR for Hacktoberfest soon so look forward to that. Take care!
Top comments (0)