This week in my Open Source Development course, I was tasked with adding two new features to my Open Source project repo, TILerator, while working on these features in separate branches and merging them once complete. TILerator is a command-line tool that is able to convert .txt
or .md
files into a .html
file with the correct HTML
tags.
New Features
Adding Appropriate Error/Exit Codes for All Cases
The first feature I decided to implement was appropriate exit codes throughout my program. Initially, I had a console.log()
message describing the state of the program (success/failure), but adding these exit codes provides a more robust method of identifying errors. The program now exits with a code of 0
upon a successful execution and a non-zero exit code (-1) in case of errors. The merge commit can be found here.
else if (input.length === 1 && !input[0].startsWith("-")) {
utils.determinePath([input[0]]);
process.exit(0);
} else {
console.error(
"Invalid arguments provided. Enter TILerator --help for more information.\n"
);
process.exit(-1);
}
Adding Support for Inline and Fenced Code Blocks
The second feature I decided to implement was support for inline/fenced code blocks for .md
files.
The merge commit can be found here.
For inline code blocks: Text that is enclosed by a single backtick
`console.log(`TILerator tool version: ${version}`);`
would get rendered as
<code>console.log(`TILerator tool version: ${version}`);</code>
For fenced code blocks: Text that is enclosed by 3 backticks
```
console.log(`TILerator tool version: ${version}`);
```
would get rendered as
<pre>
<code>
console.log(`TILerator tool version: ${version}`);
</code>
</pre>
Merging these two branches into main
went quite smoothly with no conflicts, primarily due to these two features being implemented in different areas.
Overall, I have learned the concepts of parallel branches and merging. Creating separate branches is an effective method to testing out new features in an isolated environment without affecting the main branch.
Top comments (0)