DEV Community

Alexander Samaniego
Alexander Samaniego

Posted on

DPS909 Blog - Lab 3: Managing Simultaneous Changes

This week for my Open-Source course (DPS909), we were introduced the concept of multiple simultaneous changes in a single project. The purpose of this lab was to help us practice creating branches for specific (simultaneous) issues, merging, dealing with merge conflicts and identifying commits on GitHub.

Background

In lab 2 we practiced creating pull requests (PR) on other people's repositories. In that lab, we only worked on one feature in one branch before creating the PR. Now it's time to start learning how to add multiple features, in parallel, on our own branch by working in separate branches.

Features Added

I continued working on my Static Site Generator and decided to add two more features. I created issues for each feature that I wanted to add.

Issue 14: Support for HTML language codes

The first issue I created focused on adding support for HTML language codes.

In the original state, the HTML files generated automatically defaulted to en as the language code. I wanted to add the ability for a user to be able to specify the language for the generated HTML files by adding a -l/--lang argument.

Code Changes

To accomplish this task, I added a new option using the yargs module. This allows me to read whatever the user inputs after using -l/--l. Following this, I added a conditional statement that defaults to en-CA whenever a language code is not inputted.

Creating the HTML files containing the user specified language code was a simple process. This tool already uses the create-html npm package, so all I needed to do was add the lang option to the createHTML function.

Issue 15: Support for inline code blocks in Markdown files

The second issue I created was focused on adding support for inline code block parsing in Markdown files. So, enclosed text with a single backtick should cause the text to get rendered as <code>...text...</code> in the generated HTML file

Code Changes

This was an even simpler feature to add because there was already existing code to support bold and italic text in Markdown files. The only thing I needed to add was one line that calls the processMD function; which was added in an earlier pull request. This function is able to parse anything with an opening and closing tag. I just needed to specify the tag, in this case it was a backtick( ` ).

Problems and Lessons Learned

I had no real issues during this lab. I attribute this to my effort to trying to make the least amount of code changes possible when adding new features. I only had to fix one conflict in the issue 15 merge commit and it had nothing to do with the actual code, just conflicts in README.md.

I also learned how to work with multiple code changes in parallel on separate topic branches. It was a little difficult holding myself back on making unrelated changes whenever I noticed issues. But as I said, holding back was probably the reason I had the least amount of conflicts as possible.

Top comments (0)