<?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: Kuldeep Singh</title>
    <description>The latest articles on DEV Community by Kuldeep Singh (@kuldeepdev407).</description>
    <link>https://dev.to/kuldeepdev407</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%2F1332808%2Fce5922e9-9100-4d44-8bf7-4b05c04de813.png</url>
      <title>DEV Community: Kuldeep Singh</title>
      <link>https://dev.to/kuldeepdev407</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kuldeepdev407"/>
    <language>en</language>
    <item>
      <title>Invisible Character Bugs</title>
      <dc:creator>Kuldeep Singh</dc:creator>
      <pubDate>Sat, 21 Mar 2026 15:41:15 +0000</pubDate>
      <link>https://dev.to/kuldeepdev407/invisible-character-bugs-2cek</link>
      <guid>https://dev.to/kuldeepdev407/invisible-character-bugs-2cek</guid>
      <description>&lt;p&gt;This week I ran into a surprisingly interesting bug while working on a feature that generates diffs for history changes in comments, description.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Setup
&lt;/h3&gt;

&lt;p&gt;We have a system that tracks history changes in back-end. Whenever there’s a modification, we generate a diff and send both the old and new values to the front-end. The initial content follows a simple template:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Task {id}: Working on abc\n
Data: {data}\n
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If anything changes, the diff should reflect it clearly.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Problem
&lt;/h3&gt;

&lt;p&gt;While testing, I noticed something odd.&lt;/p&gt;

&lt;p&gt;Even when no changes were made—just clicking the &lt;strong&gt;Save&lt;/strong&gt; button for first time in FE —the system still generated a diff. The front-end showed differences between the "old" and "new" values, even though the text looked identical.&lt;/p&gt;

&lt;p&gt;At first, I checked the strings using console logs. Everything appeared normal. No visible differences.&lt;/p&gt;

&lt;p&gt;After spending some time debugging, I copied the API response and inspected it more closely. That’s when I noticed the issue:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The old version used &lt;code&gt;\n&lt;/code&gt; (LF – Line Feed) - system generate initially&lt;/li&gt;
&lt;li&gt;The new version used &lt;code&gt;\r\n&lt;/code&gt; (CRLF – Carriage Return + Line Feed) - user update other things once from FE&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So even though the text looked the same, the underlying newline characters were different—causing the diff algorithm to treat them as changes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Root Cause
&lt;/h3&gt;

&lt;p&gt;The culprit turned out to be the browser.&lt;/p&gt;

&lt;p&gt;When using a &lt;code&gt;&amp;lt;textarea&amp;gt;&lt;/code&gt; in the front-end, browsers normalize line endings to &lt;code&gt;\r\n&lt;/code&gt; as part of the HTML specification. So even if the user doesn’t modify anything and simply clicks save, the value retrieved from the textarea contains &lt;code&gt;\r\n&lt;/code&gt; line endings.&lt;/p&gt;

&lt;p&gt;This behavior is expected and standardized across browsers.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Fix
&lt;/h3&gt;

&lt;p&gt;The solution was simple: normalize line endings before sending data to the API or in BE.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;\r\n&lt;/span&gt;&lt;span class="sr"&gt;/g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By converting everything to \n, we ensured consistent comparisons and eliminated false diffs.&lt;/p&gt;

&lt;h3&gt;
  
  
  Zero-Width Unicode Characters
&lt;/h3&gt;

&lt;p&gt;A while back, I encountered another tricky issue related to invisible characters.&lt;/p&gt;

&lt;p&gt;Some data in our database someone has added zero-width Unicode characters (like zero-width space or joiners). These characters are not visible when rendering text, but they still exist in the string and can affect comparisons, search, and validation logic.&lt;/p&gt;

&lt;p&gt;We eventually had to scan the entire database table to identify and clean such entries.&lt;/p&gt;

&lt;h3&gt;
  
  
  Takeaway
&lt;/h3&gt;

&lt;p&gt;This bug was a great reminder that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Invisible characters can cause very visible issues&lt;/li&gt;
&lt;li&gt;Browsers follow standards that may not always align with back-end assumptions&lt;/li&gt;
&lt;li&gt;Normalizing input data is crucial when doing string comparisons&lt;/li&gt;
&lt;li&gt;Watch-out for Unicode 😁&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Original post:- &lt;a href="https://www.kuldeepdev407.com/blog/invisible-character-bugs/" rel="noopener noreferrer"&gt;https://www.kuldeepdev407.com/blog/invisible-character-bugs/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>unicode</category>
      <category>experience</category>
      <category>bugs</category>
    </item>
    <item>
      <title>Remove all node_modules folder from PC</title>
      <dc:creator>Kuldeep Singh</dc:creator>
      <pubDate>Fri, 24 May 2024 06:14:00 +0000</pubDate>
      <link>https://dev.to/kuldeepdev407/remove-all-nodemodules-folder-from-pc-1062</link>
      <guid>https://dev.to/kuldeepdev407/remove-all-nodemodules-folder-from-pc-1062</guid>
      <description>&lt;p&gt;If you ever thing that there are a lot of project you are working and you have lot of node_modules folder you have to delete to save up space when you only have 512SSD. &lt;/p&gt;

&lt;p&gt;Here is a python script for deleting  all those &lt;code&gt;node_modules&lt;/code&gt; folder.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;argparse&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;shutil&lt;/span&gt;

&lt;span class="n"&gt;all_node_path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
&lt;span class="n"&gt;block_path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;$RECYCLE.BIN&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;System Volume Information&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;getNodeModulesPaths&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;    
    &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;scandir&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;entries&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;entry&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;entries&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;is_dir&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
                    &lt;span class="nf"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;node_modules&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
                        &lt;span class="n"&gt;all_node_path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                    &lt;span class="nf"&gt;elif&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;block_path&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
                        &lt;span class="k"&gt;continue&lt;/span&gt;
                    &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                        &lt;span class="nf"&gt;getNodeModulesPaths&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;/&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="n"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
    &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;Exception&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;An error occurred: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;remove_directory&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;directory_path&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;shutil&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;rmtree&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;directory_path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"'&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;directory_path&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt; removed successfully.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;OSError&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Error: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;directory_path&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; : &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;strerror&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="c1"&gt;# arguments
&lt;/span&gt;    &lt;span class="n"&gt;args_parser&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;argparse&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ArgumentParser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;CLI tool for removing all node_module folder for given path&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;args_parser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add_argument&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;-p&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;--path&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;required&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;help&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;full path from where you want to remove node_module &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;args&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;args_parser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse_args&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="nf"&gt;getNodeModulesPaths&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;all_node_path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;total_paths&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;all_node_path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;confirm_rm&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Are you sure you want to delete above &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="nf"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;total_paths&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt; folder(y/n):&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="nf"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;confirm_rm&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;y&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;all_node_path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="nf"&gt;remove_directory&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Removed &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="nf"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;total_paths&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt; node_modules successfully!&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;  
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;__main__&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  How to use it
&lt;/h2&gt;

&lt;p&gt;Just run &lt;code&gt;python main.py -p '&amp;lt;pathtofolder&amp;gt;'&lt;/code&gt; it is going to scan all node_modules folder in path and going to delete them. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Run it carefully also check the folders before confirming&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Here is GitHub link for repo: &lt;a href="https://github.com/kuldeepdev407/rm_node_modules" rel="noopener noreferrer"&gt;github.com/kuldeepdev407/rm_node_modules&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If i missed something in code feel free to create Issue Or PR.&lt;/p&gt;

</description>
      <category>nodemodules</category>
      <category>node</category>
      <category>javascript</category>
      <category>python</category>
    </item>
    <item>
      <title>Download file using curl</title>
      <dc:creator>Kuldeep Singh</dc:creator>
      <pubDate>Tue, 26 Mar 2024 20:23:00 +0000</pubDate>
      <link>https://dev.to/kuldeepdev407/download-file-using-curl-1ef2</link>
      <guid>https://dev.to/kuldeepdev407/download-file-using-curl-1ef2</guid>
      <description>&lt;p&gt;Sometime i need to use &lt;code&gt;curl&lt;/code&gt; to download things from web as a developer here is a quick command if you forget it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-o&lt;/span&gt; &amp;lt;outputfilename&amp;gt; &amp;lt;downloadlink&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;download &amp;amp; extract with same command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-L&lt;/span&gt; &amp;lt;downloadfileurl&amp;gt; | &lt;span class="nb"&gt;tar &lt;/span&gt;zx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;also if it is zip file that you are downloading, You can use below &lt;code&gt;tar&lt;/code&gt; command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;tar&lt;/span&gt; &lt;span class="nt"&gt;-xf&lt;/span&gt; archive.tar
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>curl</category>
    </item>
    <item>
      <title>Resolve Installing psych 5.1.2 with native extensions Gem::Ext::BuildError</title>
      <dc:creator>Kuldeep Singh</dc:creator>
      <pubDate>Thu, 21 Mar 2024 21:14:00 +0000</pubDate>
      <link>https://dev.to/kuldeepdev407/resolve-installing-psych-512-with-native-extensions-gemextbuilderror-2bkn</link>
      <guid>https://dev.to/kuldeepdev407/resolve-installing-psych-512-with-native-extensions-gemextbuilderror-2bkn</guid>
      <description>&lt;p&gt;If your are getting below error in rails&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Installing psych 5.1.2 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /tmp/bundler20240322-47887-3hyqrfpsych-5.1.2/gems/psych-5.1.2/ext/psych
/usr/bin/ruby3.0 -I /usr/lib/ruby/vendor_ruby -r ./siteconf20240322-47887-mbz5v.rb extconf.rb
checking for yaml.h... no
yaml.h not found
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Solutions is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; libyaml-dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>rails</category>
    </item>
    <item>
      <title>Creating a NPM CLI application</title>
      <dc:creator>Kuldeep Singh</dc:creator>
      <pubDate>Sun, 26 Nov 2023 00:00:00 +0000</pubDate>
      <link>https://dev.to/kuldeepdev407/creating-a-npm-cli-application-3g2d</link>
      <guid>https://dev.to/kuldeepdev407/creating-a-npm-cli-application-3g2d</guid>
      <description>&lt;p&gt;I am writing this blog post today, following a long day, based on my writing mood. You will discover today how to build a npm CLI application. &lt;/p&gt;

&lt;p&gt;I'm thinking of developing a cli package that uses npm to make a choice for you. Making decisions is something I struggle with in my personal life. So i am going to make a CLI tool to let JavaScript make decision from me. while writing this blog post i am learning think myself. &lt;/p&gt;

&lt;p&gt;I have created my first npm CLI application, and you can check it out. Just run &lt;code&gt;npx make-me-a-choice&lt;/code&gt;  in your terminal.&lt;/p&gt;

&lt;h2&gt;
  
  
  Requirement
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Must know what is &lt;strong&gt;NPM&lt;/strong&gt; and how to use it &lt;strong&gt;little bit&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;You need to have basic &lt;strong&gt;knowledge of JavaScript &amp;amp; Node.js&lt;/strong&gt;. &lt;/li&gt;
&lt;li&gt;Have a working computer that is able to run &lt;strong&gt;Node.js.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;internet connection is must.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Creating project
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Create a empty folder and give it the name according to project for me it is to &lt;code&gt;make-me-a-choice&lt;/code&gt;. &lt;/li&gt;
&lt;li&gt;Now open project folder in terminal  &amp;amp; run &lt;code&gt;npm init&lt;/code&gt; fill all the details. &lt;/li&gt;
&lt;li&gt;Edit your &lt;code&gt;package.json&lt;/code&gt; file add &lt;code&gt;"bin"&lt;/code&gt; option  like below.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="err"&gt;...&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="nl"&gt;"bin"&lt;/span&gt;&lt;span class="p"&gt;:{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"&amp;lt;yourcommandname&amp;gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"bin/index.js"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;use&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;own&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;command&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;instead&lt;/span&gt;&lt;span class="w"&gt; 
&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="err"&gt;...&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Create a file in &lt;code&gt;bin\index.js&lt;/code&gt; it is going to be your &amp;amp; put below code in it or modify it according to your need.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="cp"&gt;#! /usr/bin/env node
&lt;/span&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hellow from my NPM Package&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it now just run &lt;code&gt;npm i&lt;/code&gt; &amp;amp; &lt;code&gt;npx &amp;lt;yourcommandname&amp;gt;&lt;/code&gt; for my case i have create a project. &lt;code&gt;make-me-a-choice&lt;/code&gt;. So i have &lt;code&gt;make-me-a-choice&lt;/code&gt; as &lt;code&gt;&amp;lt;yourcommandname&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;You have successful create a package add to you Github repo and make it public to for other to see. &lt;/p&gt;

&lt;h2&gt;
  
  
  Publishing on NPM
&lt;/h2&gt;

&lt;p&gt;Now to publish you package to npm you need to have account on npm, if not just create one email and password.  Open your project directory in terminal and run &lt;code&gt;npm adduser&lt;/code&gt; this will SignIn in to you account in npm. Then just run &lt;code&gt;npm publish&lt;/code&gt;  in terminal in you project.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Hurray You have successfully published your first package to npm🎉&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now just run &lt;code&gt;npx &amp;lt;yourcommandname&amp;gt;&lt;/code&gt; or &lt;code&gt;npx &amp;lt;yourprojectname&amp;gt; &amp;lt;yourcommandname&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If you get error because their is already a package with same as you project name. Use &lt;code&gt;npm init --scope=@my-username&lt;/code&gt;  &amp;amp; &lt;code&gt;npm publish --access public&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Checkout out my repo as example for taking some inputs and doing think in cli: &lt;a href="https://github.com/kuldeepdev407/make-me-a-choice" rel="noopener noreferrer"&gt;https://github.com/kuldeepdev407/make-me-a-choice&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;1 more think if you delete an npm package you can republish same package in after 24 hour only.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;p&gt;NPM docs:- &lt;a href="https://docs.npmjs.com/creating-node-js-modules" rel="noopener noreferrer"&gt;https://docs.npmjs.com/creating-node-js-modules&lt;/a&gt;&lt;/p&gt;

</description>
      <category>npm</category>
      <category>npmpackage</category>
    </item>
  </channel>
</rss>
