My first time contributing to Nodejs

Written by Lenvin Gonsalves.
on October 24, 2022

For almost three years, I have worked exclusively using Nodejs and wanted to contribute to it.

As you all know, we have a lot of APIs provided by JavaScript to work with time. “Time zones” always come up whenever working with time (as in the below image, using the toLocaleString API, I have logged the present DateTime in the local time zone). So, there must be some way that Nodejs knows the offset for every time zone. The answer is the Unicode’s ICU repository. https://github.com/unicode-org/icu

1

Sometimes, new time zones get created, countries decide to end DST earlier, etc. The maintainers must keep checking the repository manually for new updates. Added to it, the processing of manually patching the new files is very time-consuming

2

I worked on creating a GitHub action that would fetch the latest ICU time zone file from the ICU repository and patch it with the file present in the Nodejs source. With the fix, we no more needed to manually check and patch the files. This action will run weekly and create a PR to update the files. The next version of Nodejs would have the latest time zone information.

3

It wasn’t easy as the code base was huge, and it was challenging to find issues for me to pick. The contribute page on the GitHub repository is the best place to find topics. For Nodejs, it was https://github.com/nodejs/node/contribute. You need to find issues with the label “good first issue.” Make sure you read the contributing guidelines first.

4

I found the issue I would work on, but I didn’t have the context/information to make me successful. The best bet was to read through the existing issue, find any other linked issues, and ask for pointers from the collaborators. In my case, the questions were already asked by other members.

5

Next was reading through the codebase. Luckily, most of Nodejs is written in JavaScript. So you don’t need C knowledge to get started. To help with debugging, I added a few console log statements and then built a repository. Make sure you use Ninja to accelerate the build times, as it takes a long time without it.

6

After a month of putting in the work, I was able to get my PRs merged into Nodejs's core repository.

The PRs -

https://github.com/nodejs/node/pull/43988

https://github.com/nodejs/node/pull/43887