DPS909 Blog - Lab 3: Managing Simultaneous Changes
Tags: opensource
Published: 2022-09-28 21:39:44

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](https://dev.to/alexsam29/dps909-blog-lab-2-contributing-and-submitting-pull-requests-355o) 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](https://github.com/alexsam29/ssg-cli-tool) and decided to add two more features.  I created issues for each feature that I wanted to add.

### [Issue 14](https://github.com/alexsam29/ssg-cli-tool/issues/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](https://github.com/alexsam29/ssg-cli-tool/commit/d49eaccf8216d3524985a469d1c142d470399097#diff-bfe9874d239014961b1ae4e89875a6155667db834a410aaaa2ebe3cf89820556R49-R52) a new option using the [yargs](https://www.npmjs.com/package/yargs) module. This allows me to read whatever the user inputs after using `-l`/`--l`.  Following this, I [added](https://github.com/alexsam29/ssg-cli-tool/commit/d49eaccf8216d3524985a469d1c142d470399097#diff-bfe9874d239014961b1ae4e89875a6155667db834a410aaaa2ebe3cf89820556R93-R97) 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](https://github.com/alexsam29/ssg-cli-tool/commit/d49eaccf8216d3524985a469d1c142d470399097#diff-bfe9874d239014961b1ae4e89875a6155667db834a410aaaa2ebe3cf89820556R201) the `lang` option to the `createHTML` function.

### [Issue 15](https://github.com/alexsam29/ssg-cli-tool/issues/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](https://github.com/alexsam29/ssg-cli-tool/commit/1ba7058388d424a347709237ec4c51c77fb3a219#diff-bfe9874d239014961b1ae4e89875a6155667db834a410aaaa2ebe3cf89820556R160) was one line that calls the `processMD` function; which was added in an earlier [pull request](https://github.com/alexsam29/ssg-cli-tool/pull/13). 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](https://github.com/alexsam29/ssg-cli-tool/commit/1ba7058388d424a347709237ec4c51c77fb3a219) 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.