<?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: Abdullah Al Mamun Fahim</title>
    <description>The latest articles on DEV Community by Abdullah Al Mamun Fahim (@aamfahim).</description>
    <link>https://dev.to/aamfahim</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%2F2022732%2Fcc5fa456-2719-4743-8410-458c81fcdaa4.png</url>
      <title>DEV Community: Abdullah Al Mamun Fahim</title>
      <link>https://dev.to/aamfahim</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/aamfahim"/>
    <language>en</language>
    <item>
      <title>Release 0.4 Release</title>
      <dc:creator>Abdullah Al Mamun Fahim</dc:creator>
      <pubDate>Sat, 07 Dec 2024 21:50:31 +0000</pubDate>
      <link>https://dev.to/aamfahim/release-04-release-13cn</link>
      <guid>https://dev.to/aamfahim/release-04-release-13cn</guid>
      <description>&lt;p&gt;For this week I was once able to work on one more issue, despite my reservations about having enough time to work on a issue with couple final exams on the calendar this week.&lt;/p&gt;

&lt;h2&gt;
  
  
  Investigation
&lt;/h2&gt;

&lt;p&gt;When I was looking for issues I found this &lt;a href="https://github.com/adrienpoly/rubyvideo/issues/219" rel="noopener noreferrer"&gt;issue&lt;/a&gt; interesting. The problem is when searching on the search bar the recommendations were the oldest talks, instead it would make more sense to just show newer talks. There was a recent &lt;a href="https://github.com/adrienpoly/rubyvideo/pull/407" rel="noopener noreferrer"&gt;PR&lt;/a&gt; that implemented a global search. I thought this issue was addressed since it uses spotlight search. But after some investigation I found the issue was still present. So I dove into the code base seeing that new global search uses something called spotlight search that uses turbo. So after some digging I found the talk controller under spotlight. After reading the code I realized I can just sort it by &lt;code&gt;date&lt;/code&gt; attribute and since it shows the first 5 it'd be the right fix.&lt;/p&gt;

&lt;h2&gt;
  
  
  Aftermath
&lt;/h2&gt;

&lt;p&gt;So, I made my &lt;a href="https://github.com/adrienpoly/rubyvideo/pull/486" rel="noopener noreferrer"&gt;PR&lt;/a&gt;, one of the maintainer thanked me for the catch and recommended that I do the same for events since it shows the oldest events as well. So after the change I was waiting for further feedback. The owner mentioned that talks implementation for spotlight search can be made better. There is a scope called &lt;code&gt;ranked&lt;/code&gt; that uses the keyword presence in title and description to create ranking. It also made sense to show relevant results(ranked) rather than the first 5 of the newest talks. He also gave me suggestions on updating the implementation as well. They use &lt;code&gt;BM25&lt;/code&gt; algorithm to create the ranking. We could also include how old the talk is to update ranking. For example, we can penalize newer records using a scale. Another suggestion was to use talk date as tie breaker when ranking(bm25 score) is the same.&lt;/p&gt;

&lt;p&gt;I tried the first recommended scope and I still got the newest records in all cases, while the second recommendation had a mix of newer and older records in some cases. I played around with the given multiplier for the first recommendation, but I didn't see any significant changes. So I informed the owner about my finding. He made a new PR to show me how the bm25 ranking works and updated the multiplier as well. In my testing I went as far as &lt;code&gt;0.000001&lt;/code&gt; but in the PR I noticed he used &lt;code&gt;0.000000001&lt;/code&gt;. And I did notice better results. After the update, and some waiting my PR was merged.&lt;/p&gt;

&lt;h2&gt;
  
  
  Finish Line
&lt;/h2&gt;

&lt;p&gt;This was a great experience. Working in production ready codebase lends to a great learning opportunity. Knowing Git and GitHub made my life a lot easier. I'm proud of what I was able to accomplish in just 4 months. I got to interact with a lot of new codebase and was genuinely surprised how nice everyone was. Although sometimes waiting for the response was a bit boring but it was really nice. Looking at previous PRs is also a great help on how the code base in handled and how the code is written. Overall, it was pretty good. &lt;/p&gt;

</description>
      <category>rails</category>
      <category>github</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Release 0.4 Progress</title>
      <dc:creator>Abdullah Al Mamun Fahim</dc:creator>
      <pubDate>Tue, 03 Dec 2024 20:02:00 +0000</pubDate>
      <link>https://dev.to/aamfahim/release-04-progress-5b2k</link>
      <guid>https://dev.to/aamfahim/release-04-progress-5b2k</guid>
      <description>&lt;p&gt;For this week, I was able to contribute to Ruby projects and also practice my ruby skills. And I can gladly say I found the &lt;a href="https://github.com/adrienpoly/rubyvideo" rel="noopener noreferrer"&gt;perfect repo&lt;/a&gt;. They are responsible for Indexing all Ruby related videos from conferences and meetups worldwide similar to &lt;a href="https://pyvideo.org/" rel="noopener noreferrer"&gt;pyvideo.org&lt;/a&gt;. I thought it was the best place to contribute to give back to the ruby community.&lt;/p&gt;

&lt;p&gt;You can find them @&lt;a href="https://www.rubyvideo.dev/" rel="noopener noreferrer"&gt;rubyvideo.dev&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;I was able to work on two more issues.&lt;/p&gt;

&lt;h2&gt;
  
  
  Issue #1
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/adrienpoly/rubyvideo/issues/450" rel="noopener noreferrer"&gt;This issue&lt;/a&gt; was about showing language to the talks page. It would be a great addition to non-English speakers. My first instinct was to see if they already have feature showing languages and they did. They have have language name and emoji on talk cards adn it was only shown if it is in any language other than English. So, I followed how it was done. They already had a helper to get the language the talk was in. And I knew what I had to do. Next step was to choose where to display it. They UI is very minimal so I had to be conscious about where to put it. So, I decided to put it in the description. After I made the &lt;a href="https://github.com/adrienpoly/rubyvideo/pull/465" rel="noopener noreferrer"&gt;PR&lt;/a&gt;. It was merged very quickly. So, after working on this repo I understood how the codebase was and what they were using.&lt;/p&gt;

&lt;h2&gt;
  
  
  Issue #2
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/adrienpoly/rubyvideo/issues/410" rel="noopener noreferrer"&gt;This issue&lt;/a&gt; was a bit of work and a lot of research. Someone wanted to be able to open YouTube video in YouTube instead of watching it on the site. Rubyvideo use a  lightweight JavaScript library for their video player called &lt;a href="https://github.com/vlitejs/vlite" rel="noopener noreferrer"&gt;Vlitejs&lt;/a&gt;. My first instinct was to look at PRs involving modifications to the video player. And there was a PR adding playback feature to the video player. They did it via JS using event listeners. So, Now I had an idea of how to implement it. Next I took a look at the JS library used to see if they have any built in way to implement it. Unfortunately they didn't. So, I planned to add and icon on the player itself. When clicked it would open the video in a new tab.&lt;/p&gt;

&lt;p&gt;So, I went to implementation and most of my work was in&lt;code&gt;video_player_controller.js&lt;/code&gt;. Using JS and HTML query I get the video ID and added an onClick eventlistener to open open a new tab with the video ID. Next roadblock was to add the YouTube Icon. They used &lt;code&gt;FontAwesome&lt;/code&gt; for their icon library and they download an SVG from their site and use it. So, that's what I did. However, I could not set the color for some reason. Even with modifying the css of the added classname the color would not change. Only other was it worked was adding the SVG code inline using &lt;code&gt;innerHTML&lt;/code&gt;. I did not like that since that's not how its done across the app and adding the SVG can lead to reusability. After trial, error and some research I found that Vite has built in feature to import svg code from and &lt;code&gt;.svg&lt;/code&gt; file. After sometime I was able to get it the way I liked it and I made the &lt;a href="https://github.com/adrienpoly/rubyvideo/pull/467" rel="noopener noreferrer"&gt;PR&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The owner left some feedback on css changes and having the video playing while the a new tab opens. They liked my idea but wanted some fixes. I updated my PR and after sometime they wanted more changes. They wanted another button on the outside as well. So, I had to refactor and add eventlisteners in two places and updated the view file. And I was right about reusing the icon because I had to add it to the button outside as well. &lt;/p&gt;

&lt;p&gt;After that I was left another feedback on refactoring it to use &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; tags instead of buttons so that Mac users can &lt;code&gt;cmd+click&lt;/code&gt; to open in new tab and they left a code suggestion which didn't make sense. after some back and forth I realized they didn't want buttons and event listeners instead they wanted &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; tags with &lt;a href="https://stimulus.hotwired.dev/" rel="noopener noreferrer"&gt;&lt;code&gt;Stimulus.js&lt;/code&gt;&lt;/a&gt; functionality. After some research and more back and forth, I was able able to makes changes the maintainer wanted. It was nice cause I was not aware of stimulus.js and how it worked. And finally it was merged. I'm glad they were quick with their response so that I could quickly update the code.&lt;/p&gt;

&lt;h3&gt;
  
  
  What's next
&lt;/h3&gt;

&lt;p&gt;I want to work on more issue but not sure if I'll be able to fit in this week with finals approaching. Not sure if it'll be an issue in JS or Ruby but I'd want it to be in Ruby as well. As of now I'm looking for a new issue. Hopefully I will find it soon.&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>rails</category>
      <category>ruby</category>
      <category>github</category>
    </item>
    <item>
      <title>Release 0.4 Planning</title>
      <dc:creator>Abdullah Al Mamun Fahim</dc:creator>
      <pubDate>Tue, 26 Nov 2024 01:57:43 +0000</pubDate>
      <link>https://dev.to/aamfahim/release-04-planning-15nh</link>
      <guid>https://dev.to/aamfahim/release-04-planning-15nh</guid>
      <description>&lt;p&gt;As we go into the final release we are supposed to work on issues that we can feel proud of at the end of the semester. I plan on working on more Ruby related issues. Since I have an upcoming co-op where I will be working in Ruby on Rails.&lt;/p&gt;

&lt;p&gt;With the end of the semester being busy with finals I don't have any particular repos in my mind. I want to work on issues that will help me hone my skills in Rails. I find the Ruby ecosystem is not as popular as JS ecosystem so I want to do my part to contribute to the Ruby ecosystem. In my previous issues I work on bug fixes and adding more tests. I plan on doing something similar this release as well. My only concern is the time commitment with each issue I work on since I have finals for other courses as well. Also I will be trying to find multiple related issues to work on since that is not a guarantee I will try to work on at least two issues.&lt;/p&gt;

&lt;p&gt;Hopefully next week I will have issues that I have worked on. If time permits I will also look at some additional issues. Right now my target is to work on at least one rails related project.&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>github</category>
    </item>
    <item>
      <title>Release 0.3 #2</title>
      <dc:creator>Abdullah Al Mamun Fahim</dc:creator>
      <pubDate>Tue, 19 Nov 2024 03:51:59 +0000</pubDate>
      <link>https://dev.to/aamfahim/release-03-2-2mgm</link>
      <guid>https://dev.to/aamfahim/release-03-2-2mgm</guid>
      <description>&lt;p&gt;While I looking for my second issue I came across &lt;a href="https://github.com/Rails-Designer/rails_icons" rel="noopener noreferrer"&gt;rails_icons&lt;/a&gt;. It reminded me of &lt;a href="https://react-icons.github.io/react-icons/" rel="noopener noreferrer"&gt;react-icons&lt;/a&gt; but for rails. Since I have have some experience in Ruby on rails and its been a while since I used it so I wanted to get some practice.&lt;/p&gt;

&lt;h2&gt;
  
  
  Approach
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://github.com/Rails-Designer/rails_icons/issues/18" rel="noopener noreferrer"&gt;issue&lt;/a&gt; is currently in order to use this gem the user must provide a &lt;code&gt;set&lt;/code&gt;. Some supported libraries don't have multiple variants (maybe just “solid” or “outline”). Also any custom added library might not have one, giving the user mental overhead to come up with a name. So, the set parameter to initialize the &lt;code&gt;RailsIcons::Icon&lt;/code&gt; instance. The issue includes all the places it is used.&lt;/p&gt;

&lt;h2&gt;
  
  
  Implementation
&lt;/h2&gt;

&lt;p&gt;My first Idea was to set default value of &lt;code&gt;set&lt;/code&gt; to nil. After that I had to update logic for everywhere &lt;a class="mentioned-user" href="https://dev.to/set"&gt;@set&lt;/a&gt; is used. After looking at the code I noticed &lt;code&gt;@set&lt;/code&gt; is not used directly. It is used by getter method &lt;code&gt;set&lt;/code&gt; which returns the set value if its present else it'll return &lt;code&gt;RailsIcons.configuration.default_set&lt;/code&gt;. I had to do some research on how to update the logic because now in &lt;code&gt;initialize&lt;/code&gt; method &lt;code&gt;@set&lt;/code&gt; can be "" if &lt;code&gt;nil&lt;/code&gt; is passed. So now &lt;code&gt;set&lt;/code&gt; method can return &lt;code&gt;""&lt;/code&gt; which didn't look right. So I wanted so that if &lt;code&gt;@set&lt;/code&gt; is &lt;code&gt;""&lt;/code&gt; &lt;code&gt;set&lt;/code&gt; method would return &lt;code&gt;nil&lt;/code&gt;. And I found &lt;code&gt;.presence&lt;/code&gt; helps me do the same thing. After that I put conditinal return statement in &lt;code&gt;error_message&lt;/code&gt;, &lt;code&gt;error_message&lt;/code&gt; and &lt;code&gt;custom_library&lt;/code&gt; method. But &lt;code&gt;custom_library&lt;/code&gt; was initially returning the set instead of the library. So I modified it to return library and in &lt;code&gt;library_set_attributes&lt;/code&gt; I separately dig for &lt;code&gt;set&lt;/code&gt; value. After I ran my changes I had to run &lt;code&gt;bundle exec standardrb&lt;/code&gt; to fix the lint errors and rails test to run the test suit. Since I'm using WSL I has some issues running &lt;code&gt;rails test&lt;/code&gt;. So I had to run &lt;code&gt;bundle install&lt;/code&gt;. After that all the tests were passing.&lt;/p&gt;

&lt;h2&gt;
  
  
  The PR
&lt;/h2&gt;

&lt;p&gt;Since I was done I made a &lt;a href="https://github.com/Rails-Designer/rails_icons/pull/19" rel="noopener noreferrer"&gt;PR&lt;/a&gt;. After making the PR the owner left some feedback requesting some changes. And once change I made was on thee conditional return statement had some code repetition. So putting arguments in an array and calling &lt;code&gt;.compact_blank&lt;/code&gt; fix this issue leading to a single return statement. I also used &lt;a href="https://thoughtbot.com/blog/ruby-splat-operator" rel="noopener noreferrer"&gt;splat operator&lt;/a&gt; to deconstruct the array to pass to respective user. As for other changes I made I left my explanation and additional questions. Currently awaiting response from the repo owner but I don't foresee any drastic changes being requested.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Working on a ruby project after taking a long break was refreshing. Since Ruby has a lot of use full methods &amp;amp; operator. There's always a method to help handle complex logic. Compared to hacktoberfest issues this was a lot more work with more work ahead. I definitely had to extend myself more on this release cycle.&lt;/p&gt;

</description>
      <category>ruby</category>
      <category>rails</category>
      <category>opensource</category>
      <category>github</category>
    </item>
    <item>
      <title>Release 0.3 #1</title>
      <dc:creator>Abdullah Al Mamun Fahim</dc:creator>
      <pubDate>Tue, 19 Nov 2024 02:30:58 +0000</pubDate>
      <link>https://dev.to/aamfahim/release-03-1-6p6</link>
      <guid>https://dev.to/aamfahim/release-03-1-6p6</guid>
      <description>&lt;p&gt;Last week I worked on a &lt;a href="https://github.com/tjtanjin/react-chatbotify/issues/186" rel="noopener noreferrer"&gt;issue&lt;/a&gt; writing unit test for PathProcessor Block processor in &lt;a href="https://github.com/tjtanjin/react-chatbotify" rel="noopener noreferrer"&gt;react-chatbotify&lt;/a&gt;. Since I've been writing tests for my own project, it seemed on brand to write a test. Although the project is in TS, it can be difficult to write unit test for a component that you are unfamiliar with.&lt;/p&gt;

&lt;h2&gt;
  
  
  Read The Code
&lt;/h2&gt;

&lt;p&gt;So the first step was to read the code of &lt;code&gt;PathProcessor.ts&lt;/code&gt;. It handles processing of path in current block. takes three params, block an instance of &lt;code&gt;Block&lt;/code&gt;, params an instance of &lt;code&gt;Params&lt;/code&gt; and goToPath which is a function which takes a string. I saw there's two imports for &lt;code&gt;Block&lt;/code&gt; and &lt;code&gt;Params&lt;/code&gt;. So I checked the Block and Params type. Although &lt;code&gt;Block&lt;/code&gt; is a bit complex its not really used by PathProcessor aside from its one attribute. Next is params with relatively simple implementation. Although I don't understand the entire code, I just had to understand how these types work in respect to &lt;code&gt;PathProcessor&lt;/code&gt;. And the logic on &lt;code&gt;PathProcessor&lt;/code&gt; is relatively simple its just a sequence of guard clauses.&lt;/p&gt;

&lt;h2&gt;
  
  
  Writing The Test
&lt;/h2&gt;

&lt;p&gt;I before writing the test I also took a look at previous PRs that are similar to mine. And the owner wants the only the logic of the component tested not everything that is used by it. So Basically I was testing all the logical paths of &lt;code&gt;PathProcessor&lt;/code&gt;. Based on the logic I would only need the &lt;code&gt;path&lt;/code&gt; attribute of block. As for &lt;code&gt;params&lt;/code&gt; I did not understand how it was being used so I mocked the entire object. I initially tired to mock only the needed attributes but I could not get all the tests to pass reliability. So, I did what I learned in my co-op that if the function is not the focus of the test just mock it. So that's what I did. While mocking I also followed how it was done in &lt;code&gt;AudioService.test.ts&lt;/code&gt; as recommended by the repo owner. And I followed the similar syntax. After a lot of trial and error I got 100% coverage.&lt;/p&gt;

&lt;h2&gt;
  
  
  Making PR
&lt;/h2&gt;

&lt;p&gt;After I was able to finalize my code I made my &lt;a href="https://github.com/tjtanjin/react-chatbotify/pull/266" rel="noopener noreferrer"&gt;PR&lt;/a&gt;. I noticed the repo owner uses &lt;a href="https://www.conventionalcommits.org/en/v1.0.0/" rel="noopener noreferrer"&gt;conventionalcommits&lt;/a&gt;, so I adjusted my commit messages accordingly. And finally the PR was merged on the first try! This was definitely more difficult than the hacktoberfest issues. Reading and navigating the large code base to write the test was definitely challenging. But so far so good!&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>opensource</category>
      <category>github</category>
    </item>
    <item>
      <title>Explainer.js Release 1.0.0 🎉</title>
      <dc:creator>Abdullah Al Mamun Fahim</dc:creator>
      <pubDate>Mon, 18 Nov 2024 20:43:05 +0000</pubDate>
      <link>https://dev.to/aamfahim/explainerjs-release-100-1f1b</link>
      <guid>https://dev.to/aamfahim/explainerjs-release-100-1f1b</guid>
      <description>&lt;p&gt;This week we have to implement versioned relase and publish it to &lt;a href="https://www.npmjs.com/" rel="noopener noreferrer"&gt;npm&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Clean Up
&lt;/h2&gt;

&lt;p&gt;Right now I run the application via &lt;code&gt;node index.js&lt;/code&gt; which is inconvenient when you are using it like a npm package running under node. So, the first step was to ensure it can run with &lt;code&gt;explainer --args&lt;/code&gt;. So I had to make some &lt;a href="https://github.com/aamfahim/explainer.js/pull/33" rel="noopener noreferrer"&gt;adjustments&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Research
&lt;/h2&gt;

&lt;p&gt;Next step was to do do some research on how I can upload my project on npm. First resource I came across was how I can &lt;a href="https://docs.npmjs.com/creating-and-publishing-unscoped-public-packages" rel="noopener noreferrer"&gt;unscoped public packages&lt;/a&gt;. Looking through the steps everything seemed to be done. Then I noticed the section about &lt;code&gt;.npmignore&lt;/code&gt; to exclude files that I don't want to publish to npm. And finally I'm supposed to run &lt;code&gt;npm publish&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;So I did some research on &lt;code&gt;.npmignore&lt;/code&gt;. And I found this part in the docs on &lt;a href="https://docs.npmjs.com/cli/v10/using-npm/developers#keeping-files-out-of-your-package" rel="noopener noreferrer"&gt;what files I should exclude&lt;/a&gt;. So I made my &lt;code&gt;.npmignore&lt;/code&gt;. I also took the opportunity to update my README.md to reflect how I'm supposed to install the package and updated the usage of my tool as well. Next I ran&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm publish
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But I got an error saying I should run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm adduser
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Normally that would open the browser to login from the browser. Since I'm using WSL I had to find a way to login via ternimal. So, I found this Stackoverflow &lt;a href="https://stackoverflow.com/questions/77059908/how-do-i-log-in-using-only-the-cli" rel="noopener noreferrer"&gt;thread&lt;/a&gt;. In short, to login via terminal run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm login &lt;span class="nt"&gt;--auth-type&lt;/span&gt; legacy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After I ran&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm publish
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And my application was published.&lt;/p&gt;

&lt;h2&gt;
  
  
  Testing
&lt;/h2&gt;

&lt;p&gt;For my testing I choose someone that is not taking the course. We hopped on a call and I gave him the &lt;a href="https://www.npmjs.com/package/explainer.js" rel="noopener noreferrer"&gt;npm link&lt;/a&gt;. First issue he faced was two different installation script. One generated by npm and what I wrote &lt;code&gt;npm i explainer.js&lt;/code&gt; vs &lt;code&gt;npm install -g explainer&lt;/code&gt;. Next, when running inside a project it works fine. But the issue was it reads the &lt;code&gt;package.json&lt;/code&gt; from the current directory. So it was reading &lt;code&gt;package.json&lt;/code&gt; from his project. Cause it was showing version of his project instead the one in my &lt;code&gt;package.json&lt;/code&gt;. And if opened just from a terminal it'd crash. So I went back to my code and realized the issue of reading package.json. So I had to make some adjustments and it was extra difficult since I cannot use &lt;code&gt;__dir&lt;/code&gt; since I'm using ESM. So I had to look up how to make it work under ESM. After the fix I updated the README.md again and pushed and released released another version. This time it went perfect and there was no issue.&lt;/p&gt;

&lt;h2&gt;
  
  
  Release 0.1.0 🎉
&lt;/h2&gt;

&lt;p&gt;And finally (drumrolls please), Explainer.js is out for everyone. Checkout it out @ &lt;a href="https://www.npmjs.com/package/explainer.js" rel="noopener noreferrer"&gt;https://www.npmjs.com/package/explainer.js&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>cli</category>
      <category>opensource</category>
      <category>git</category>
    </item>
    <item>
      <title>Making CI pipeline for Explainer.js</title>
      <dc:creator>Abdullah Al Mamun Fahim</dc:creator>
      <pubDate>Mon, 11 Nov 2024 01:13:32 +0000</pubDate>
      <link>https://dev.to/aamfahim/making-ci-pipeline-for-explainerjs-gk8</link>
      <guid>https://dev.to/aamfahim/making-ci-pipeline-for-explainerjs-gk8</guid>
      <description>&lt;p&gt;This week we I made a CI pipeline for my &lt;a href="https://github.com/aamfahim/explainer.js" rel="noopener noreferrer"&gt;Explainer.js&lt;/a&gt;. Since I have different scripts set up over the last few weeks it was fairly simple.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting up CI in Explainer.js
&lt;/h2&gt;

&lt;p&gt;First set to setting up CI pipeline is adding a YML file in the &lt;code&gt;.github/workflows&lt;/code&gt; directory. I used the default version of the node.js CI template from GitHub but with some changes. First I made a draft &lt;a href="https://github.com/aamfahim/explainer.js/pull/32" rel="noopener noreferrer"&gt;PR&lt;/a&gt; with the default options. Then I pulled the branch and made several adjustments. I changed the name, broke the build job into three separate jobs. Build to install node and then lint-and-format and finally test to run the tests. I also used &lt;code&gt;needs&lt;/code&gt; keyword to skip the next job so if the previous one fails it will skip the next one. So, if node set up fails it will not run lint-and-format and if lint-and-format fails it will not run tests. Which did happen a few times because my &lt;code&gt;index.test.js&lt;/code&gt; was not set up properly so I had to make a small fix by passing the &lt;code&gt;test-api-key&lt;/code&gt; via &lt;code&gt;argv&lt;/code&gt; for it to run. It was running fine locally because I have a &lt;code&gt;.toml&lt;/code&gt; and &lt;code&gt;.env&lt;/code&gt; set up already. Setting up lint-and-format was fairly easy since I run the script when I try to commit locally so it automatically formats my files. I made changes to the default YML file according to my needs of my project. And It works pretty good! Check &lt;a href="https://github.com/aamfahim/explainer.js/actions/runs/11769002263" rel="noopener noreferrer"&gt;it&lt;/a&gt; out.&lt;/p&gt;

&lt;h2&gt;
  
  
  Working in DocBot
&lt;/h2&gt;

&lt;p&gt;I worked on &lt;a href="https://github.com/Add00/DocBot" rel="noopener noreferrer"&gt;DocBot&lt;/a&gt;. Although the project is in JS, this project uses a different testing framework called &lt;a href="https://vitest.dev/" rel="noopener noreferrer"&gt;vitest&lt;/a&gt; which is jest compatible. One thing I immediately noticed how fast it was compared to just jest. And the terminal output is super polished. Making working on the issue a quite enjoyable. I worked to make &lt;code&gt;file.test.js&lt;/code&gt; test suite OS agnostic. I ran it in my WSL termial which ran fine but it did not run in cmd.exe. I immediately noticed now the expected path structure was different. Something I came across when I finished writing my tests in explainer.js last week. I use WSL by default but I rememebered not everyone has it so I ran it in cmd.exe and I had the same issue for the tests I wrote in &lt;code&gt;FilePathResolver.test.js&lt;/code&gt; so I had to fix it. So, it is easy to overlook running the terminal in different os when using the default setup vscode terminal. So after some trial and error I fixed it and made my &lt;a href="https://github.com/Add00/DocBot/pull/16" rel="noopener noreferrer"&gt;PR&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>opensource</category>
      <category>github</category>
      <category>cli</category>
    </item>
    <item>
      <title>Adding Jest To Explainer.js</title>
      <dc:creator>Abdullah Al Mamun Fahim</dc:creator>
      <pubDate>Fri, 08 Nov 2024 02:21:39 +0000</pubDate>
      <link>https://dev.to/aamfahim/adding-jest-to-explainerjs-50f</link>
      <guid>https://dev.to/aamfahim/adding-jest-to-explainerjs-50f</guid>
      <description>&lt;p&gt;This week we were supposed to add test to our cli tool. So far the most frustrating thing to do. &lt;/p&gt;

&lt;h2&gt;
  
  
  Why I chose Jest
&lt;/h2&gt;

&lt;p&gt;I'm a huge supporter for TDD(Test Driven Development). Almost every piece code should be tested. During my co-op more than half of the time I spent writing test for my PR. I believe that experience really helped me understand the necessity of testing. I was surprised to see how similar the testing framework in JS and Ruby are. I used &lt;a href="https://jestjs.io/" rel="noopener noreferrer"&gt;Jest&lt;/a&gt; which is very similar to &lt;a href="https://rspec.info/" rel="noopener noreferrer"&gt;RSpec&lt;/a&gt; I have used during my co-op. To mock http resquest I used &lt;a href="https://github.com/nock/nock" rel="noopener noreferrer"&gt;Nock&lt;/a&gt; kinda similar to something called &lt;a href="https://github.com/vcr/vcr" rel="noopener noreferrer"&gt;VCR&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Issues I have faced (A lot of em)
&lt;/h2&gt;

&lt;p&gt;Main problem I faced was I used ESM instead of CommonJS. Which made my life much harder. First issue was &lt;code&gt;jest.mock&lt;/code&gt; not working. After some research I realized &lt;a href="https://jestjs.io/docs/ecmascript-modules#module-mocking-in-esm" rel="noopener noreferrer"&gt;the way to mock is different in ESM&lt;/a&gt;. Unfortunately even after following the docs I could not get it to work. So, I had to do &lt;code&gt;jest.spyOn&lt;/code&gt;. Second issue I faced was since &lt;a href="https://github.com/sindresorhus/execa" rel="noopener noreferrer"&gt;execa&lt;/a&gt; runs in child_process the &lt;code&gt;index.test.js&lt;/code&gt; although &lt;a href="https://github.com/jestjs/jest/issues/3190" rel="noopener noreferrer"&gt;runs it does not effect the coverage report&lt;/a&gt;. So I had to use &lt;code&gt;jest.spyOn&lt;/code&gt; to rewrite the test. I also had to refactor &lt;code&gt;index.js&lt;/code&gt; so that it does not take the flags I'm passing to jest. Other smaller issue I faced was, using &lt;code&gt;node --experimental-vm-modules --no-warnings node_modules/jest/bin/jest.js -c jest.config.mjs&lt;/code&gt; instead of &lt;code&gt;jest -c jest.config.mjs&lt;/code&gt; cause I was using ESM. I also had to use &lt;a href="https://www.npmjs.com/package/mock-fs" rel="noopener noreferrer"&gt;mock-fs&lt;/a&gt; to replicate file system to test &lt;code&gt;FilepathResolver.test.js&lt;/code&gt; because simple &lt;code&gt;jest.spyOn&lt;/code&gt; did not test it thoroughly enough. I was surprised how many roadblocks were cause by just using ESM and it just reflects what a mess JS is.&lt;/p&gt;

&lt;p&gt;After a lot of trial error I got a pretty good coverage.&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%2F3c0si4taztau4twi48lc.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%2F3c0si4taztau4twi48lc.png" alt="Test Coverage" width="559" height="332"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>git</category>
      <category>opensource</category>
      <category>cli</category>
    </item>
    <item>
      <title>Hacktoberfest Recap</title>
      <dc:creator>Abdullah Al Mamun Fahim</dc:creator>
      <pubDate>Mon, 28 Oct 2024 03:42:10 +0000</pubDate>
      <link>https://dev.to/aamfahim/hacktoberfest-recap-4im1</link>
      <guid>https://dev.to/aamfahim/hacktoberfest-recap-4im1</guid>
      <description>&lt;p&gt;As Hacktoberfest comes to a close, looking back it was pretty good. I wish I could do this under better circumstances. With additional course load than normal, midterms and some personal life stuff I was under more time crunch than usual.&lt;/p&gt;

&lt;p&gt;My approach for the hacktoberfest was to try new tech that I'm not familiar with. The lead to me working in some python repos as well. If I had more time I would've tried some rust repos as well. Since in the beginning I saw some rust issues that looked simple but since I would have to learn a new language I was reluctant on taking those on. But I would say I did get to try some new things specifically in python. It was nice learning how differently projects can be set up and how complicated some of them can be depending on the project size.&lt;/p&gt;

&lt;p&gt;Since the beginning the problem was finding issues to work on. I was also kind of picky about my issues. I wanted to work on applications/tools that are actually used by people with a high fork count. I did not want to work on repos that are not maintained. Moreover, I was looking for issues specifically labelled &lt;code&gt;Hacktober&lt;/code&gt; and I must be honest that label is a bloated. Almost half of the issues are either for repos that was made two weeks ago specifically for hacktoberfest. Although in the beginning there was a lot of issues but just a week in the label became so bloated. In the future, I would just look for issues that are labelled good first issues. Something I did for my last week since I literally went to page 100 of &lt;code&gt;hacktober&lt;/code&gt; label. And there are actual repos with legitimate issues.&lt;/p&gt;

&lt;p&gt;Most surprising part was how nice some people were. Although there was some waiting to be done at times, overall everyone was very nice as my professor mentioned. Although I did get ignored for one of the issues. I made a PR and someone part of the repo just self assiged and made the same PR as me. I followed all the rules but still got ghosted. That was a bit discouraging. But overall everyone was super nice and it was fun actually contributing to real projects with a user base. 10/10 would do again.&lt;/p&gt;

</description>
      <category>hacktoberfest</category>
      <category>github</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Adding Static Analysis tools</title>
      <dc:creator>Abdullah Al Mamun Fahim</dc:creator>
      <pubDate>Sun, 27 Oct 2024 23:50:40 +0000</pubDate>
      <link>https://dev.to/aamfahim/adding-static-analysis-tools-11pb</link>
      <guid>https://dev.to/aamfahim/adding-static-analysis-tools-11pb</guid>
      <description>&lt;p&gt;For this weeks lab, we are supposed to add Static Analysis tooling. So we are supposed to add source code formatter, linter, IDE integration, Pre-Commit hook and CONTRIBUTING.md.&lt;/p&gt;

&lt;p&gt;For my source code formatter, I choose &lt;a href="https://prettier.io/" rel="noopener noreferrer"&gt;Pretter&lt;/a&gt;. It is very popular and I have seen it other projects but I never had to set it up from scratch so I wanted to do that. First thing I did was go to thier &lt;a href="https://prettier.io/docs/en/" rel="noopener noreferrer"&gt;docs&lt;/a&gt; and followed their &lt;a href="https://prettier.io/docs/en/install" rel="noopener noreferrer"&gt;install&lt;/a&gt; instructions. I also updated the &lt;code&gt;.prettierignore&lt;/code&gt; so that I could exclude the files and directories I don't want to be formatted. Then I ran&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;prettier &lt;span class="nt"&gt;--write&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;from the install docs. It worked so I added a npm script &lt;code&gt;"prettier": "prettier --write ."&lt;/code&gt; so that I can run it easily in the command line. I reverted all the changes since a lot of the changes are not something I wanted in my project. So I went to &lt;a href="https://prettier.io/docs/en/options" rel="noopener noreferrer"&gt;options&lt;/a&gt; section to define my own format. Then I ran and committed the changes. Most of the changes were from enforcing single quotes and changing EOL from &lt;code&gt;CRLF&lt;/code&gt; to &lt;code&gt;LF&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;For my linter I chose &lt;a href="https://eslint.org/" rel="noopener noreferrer"&gt;ESLint&lt;/a&gt;. Similar to Prettier I have never set it up. The docs for ESLint was kinda hard to follow. But similar to prettier I went to the &lt;a href="https://eslint.org/docs/latest/" rel="noopener noreferrer"&gt;docs&lt;/a&gt; then to the &lt;a href="https://eslint.org/docs/latest/use/getting-started" rel="noopener noreferrer"&gt;get started&lt;/a&gt;. Followed and ran the scripts to install it by running &lt;code&gt;npm init @eslint/config@latest&lt;/code&gt;. After I ran&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx eslint &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and it worked. There was no errors thankfully. I also added &lt;a href="https://eslint.org/docs/latest/use/configure/ignore" rel="noopener noreferrer"&gt;ignores&lt;/a&gt; object so that it doesn't run on node_modules and examples directory. And finally I added npm script so that I can run it easily in the command line.&lt;/p&gt;

&lt;p&gt;For my pre-commit hook I choose &lt;a href="https://typicode.github.io/husky/get-started.html" rel="noopener noreferrer"&gt;husky&lt;/a&gt;. It was fairly simple. Since I had pre-defined scripts on my package.json it was just adding a single line &lt;code&gt;npm run clean&lt;/code&gt;. I noticed it was running the lint and prettier on the entire code base on the entire codebase which didnt look okay. So I did some research and found &lt;a href="https://github.com/lint-staged/lint-staged" rel="noopener noreferrer"&gt;lint-staged&lt;/a&gt; followed their instructions on installing it and then followed &lt;a href="https://github.com/lint-staged/lint-staged?tab=readme-ov-file#packagejson-example" rel="noopener noreferrer"&gt;https://github.com/lint-staged/lint-staged?tab=readme-ov-file#packagejson-example&lt;/a&gt; to add my custom defined npm script and it was that simple.&lt;/p&gt;

&lt;p&gt;My IDE of choice was &lt;a href="https://code.visualstudio.com/" rel="noopener noreferrer"&gt;VS Code&lt;/a&gt;. It uses extensions which I already had so I used the &lt;a href="https://code.visualstudio.com/docs/getstarted/settings" rel="noopener noreferrer"&gt;workspace docs&lt;/a&gt; to define my own.&lt;/p&gt;

&lt;p&gt;I believe this is something that should be set up at the very beginning of the repo's life so that all the code-base is the same from the beginning and reduces chance of braking something with future implementation.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Hacktoberfest week 4</title>
      <dc:creator>Abdullah Al Mamun Fahim</dc:creator>
      <pubDate>Sun, 27 Oct 2024 19:25:21 +0000</pubDate>
      <link>https://dev.to/aamfahim/hacktoberfest-week-4-5172</link>
      <guid>https://dev.to/aamfahim/hacktoberfest-week-4-5172</guid>
      <description>&lt;p&gt;As the week progress is becoming more and more difficult to find legitimate issues with &lt;code&gt;Hacktoberfest&lt;/code&gt; labels. This week in my search I went to page number 100 and couldn't go any further. Maybe I'm just picky about my issues or there's acutally no good issues left with the label. So in my search, I searched with the label good first issue.&lt;/p&gt;

&lt;p&gt;This time the search was a lot less work and I found two legitimate repos.&lt;/p&gt;

&lt;p&gt;For the first repo, it was &lt;a href="https://github.com/Zenoo/labrute" rel="noopener noreferrer"&gt;labrute&lt;/a&gt;, an react &lt;a href="//brute.eternaltwin.org/"&gt;remake&lt;/a&gt; of online game &lt;a href="http://labrute.fr" rel="noopener noreferrer"&gt;http://labrute.fr&lt;/a&gt;. I love gaming and a huge supporter of game preservation. So I chose this one. Since the &lt;a href="https://github.com/Zenoo/labrute/issues/983" rel="noopener noreferrer"&gt;issue&lt;/a&gt; was very simple I looked for another repo. After a while I found &lt;a href="https://github.com/TabbycatDebate/tabbycat" rel="noopener noreferrer"&gt;tabbycat&lt;/a&gt;, "Debating tournament tabulation software for British Parliamentary and a variety of two-team parliamentary formats". With 831 forks it looked promising and it is actually used by people.&lt;/p&gt;

&lt;p&gt;For my first issue I started on labrute. I just had to update the &lt;code&gt;brute&lt;/code&gt; and &lt;code&gt;updatedBrute&lt;/code&gt; in &lt;code&gt;updateClanPoints&lt;/code&gt; method. After searching for the method there was a lot of method calls so I had to look for the reset method file. After finding the file and updating. I made the &lt;a href="https://github.com/Zenoo/labrute/pull/984" rel="noopener noreferrer"&gt;PR&lt;/a&gt;. This time the PR was against the main repo so it was pretty simple.&lt;/p&gt;

&lt;p&gt;For the next one I immediately found the file since in the issue the file and line number was included. Also since its a application made in Django, I had to be extra careful since I have not worked on Django in a while. In the issue I was given to options to implement the solution. Either &lt;code&gt;field_class = forms.EmailField&lt;/code&gt; or &lt;code&gt;field_kwargs = {'validators': [EmailValidator()]}&lt;/code&gt;. So I looked at the codebase and there was no use of &lt;code&gt;forms.EmailField&lt;/code&gt;. And after looking at the docs EmailValidator was the better choice. So I imported EmailField form django.core and added it to the &lt;code&gt;ReplyToEmailAddress&lt;/code&gt; class. After the update I made the &lt;a href="https://github.com/TabbycatDebate/tabbycat/issues/2514" rel="noopener noreferrer"&gt;PR&lt;/a&gt;. The only issue was I missed to add a whitespace. So I amended the last commit and force pushed. But after a while I saw a gitworkflow had failed. So I checked the &lt;a href="https://github.com/TabbycatDebate/tabbycat/actions/runs/11508826687/job/32038202569" rel="noopener noreferrer"&gt;workflow&lt;/a&gt; to see what had failed. It was a &lt;code&gt;flake8&lt;/code&gt; error where the import of EmailValidator should be in the beginning of the import statement since it is alphabetically first. So I made a new commit and pushed to origin.&lt;/p&gt;

&lt;p&gt;As of writing both of my PR has been merged. I have asked both owners if they could add &lt;code&gt;Hacktoberfest&lt;/code&gt; label to the issues.&lt;/p&gt;

</description>
      <category>hacktoberfest</category>
      <category>opensource</category>
      <category>github</category>
    </item>
    <item>
      <title>Hacktoberfest week 3</title>
      <dc:creator>Abdullah Al Mamun Fahim</dc:creator>
      <pubDate>Sun, 27 Oct 2024 19:00:13 +0000</pubDate>
      <link>https://dev.to/aamfahim/hacktoberfest-week-3-634</link>
      <guid>https://dev.to/aamfahim/hacktoberfest-week-3-634</guid>
      <description>&lt;p&gt;As previously suspected, hardest part of the hacktoberfest has been to find issues to work on. My first place to look was the issues labeled &lt;code&gt;Hacktoberfest&lt;/code&gt;. It's even more difficult to find issues that are actually part of legitimate repo. As in its not just made for hacktoberfest, not just a random project but something that is used and actually maintained.&lt;/p&gt;

&lt;p&gt;After a lot of searching I found this &lt;a href="https://github.com/erxes/erxes/issues/5701" rel="noopener noreferrer"&gt;issue&lt;/a&gt;. The issue is part of &lt;a href="https://github.com/erxes/erxes" rel="noopener noreferrer"&gt;erxes&lt;/a&gt;, "an alternative to the combined functionalities of Hubspot (CRM &amp;amp; Marketing automation) and Qualtrics (Experience management)" according to the repo. With 1.1k forks the repo looked very promising.&lt;/p&gt;

&lt;p&gt;So after leaving a message expressing my interest in the issue, I forked the repo and went to work. The issue is mainly to replace &lt;code&gt;sendContactsMessage&lt;/code&gt; method with &lt;code&gt;sendCoreMessage&lt;/code&gt; in all plugins. Because, the implementation is identical since they both send message to the &lt;code&gt;core&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Firstly, I wanted to see how many instances of &lt;code&gt;sendContactsMessage&lt;/code&gt; was in the code base and it was 347. My approach was two step. Find the definition and then the usage. So I filtered the files on vscode by files that have &lt;code&gt;messageBroker.ts&lt;/code&gt; as its name and there was only 31 results. There I noticed some files had both &lt;code&gt;sendContactsMessage&lt;/code&gt;, &lt;code&gt;sendCoreMessage&lt;/code&gt; and some had only &lt;code&gt;sendContactsMessage&lt;/code&gt;. So I had to remove the definition or update the method name in each file (since the definition is identical).&lt;/p&gt;

&lt;p&gt;After that my next step was to find all the usage of the method &lt;code&gt;sendContactsMessage&lt;/code&gt;. It was a lot but with find and replace I was able to replace all the method reference. Only issue was the import statements where now if both &lt;code&gt;sendContactsMessage&lt;/code&gt; and &lt;code&gt;sendCoreMessage&lt;/code&gt; was imported now there was two &lt;code&gt;sendCoreMessage&lt;/code&gt;. So I had to go in each file and manually remove them. This took a while. After I was done, I wanted to do be sure there was no reference of &lt;code&gt;sendContactsMessage&lt;/code&gt; in the codebase. But I found the definition in one file that was not updated, since the file was not &lt;code&gt;messageBroker.ts&lt;/code&gt; but the definition was in a file that was in &lt;code&gt;messageBroker&lt;/code&gt; directory. After the update all the &lt;code&gt;sendContactsMessage&lt;/code&gt; was removed. Then I manually checked all &lt;code&gt;sendCoreMessage&lt;/code&gt; reference just to be sure I didn't miss any import or duplication.&lt;/p&gt;

&lt;p&gt;Once I was done, next step was to make a &lt;a href="https://github.com/erxes/erxes/pull/5706" rel="noopener noreferrer"&gt;PR&lt;/a&gt;. When I was reading the contribution guidelines (something I should've read before I started), I noticed I was supposed to make a branch off of the dev branch instead of master. Locally, I had to set upstream. Make a new branch from that upstream dev branch. Then I did git cherry pick to select the two commits I made from my old branch to the new one (based on upstream dev). Thankfully there was no conflicts. Then I made the &lt;a href="https://github.com/erxes/erxes/pull/5706" rel="noopener noreferrer"&gt;PR&lt;/a&gt; with no conflicts with the dev branch. As of writing this, I have not heard back from the owner and someone else from the company has self assigned the issue and made the same PR as me. Hopefully they accept my PR.&lt;/p&gt;

</description>
      <category>hacktoberfest</category>
      <category>github</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
