<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Bregwin Jogi</title>
    <description>The latest articles on DEV Community by Bregwin Jogi (@bregwin).</description>
    <link>https://dev.to/bregwin</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2023792%2F387f7625-75dc-4553-b1e4-a89f225dc00b.jpeg</url>
      <title>DEV Community: Bregwin Jogi</title>
      <link>https://dev.to/bregwin</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bregwin"/>
    <language>en</language>
    <item>
      <title>The End of the Beginning: My Open Source Journey so far</title>
      <dc:creator>Bregwin Jogi</dc:creator>
      <pubDate>Fri, 29 Nov 2024 22:04:06 +0000</pubDate>
      <link>https://dev.to/bregwin/the-end-of-the-beginning-my-open-source-journey-so-far-3oid</link>
      <guid>https://dev.to/bregwin/the-end-of-the-beginning-my-open-source-journey-so-far-3oid</guid>
      <description>&lt;p&gt;This is the final post for the OSD assignment Release 0.4&lt;br&gt;
I am hoping to graduate in a couple of weeks.&lt;/p&gt;

&lt;p&gt;Learning about open source so far has been really rewarding, I understood the ups and downs surrounding it and even started my own open source project &lt;a href="https://github.com/brokoli777/RefactorCode" rel="noopener noreferrer"&gt;RefactorCode&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I wanted to work on one more issue, since I am not sure if the work I did satisfies all the requirements for the final release. &lt;/p&gt;

&lt;p&gt;I worked on an issue in &lt;a href="https://github.com/apple/ml-mdm" rel="noopener noreferrer"&gt;ml-mdm&lt;/a&gt; by Apple where some files needed to be updated with a new library used for parsing arguments.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqft8lhw8cbfgo0abgbz8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqft8lhw8cbfgo0abgbz8.png" alt="Image description" width="800" height="217"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I looked at the project and found that only a couple more files were left to be using the &lt;code&gt;simple-parsing&lt;/code&gt; library. My contributions included:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Creating data classes based on existing arguments.&lt;/li&gt;
&lt;li&gt;Replacing old argument parsing code with functions utilizing the new data classes.&lt;/li&gt;
&lt;li&gt;Applying the same updates to multiple files in the repository.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff419dyb2uyloyhfk7xjh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff419dyb2uyloyhfk7xjh.png" alt="Image description" width="800" height="413"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I ran the files so see if there were any issues and I noticed the arguments not being passed correctly and threw an error, I realized that the README also needed a small spelling fix to pass the new arguments.&lt;/p&gt;

&lt;p&gt;Once I updated it, the script ran properly. Later, I made a &lt;a href="https://github.com/apple/ml-mdm/pull/50" rel="noopener noreferrer"&gt;pull request&lt;/a&gt; documenting the changes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjgv2vy6i3dcgvx0czvtz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjgv2vy6i3dcgvx0czvtz.png" alt="Image description" width="800" height="457"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The other pull requests I made for the assignment are still waiting to be reviewed, I am not sure when it would get merged. I will be addressing any suggested changes if there ends up being any.&lt;/p&gt;

&lt;p&gt;Edit: Happy to say that 2 of the pull requests (ml-mdm &amp;amp; issue-metrics) got merged!&lt;/p&gt;

&lt;p&gt;Overall, since I am also graduating soon, looking back over the past 3 years, I am happy that I was able to learn new things related to coding, I ended up doing a co-op, and now I will be on the lookout to start my career. I am not sure where I will be in a few years, but I will somehow figure it out as I go along.&lt;/p&gt;

&lt;p&gt;Here’s to the end of one chapter and the beginning of another.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Working on New Open Source Projects - Release 0.4 - Part 2</title>
      <dc:creator>Bregwin Jogi</dc:creator>
      <pubDate>Fri, 29 Nov 2024 21:31:36 +0000</pubDate>
      <link>https://dev.to/bregwin/working-on-new-open-source-projects-release-04-part-2-195p</link>
      <guid>https://dev.to/bregwin/working-on-new-open-source-projects-release-04-part-2-195p</guid>
      <description>&lt;p&gt;Last time, I was planning on what issues I could take on for this assignment, I found a couple more and started working on them.&lt;/p&gt;

&lt;p&gt;I looked at another &lt;a href="https://github.com/github/issue-metrics/issues/417" rel="noopener noreferrer"&gt;issue&lt;/a&gt; on a tool created by GitHub to update how the "time in draft" is calculated for a pull request. When a PR changes from "ready for review" back into "draft", the time is not calculated, so there needs to some updates for it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Fixing Brave browser bug
&lt;/h3&gt;

&lt;p&gt;Regarding the working on the brave &lt;a href="https://github.com/brave/brave-browser/issues/24120" rel="noopener noreferrer"&gt;issue&lt;/a&gt;, because of the sheer size of the repo, it was tough to find the exact file where the filter lists and global defaults are handled, but I found in an interesting way.&lt;/p&gt;

&lt;p&gt;I backtracked the file through VS Code search!&lt;/p&gt;

&lt;p&gt;I figured they all must be part of the same file, so I searched for that particular text:&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa2fy0kmnxqj6q80vsril.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa2fy0kmnxqj6q80vsril.png" alt="Image description" width="537" height="750"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I saw the actual text is stored in another file to make it easier to modify, I look at the variable name corresponding to it.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm89yk6md3dxre6qgpeb6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm89yk6md3dxre6qgpeb6.png" alt="Image description" width="800" height="277"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feg828msnv75tre51c0tl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feg828msnv75tre51c0tl.png" alt="Image description" width="800" height="227"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I saw the file, where is getting used and saw that the components in that file are the same the one I saw in the browser.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa30w0lpnhtq6lfhb470c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa30w0lpnhtq6lfhb470c.png" alt="Image description" width="800" height="329"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;At the top of the file, saw the functions it uses to open the tabs for the filter settings, they were creating the tabs directly, hence the cause of the bug.&lt;/p&gt;

&lt;p&gt;I looked into how to focus on a tab if the particular URL is already open an existing tab and updated the code.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft9uuyx97b49hah54k7v3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft9uuyx97b49hah54k7v3.png" alt="Image description" width="800" height="412"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I was worried the issue was going to be a lot harder because I wasn't sure what exactly was causing the issue. But the update seems to fix it. &lt;/p&gt;

&lt;p&gt;I made the &lt;a href="https://github.com/brave/brave-core/pull/26682" rel="noopener noreferrer"&gt;pull request&lt;/a&gt; for it, but I am not sure if it will get merged anytime soon because it is a low priority issue right now.&lt;/p&gt;

&lt;h3&gt;
  
  
  Fixing issue-metrics bug
&lt;/h3&gt;

&lt;p&gt;For this issue, I looked into where the time in draft is actually calculated and found the following section of code:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff1ompcyer0pg39smjnod.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff1ompcyer0pg39smjnod.png" alt="Image description" width="800" height="460"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then I found the function that calculated the draft time, right now it does a subtraction of "ready_for_review" time from "created_at" time.&lt;br&gt;
I noticed that it is using the github3 library for the project and looked at how to get the draft times. While looking at how the ready for review date was calculated, I realized there isn't a direct way to get the draft, and I had to look through the events for that particular issue and get review and draft events. &lt;/p&gt;

&lt;p&gt;Then I had to calculate the time from each review and draft interval.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4zcdwmlrhkzcfcmh76wf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4zcdwmlrhkzcfcmh76wf.png" alt="Image description" width="800" height="566"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I then updated the code fix the issue:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvobcsgdhw3xje1myl1bp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvobcsgdhw3xje1myl1bp.png" alt="Image description" width="800" height="292"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I also updated the tests and added a couple more to test the function.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fscamti3xtbqsynynt2f0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fscamti3xtbqsynynt2f0.png" alt="Image description" width="800" height="381"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once all the tests passed and everything worked as expected, I made a &lt;a href="https://github.com/github/issue-metrics/pull/431" rel="noopener noreferrer"&gt;pull request&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I found another good issue as well, but I will let you know about that and an overview of my everything over the past few months in another blog post!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Working on New Open Source Projects - Release 0.4 - Part 1</title>
      <dc:creator>Bregwin Jogi</dc:creator>
      <pubDate>Fri, 29 Nov 2024 20:51:06 +0000</pubDate>
      <link>https://dev.to/bregwin/working-on-new-open-source-projects-release-04-part-1-28i0</link>
      <guid>https://dev.to/bregwin/working-on-new-open-source-projects-release-04-part-1-28i0</guid>
      <description>&lt;p&gt;As part of my OSD course at Seneca College, I have been contributing to open source for the past few months. This is the final assignment before I graduate, so I am looking to contribute to other projects that are a little bigger in scope than last time. &lt;/p&gt;

&lt;p&gt;There was an issue I decided not to work on the brave browser last time because it was outside the skills I currently have, so I am planning to work on another issue which I personally encountered while using the browser. When you click the filter lists or global defaults from this menu, it creates a new tab every time. This is different from when you click settings, where if there is already a settings tab open, it focuses on that tab. I am thinking of taking this issue.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F21lrohngo7b54y3axlz7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F21lrohngo7b54y3axlz7.png" alt="Image description" width="645" height="925"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The other issue I want to work on, that I haven't found out yet, but I am hoping to find one soon!&lt;/p&gt;

&lt;p&gt;Since the semester is coming to an end, I am having a lot of assignments due in the coming weeks. So I am uncertain on what all I could contribute to within the time I have. But I have a couple of repos I am looking into for now.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to publish your node.js package to NPM</title>
      <dc:creator>Bregwin Jogi</dc:creator>
      <pubDate>Fri, 22 Nov 2024 23:05:56 +0000</pubDate>
      <link>https://dev.to/bregwin/how-to-publish-your-nodejs-package-to-npm-2gc3</link>
      <guid>https://dev.to/bregwin/how-to-publish-your-nodejs-package-to-npm-2gc3</guid>
      <description>&lt;p&gt;I recently added my node.js console application &lt;a href="https://github.com/brokoli777/RefactorCode" rel="noopener noreferrer"&gt;RefactorCode&lt;/a&gt; to NPM to make it easier for users to install the application without cloning the repo. It was surprisingly simple and I have laid out the steps below:&lt;/p&gt;

&lt;p&gt;You need to first create an npmjs account from here: &lt;a href="https://www.npmjs.com/" rel="noopener noreferrer"&gt;https://www.npmjs.com/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz3n0ushrkrzsenwg2j8e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz3n0ushrkrzsenwg2j8e.png" alt="Image description" width="800" height="329"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once that's done, go to the root directory of the project, and type:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm login
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will take you to the login page and after being successfully authenticated, type &lt;code&gt;npm publish&lt;/code&gt; to push the project to NPM:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F48os99rqdqs53le4cyjl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F48os99rqdqs53le4cyjl.png" alt="Image description" width="800" height="332"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And that's it!&lt;/p&gt;

&lt;p&gt;Here is my package if you are curious: &lt;br&gt;
&lt;a href="https://www.npmjs.com/package/refactorcode" rel="noopener noreferrer"&gt;https://www.npmjs.com/package/refactorcode&lt;/a&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  Other stuff
&lt;/h2&gt;

&lt;p&gt;I made a release for the application by tagging a release:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git tag -a v1.0.1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And the pushing it to github:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git push --follow-tags
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I also tested if others were able to access the application by asking my brother to try installing it, he was able to set it up from NPM pretty easily after looking at the README file. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffcehd1p0gqyww5whfb2u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffcehd1p0gqyww5whfb2u.png" alt="Image description" width="800" height="338"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Although, it is a bit harder compared to normal packages since you have to specify environment variables for the API key, but the screenshots helped.&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>github</category>
      <category>node</category>
      <category>npm</category>
    </item>
    <item>
      <title>Trying bigger tasks in Open Source</title>
      <dc:creator>Bregwin Jogi</dc:creator>
      <pubDate>Wed, 20 Nov 2024 20:57:17 +0000</pubDate>
      <link>https://dev.to/bregwin/trying-bigger-tasks-in-open-source-2oji</link>
      <guid>https://dev.to/bregwin/trying-bigger-tasks-in-open-source-2oji</guid>
      <description>&lt;p&gt;I started with trying to work on bigger tasks in open source projects, so that I can improve my skills. I started it last week, and you can see my blog for that here: [link]&lt;/p&gt;

&lt;p&gt;This week I worked a project called &lt;a href="https://github.com/tjtanjin/react-chatbotify" rel="noopener noreferrer"&gt;react-chatbotify&lt;/a&gt; which is a library for a creating custom chatbots, it was a very beginner-friendly repo and there were already several tasks labelled for new contributors. I worked on an &lt;a href="https://github.com/tjtanjin/react-chatbotify/issues/151" rel="noopener noreferrer"&gt;issue&lt;/a&gt; for adding new test cases to a component that allows the user to add custom checkboxes for their chatbot.&lt;/p&gt;

&lt;p&gt;They were using a library called testing-framework on top of Jest which allows testing similar to how the user would interact with components (right-clicking a button). I wasn't familiar with this library at first, but I learned more about it by working on this issue. I looked at the existing test cases to see how it was implemented and starting adding test cases for the components. Once I completed most of them, I ran the test file, 4 of the tests ran, but the 5th one was throwing an issue.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuyfgol7bptjfx8lfl6ql.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuyfgol7bptjfx8lfl6ql.png" alt="Image description" width="800" height="399"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After some debugging, I realized the checkboxes were not selected properly and changed the way how I selected them. This fixed the issue and all the test cases passed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdx7di8za4qtx0w96r85e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdx7di8za4qtx0w96r85e.png" alt="Image description" width="800" height="268"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once I did a review of the code to see everything works as expected, I made a &lt;a href="https://github.com/tjtanjin/react-chatbotify/pull/273" rel="noopener noreferrer"&gt;pull request&lt;/a&gt; for it.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Trying to do Larger contributions to Open Source</title>
      <dc:creator>Bregwin Jogi</dc:creator>
      <pubDate>Wed, 20 Nov 2024 20:22:07 +0000</pubDate>
      <link>https://dev.to/bregwin/trying-to-do-larger-contributions-to-open-source-3hmm</link>
      <guid>https://dev.to/bregwin/trying-to-do-larger-contributions-to-open-source-3hmm</guid>
      <description>&lt;p&gt;This week, I worked on several open-source projects trying to work on larger issues and making better contributions. While I completed some of the issues, I realized some others were beyond my current skill level. It taught me a lot about how to gauge the scope of work and knowing what to contribute to.&lt;/p&gt;

&lt;p&gt;One example was an issue in the &lt;a href="https://github.com/brave/brave-browser" rel="noopener noreferrer"&gt;Brave Browser&lt;/a&gt; project to &lt;a href="https://github.com/brave/brave-browser/issues/41428" rel="noopener noreferrer"&gt;add a policy&lt;/a&gt; for disabling a feature. The documentation provided clear instructions, so I decided to give it a try. After cloning the repositories, one for the whole project and the other containing the actual browser code which is a fork of chromium (it was HUGE). I installed the necessary tools (like depot_tools) and packages needed by Chromium. Despite realizing early on that the project was massive, I decided to give it a shot. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg6hkndz7vn1d5ute89v2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg6hkndz7vn1d5ute89v2.png" alt="Image description" width="800" height="435"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;However, when I tried to implement the policy, I discovered I needed to trace all instances of the feature and understand where the policy flags needs to be applied. Ultimately, I lacked the experience and knowledge to proceed, so I decided not to continue. This was a good reminder that I have a long way to go, but it was also exciting because I know there are so many cool things I never worked with. The project's documentation and instructions were excellent, and I hope to revisit this task when I’m better prepared.&lt;/p&gt;

&lt;p&gt;Next, I focused on smaller issues in other repositories:&lt;/p&gt;

&lt;h3&gt;
  
  
  VS Code Python Extension by Microsoft
&lt;/h3&gt;

&lt;p&gt;The &lt;a href="https://github.com/microsoft/vscode-python/issues/23052" rel="noopener noreferrer"&gt;issue&lt;/a&gt; involved preventing test coverage from running a second time if it had already failed. I located the GitHub Actions workflow file and found the step responsible for running test coverage. By using the &lt;code&gt;needs&lt;/code&gt; argument, I made the step depend on the earlier test steps to be completed. After updating the workflow and creating a &lt;a href="https://github.com/microsoft/vscode-python/pull/24421" rel="noopener noreferrer"&gt;pull request&lt;/a&gt;, I was happy to see it accepted and merged.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa3ye3gh0a95fep14mqr0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa3ye3gh0a95fep14mqr0.png" alt="Image description" width="800" height="545"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Detect-Secrets by Yelp
&lt;/h3&gt;

&lt;p&gt;This &lt;a href="https://github.com/Yelp/detect-secrets" rel="noopener noreferrer"&gt;project&lt;/a&gt; scans codebases for exposed secrets. There was a &lt;a href="https://dev.tourl"&gt;feature request&lt;/a&gt; (labelled as good first issue by the repo authors) to display the total number of secrets found after a scan. I &lt;a href="https://github.com/Yelp/detect-secrets/pull/893" rel="noopener noreferrer"&gt;added&lt;/a&gt; functionality to count and display the number of secrets in the terminal.&lt;/p&gt;

&lt;h3&gt;
  
  
  Restler-Fuzzer by Microsoft
&lt;/h3&gt;

&lt;p&gt;The &lt;a href="https://github.com/microsoft/restler-fuzzer/issues/773" rel="noopener noreferrer"&gt;issue&lt;/a&gt; was to add some kind of validation to ensure that the dictionary used by a function doesn't have non string values. I &lt;a href="https://github.com/microsoft/restler-fuzzer/pull/915" rel="noopener noreferrer"&gt;wrote&lt;/a&gt; a validation function for it and added test cases to confirm it worked without breaking existing code. &lt;/p&gt;

&lt;p&gt;These experiences reminded me how much I still have to learn. While I couldn’t complete everything I started, I’m grateful for the opportunities to contribute and improve my skills.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>opensource</category>
      <category>coding</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Adding Continuous Integration to my Project</title>
      <dc:creator>Bregwin Jogi</dc:creator>
      <pubDate>Sat, 16 Nov 2024 00:57:22 +0000</pubDate>
      <link>https://dev.to/bregwin/adding-continuous-integration-to-my-project-5cbl</link>
      <guid>https://dev.to/bregwin/adding-continuous-integration-to-my-project-5cbl</guid>
      <description>&lt;p&gt;This week, I implemented continuous integration (CI) for my GitHub project, &lt;a href="https://github.com/brokoli777/RefactorCode" rel="noopener noreferrer"&gt;RefactorCode&lt;/a&gt;. Since the code is hosted on GitHub, I decided to use GitHub Actions for this purpose. My goal was to ensure that all tests run automatically on every push to the repository. This way, I could prevent breaking changes and keep the application more stable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting Up CI with GitHub Actions
&lt;/h2&gt;

&lt;p&gt;I had already set up testing with Jest last week, so this week’s task was to configure GitHub Actions to run tests in each push to the repo. I used a preconfigured GitHub Actions workflow, which allowed me to run the tests as well as run ESLint.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fft3ky6vku40jlon28njk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fft3ky6vku40jlon28njk.png" alt="Image description" width="495" height="639"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After setting it up, I verified that tests were executed automatically on every push. This setup gives me peace of mind because I no longer have to worry about breaking existing features when making multiple changes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffy6newdkvwnsn55kdo34.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffy6newdkvwnsn55kdo34.png" alt="Image description" width="800" height="434"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Collaborating with another Student
&lt;/h2&gt;

&lt;p&gt;I also worked on tests for a project by another student, Vinh, called &lt;a href="https://github.com/vinhyan/barrierless" rel="noopener noreferrer"&gt;Barrierless&lt;/a&gt; (great name, by the way) which translates text files into different languages. My contribution was adding tests to check whether the command-line arguments such as setting options for model type, AI provider, and output file worked as expected.&lt;/p&gt;

&lt;p&gt;In return, Vinh added some test cases to my project as well.&lt;/p&gt;

&lt;h2&gt;
  
  
  Takeaways
&lt;/h2&gt;

&lt;p&gt;Adding CI to RefactorCode was a much-needed improvement that improves the stability and reduces bugs in the project. Working on another person’s project was also a great experience, as it gave me more info about how their code was set up and helped me write better test cases.&lt;/p&gt;

&lt;p&gt;Overall, this week’s updates made both projects more reliable and was a fun learning experience.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Testing Troubles with Jest &amp; ESM and how to fix it</title>
      <dc:creator>Bregwin Jogi</dc:creator>
      <pubDate>Sat, 09 Nov 2024 01:17:45 +0000</pubDate>
      <link>https://dev.to/bregwin/testing-troubles-with-jest-and-esm-and-how-to-fix-it-pae</link>
      <guid>https://dev.to/bregwin/testing-troubles-with-jest-and-esm-and-how-to-fix-it-pae</guid>
      <description>&lt;p&gt;This week, I was tasked with adding tests to my &lt;a href="https://github.com/brokoli777/RefactorCode" rel="noopener noreferrer"&gt;RefactorCode&lt;/a&gt; project. As I started adding new features, I noticed that some existing features were breaking, and it became increasingly difficult to test everything manually. This made it clear that I needed to implement proper automated testing to ensure the application is stable.&lt;/p&gt;

&lt;p&gt;Since I had prior experience with &lt;a href="https://jestjs.io/" rel="noopener noreferrer"&gt;Jest&lt;/a&gt; from my previous Cloud Computing for Programmers course, where I worked with Node.js, I decided to use it for this project as well. I started by writing some tests to check the functionality of my code. However, I encountered a few errors that I hadn’t faced before. After some debugging and searching through Stack Overflow, I realized that there are additional configurations required when using ESM (ECMAScript Modules) with Jest. In my previous project, I had used CommonJS, which worked perfectly. While I could have opted to use Babel for the conversion, Jest offered a new beta feature that allowed ESM to run directly. I decided to give it a try, and it worked great!&lt;/p&gt;

&lt;p&gt;This explains everything related to configuring jest with ESM: &lt;a href="https://dev.tourl"&gt;&lt;/a&gt;&lt;a href="https://jestjs.io/docs/ecmascript-modules" rel="noopener noreferrer"&gt;https://jestjs.io/docs/ecmascript-modules&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here is a quick overview of the setup:&lt;/p&gt;

&lt;p&gt;Install Jest:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install --save-dev jest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a jest.config.js file. Here I set what folders to ignore as well:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export default {
  testPathIgnorePatterns: ["/node_modules/", "/examples"],
  transform: {},
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the &lt;code&gt;package.json&lt;/code&gt; scripts section, use the experimental argument for jest to work with ESM modules:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"scripts": {
    "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a test file. I created all the tests within a test folder in root directory. Here is a simple one I created:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { readFile, checkIfDirectory } from "../src/fileUtils";

describe("File Utility", () =&amp;gt; {
    test("Read File", () =&amp;gt; {
      readFile("./examples/test.txt").then((data) =&amp;gt; {
        expect(data).toBe("Hello World");
      });

    });

    test('should return true if the path is a directory', async () =&amp;gt; {
      const result = await checkIfDirectory('./examples');
      expect(result).toBe(true);
    });
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you want to test using a single test file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm test -- banner.test.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For running all the tests, we use the script, we added earlier in package.json:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm run test
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, the basic tests were set up. However, this was just the beginning of my troubleshooting journey. I also faced difficulties with mocking libraries and modules, especially since they were using ESM. These required extra configuration, but after some tweaking, I was able to get everything working, and the tests ran successfully.&lt;/p&gt;

&lt;p&gt;Instead of using the regular &lt;code&gt;jest.mock&lt;/code&gt;, you have to use &lt;code&gt;jest.unstable_mockModule&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;For example: await jest.unstable_mockModule("fs", () =&amp;gt; ({
  existsSync: jest.fn(),
  readFileSync: jest.fn(),
}));
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;See &lt;a href="https://jestjs.io/docs/ecmascript-modules#module-mocking-in-esm" rel="noopener noreferrer"&gt;this section&lt;/a&gt; for more info.&lt;/p&gt;

&lt;p&gt;One of the core functionalities I wanted to test involved integrating with the Gemini API. Since I didn’t want to rely on the live API for testing, I decided to mock the API calls. Initially, I tried using Nock, but I ran into issues because it didn’t work well with Node’s default fetch implementation. It seemed that the Gemini library was using the default fetch instead of a third-party fetch implementation, which caused the mock to fail. After several attempts without success, I switched to another library called &lt;a href="https://github.com/mswjs/msw" rel="noopener noreferrer"&gt;MSW&lt;/a&gt; (Mock Service Worker). Although it required a bit more setup to create a mock server, it worked flawlessly on the first try. I crafted an example response based on how the Gemini API would respond, which allowed me to test the refactored functionality.&lt;/p&gt;

&lt;p&gt;Here is how the mock server was set up for reference:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { http, HttpResponse } from 'msw'

export const handlers = [
    http.post('https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent', () =&amp;gt; {
        return HttpResponse.json({
                candidates: [
                    {
                        content: {
                            parts: [
                                {
                                    text: JSON.stringify({
                                        explanation: "The provided code has been refactored to address several issues and improve readability.",
                                        refactoredCode: `
                                            var count = 0;
                                            var message = "Hello";
                                        `
                                    })
                                }
                            ],
                            role: "model"
                        },
                        finishReason: "STOP",
                        index: 0
                    }
                ],
        });
    }),    
];

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can see that I am mocking a specific API endpoint that I am using for the application. Now all you have to do this add the below to start the server while testing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { setupServer } from "msw/node";
import { handlers } from "../mocks/handler.js";
export const server = setupServer(...handlers);

server.listen();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Reflecting on the process, this was a great learning experience for me. In hindsight, I probably should have checked the compatibility of the libraries I was using and considered any potential issues beforehand. Despite the challenges, I’m glad to have reached a point where my tests are running smoothly. I look forward to adding more tests in the future and improving the overall stability of my project.&lt;/p&gt;

</description>
      <category>testing</category>
      <category>webdev</category>
      <category>node</category>
      <category>javascript</category>
    </item>
    <item>
      <title>A brief recap of what I did this Month</title>
      <dc:creator>Bregwin Jogi</dc:creator>
      <pubDate>Thu, 31 Oct 2024 23:56:37 +0000</pubDate>
      <link>https://dev.to/bregwin/a-brief-recap-of-what-i-did-this-month-40e1</link>
      <guid>https://dev.to/bregwin/a-brief-recap-of-what-i-did-this-month-40e1</guid>
      <description>&lt;p&gt;Happy Halloween and Diwali! &lt;/p&gt;

&lt;p&gt;Now that today's the last day of October, I wanted to make a quick recap on my involvement with the Open Source Community, what I learned so far, and things I found interesting.&lt;/p&gt;

&lt;p&gt;I became familiar with open source projects contributing to 6 projects, ranging from fixing very small typos to adding new features. Here are the projects and the pull requests I made for them:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href="https://github.com/nats-io/nats.docs" rel="noopener noreferrer"&gt;Nats.io&lt;/a&gt;&lt;/strong&gt; - Fixing a small spelling mistake.&lt;br&gt;
&lt;a href="https://github.com/nats-io/nats.docs/pull/752" rel="noopener noreferrer"&gt;https://github.com/nats-io/nats.docs/pull/752&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href="https://github.com/tldr-pages" rel="noopener noreferrer"&gt;TLDR&lt;/a&gt;&lt;/strong&gt; - Adding Documentation to Azure Cli&lt;br&gt;
&lt;a href="https://github.com/tldr-pages/tldr/pull/13934" rel="noopener noreferrer"&gt;https://github.com/tldr-pages/tldr/pull/13934&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href="https://github.com/ScottPlot/ScottPlot" rel="noopener noreferrer"&gt;ScottPlot&lt;/a&gt;&lt;/strong&gt; - Adding a minor center property&lt;br&gt;
&lt;a href="https://github.com/ScottPlot/ScottPlot/pull/4335" rel="noopener noreferrer"&gt;https://github.com/ScottPlot/ScottPlot/pull/4335&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href="https://github.com/microsoft/vscode-python" rel="noopener noreferrer"&gt;VS Code Python&lt;/a&gt;&lt;/strong&gt; - Removing JSDocs types&lt;br&gt;
&lt;a href="https://github.com/microsoft/vscode-python/pull/24300" rel="noopener noreferrer"&gt;https://github.com/microsoft/vscode-python/pull/24300&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href="https://github.com/mozilla/mozdownload" rel="noopener noreferrer"&gt;Mozdownload&lt;/a&gt;&lt;/strong&gt; - Adding dependabot configuration to update GitHub actions.&lt;br&gt;
&lt;a href="https://github.com/mozilla/mozdownload/pull/703" rel="noopener noreferrer"&gt;https://github.com/mozilla/mozdownload/pull/703&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href="https://github.com/google/magika" rel="noopener noreferrer"&gt;Magika&lt;/a&gt;&lt;/strong&gt; - Adding a function to validate python README markdown&lt;br&gt;
&lt;a href="https://github.com/google/magika/pull/739" rel="noopener noreferrer"&gt;https://github.com/google/magika/pull/739&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You would notice that a lot of the pull requests are very small fixes. The main reason for that to be honest because I wasn't fully skilled to fix some of the issues I thought to contribute to. When I looked at some issues and the associated codebase, I realized it might be better to work on a simpler issue than stopping an issue halfway through because of the lack of knowledge. However, these simpler issues taught me a lot about how to interact with contributors, creating pull requests and following the contributing guidelines for these projects. &lt;/p&gt;

&lt;p&gt;This was very helpful for some later contributions where I could focus more on coding the feature instead of worrying about other factors.&lt;/p&gt;

&lt;p&gt;I also did some work on my own open source project - &lt;a href="https://github.com/brokoli777/RefactorCode/tree/main" rel="noopener noreferrer"&gt;RefactorCode&lt;/a&gt;.&lt;br&gt;
I refactored the code (touche), adding tools like Prettier and ESLint to make the code easy to maintain and added a &lt;code&gt;contributing.md&lt;/code&gt; to make it easier in case anyone wanted to contribute to the project.&lt;/p&gt;

&lt;p&gt;I have been doing these contributions as part of my OSD course at Seneca as a final semester student, but I am hoping that I find time to contribute to these projects even after I graduate. &lt;/p&gt;

&lt;p&gt;Because a lot of what I like in coding was made possible through these projects, and it is fun to work with the people responsible for it.&lt;/p&gt;

&lt;p&gt;It was a pretty busy and intense month due to having to manage other courses and midterms, but I feel it was worth it.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to use Eslint and Prettier together for your Node.js Project</title>
      <dc:creator>Bregwin Jogi</dc:creator>
      <pubDate>Wed, 30 Oct 2024 16:53:51 +0000</pubDate>
      <link>https://dev.to/bregwin/how-to-use-eslint-and-prettier-together-for-your-nodejs-project-k4g</link>
      <guid>https://dev.to/bregwin/how-to-use-eslint-and-prettier-together-for-your-nodejs-project-k4g</guid>
      <description>&lt;p&gt;I recently added two major static analysis tools to my project &lt;a href="https://github.com/brokoli777/RefactorCode/tree/main" rel="noopener noreferrer"&gt;RefactorCode&lt;/a&gt; : &lt;strong&gt;Prettier&lt;/strong&gt; and &lt;strong&gt;ESLint&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;It allows contributors working on the project to maintain the quality of the code by fixing formatting issues and common code errors. This means that I can simply run a command to check if the code is consistent, without looking at each file to see if it fits the guidelines. &lt;/p&gt;

&lt;p&gt;Here's how I did it:&lt;/p&gt;

&lt;p&gt;I installed Prettier and Eslint through npm:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install --save-dev prettier eslint eslint-config-prettier
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We are also installing &lt;code&gt;eslint-config-prettier&lt;/code&gt; for them to work together and not interfere with each other.&lt;/p&gt;

&lt;p&gt;Add prettier config and ignore files (Check prettier &lt;a href="https://prettier.io/docs/en/install" rel="noopener noreferrer"&gt;docs&lt;/a&gt; for more info):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;node --eval "fs.writeFileSync('.prettierrc','{}\n')"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;node --eval "fs.writeFileSync('.prettierignore','# Ignore artifacts:\nbuild\ncoverage\n')"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;...And you are pretty much done for Prettier, you can call format the files using the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx prettier . --write
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also add a script to run it which I will get into later.&lt;/p&gt;

&lt;p&gt;Now let's continue with ESLint&lt;/p&gt;

&lt;p&gt;Run the setup for ESLint:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx eslint --init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Complete the setup based on your requirements, here's how I did it for my project:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzhw5n11brvjgesymr8pq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzhw5n11brvjgesymr8pq.png" alt="Image description" width="688" height="307"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I added the files and folders to not be linted:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fix44ols90x670tijr1ly.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fix44ols90x670tijr1ly.png" alt="Image description" width="593" height="291"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I then added scripts in &lt;code&gt;package.json&lt;/code&gt; to make it easier to run them:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"scripts": {
    "format": "prettier --write \"**/*.{js,ts,html,css,md,json}\"",
    "lint": "eslint . ",
    "lint:fix": "eslint . --fix "
  },
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When I ran Prettier for the first time, there were a lot of white spaces issues that were fixed, I checked if the program still worked properly and committed the changes. I did the same for ESLint. There were some import errors, so I fixed them manually.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0gtcpnah9vt78fxa2j1s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0gtcpnah9vt78fxa2j1s.png" alt="Image description" width="540" height="347"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After checking to see if the program still ran properly, I committed all the changes and merged it to the main branch.&lt;/p&gt;

&lt;p&gt;There is also a way to integrate these tools with VS Code, you can install their extensions from the VS Code Marketplace:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint" rel="noopener noreferrer"&gt;Prettier - Code formatter&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6lxjtjot4nwuommlyugh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6lxjtjot4nwuommlyugh.png" alt="Image description" width="800" height="174"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode" rel="noopener noreferrer"&gt;ESLint&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwwgz0ev9npcvijyxc7cz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwwgz0ev9npcvijyxc7cz.png" alt="Image description" width="800" height="167"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Create a &lt;code&gt;.vscode/settings.json&lt;/code&gt; file within the root directory of your project if you want to specify the extension settings only for your current project.&lt;/p&gt;

&lt;p&gt;Here is the configuration I used for it to format and lint on save:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// .vscode/settings.json
{
    // Enable format on save
    "editor.formatOnSave": true,

    // Set Prettier as the default formatter
    "[javascript]": {
      "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[typescript]": {
      "editor.defaultFormatter": "esbenp.prettier-vscode"
    },

    // Enable ESLint to auto-fix issues on save
    "editor.codeActionsOnSave": {
      "source.fixAll.eslint": true,
      "source.organizeImports": true
    }
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Overall, I think tools are great. It fixed a lot of formatting errors and issues that I otherwise wouldn't have noticed. I am going to use them when starting a new project from now on.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>From Regex to Ruff: Lessons Learned in Contributing to Magika</title>
      <dc:creator>Bregwin Jogi</dc:creator>
      <pubDate>Tue, 29 Oct 2024 23:43:18 +0000</pubDate>
      <link>https://dev.to/bregwin/from-regex-to-ruff-lessons-learned-in-contributing-to-magika-2be6</link>
      <guid>https://dev.to/bregwin/from-regex-to-ruff-lessons-learned-in-contributing-to-magika-2be6</guid>
      <description>&lt;p&gt;This is another contribution I did as part of my OSD600 course at Seneca College. This would be one of my final ones, as other assignments catching up to me. But I really liked that I was able to contribute to many interesting projects as part of this assignment.&lt;/p&gt;

&lt;p&gt;This time, I contributed to Magika, a tool by Google to detect file content types using machine learning. It seemed like a pretty cool project and I thought I might be able to use it for my open source project &lt;a href="https://github.com/brokoli777/RefactorCode/tree/main" rel="noopener noreferrer"&gt;RefactorCode&lt;/a&gt; which surprise-surprise refactors your code. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ferft1ursbzr8npc86nev.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ferft1ursbzr8npc86nev.png" alt="Image description" width="800" height="249"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://github.com/google/magika/issues/730" rel="noopener noreferrer"&gt;issue&lt;/a&gt; was to update the  github actions workflow to check that their README (for the python package) doesn't contain relative paths. I first reached out to the issue author with a couple of questions, and he quickly clarified them.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqcnwfiv4h06fdvrw3b3d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqcnwfiv4h06fdvrw3b3d.png" alt="Image description" width="800" height="222"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So I forked the repository, created a new branch, and opened a draft pull request. I added a new function that parses the markdown for links. I used regex for this. There is also regex validation to check if the links are relative. It then uses the &lt;code&gt;requests&lt;/code&gt; module to check if the links are valid or not. If a link is invalid, it is added to an error list so the program finds all errors in one run instead of stopping at the first one. It then prints out information about each error.&lt;/p&gt;

&lt;p&gt;The goal was to prevent the package from building if the documentation contains links that users can't access. It took me a bit of time to get the regex working, but with some help from Stack Overflow, I figured it out.&lt;/p&gt;

&lt;p&gt;Once I was ready, I converted the draft to an actual &lt;a href="https://github.com/google/magika/pull/739" rel="noopener noreferrer"&gt;pull request&lt;/a&gt; and waited for feedback from the issue author. I received some great constructive feedback early on. The code did not pass the &lt;a href="https://docs.astral.sh/ruff/" rel="noopener noreferrer"&gt;ruff&lt;/a&gt; format check, so I had to update the code to the correct format. There was also a suggestion to make the function more generic to Markdown. So I updated the code for it. I also made it work for folders but based on the suggestions from the author that it made it overcomplicated, I reverted it for only one markdown file path.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fongytq51t2akc8mfght5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fongytq51t2akc8mfght5.png" alt="Image description" width="800" height="444"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I tested it in a modified README to see if it worked, and it worked great!&lt;/p&gt;

&lt;p&gt;After a series of feedbacks and updates, the code met all requirements and was successfully merged into the main branch. There was a lot more communication and feedback compared to my previous contribution, and I learned a lot about how to communicate asynchronously.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F901ufpl061g4dvszmf2x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F901ufpl061g4dvszmf2x.png" alt="Image description" width="800" height="321"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Overall this whole series of contributions was a really fun, &lt;br&gt;
It made me better to understand code bases with different styles and format, how to contribute to open source effectively. I gained a huge amount of appreciation for the countless contributors across various repos who have spent their time and effort, sharing code freely for everyone. &lt;/p&gt;

&lt;p&gt;I look forward to being a part of this community in the future and continuing to give back.&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>coding</category>
      <category>github</category>
    </item>
    <item>
      <title>Contributing to Open Source Projects #3</title>
      <dc:creator>Bregwin Jogi</dc:creator>
      <pubDate>Wed, 16 Oct 2024 21:58:44 +0000</pubDate>
      <link>https://dev.to/bregwin/contributing-to-open-source-projects-3-dij</link>
      <guid>https://dev.to/bregwin/contributing-to-open-source-projects-3-dij</guid>
      <description>&lt;p&gt;This week, I worked on updating the GitHub Actions workflow for the Mozdownload repository, a download tool created by Mozilla for Firefox and Thunderbird. The &lt;a href="https://github.com/mozilla/mozdownload/issues/702" rel="noopener noreferrer"&gt;GitHub issue&lt;/a&gt; I decided to work on was to adjust the Dependabot configuration to automate Python dependency updates related to Node.js actions.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3xzudp6b8vqx3vnsgah6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3xzudp6b8vqx3vnsgah6.png" alt="Image description" width="800" height="338"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The issue was well-documented, so I had a clear idea of where to make the changes. The goal was to ensure that Dependabot would automatically update these dependencies instead of manually making the updates.&lt;/p&gt;

&lt;h3&gt;
  
  
  What I did:
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0nuqdxy813lewc7sko9g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0nuqdxy813lewc7sko9g.png" alt="Image description" width="800" height="459"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Checked the current setup:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;I looked at the existing dependabot.yml file to understand how it was configured.&lt;/li&gt;
&lt;li&gt;I also reviewed GitHub’s documentation to confirm the correct approach.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Made the required changes:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;I updated the configuration to run weekly checks for dependency updates.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Opened a pull request:
&lt;/h4&gt;

&lt;p&gt;After making the changes, I submitted a &lt;a href="https://github.com/mozilla/mozdownload/pull/703" rel="noopener noreferrer"&gt;pull request&lt;/a&gt; explaining what I did.&lt;/p&gt;

&lt;p&gt;Surprisingly, I received quick feedback on the pull request. The issue author responded promptly, suggesting a minor modification, which they implemented themselves. Shortly after, the pull request was successfully merged into the repository.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuyviqh0np51xo9320czz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuyviqh0np51xo9320czz.png" alt="Image description" width="800" height="111"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Looking forward to contributing to another project next week!&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
