<?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: ArdentCode</title>
    <description>The latest articles on DEV Community by ArdentCode (@ardentcode).</description>
    <link>https://dev.to/ardentcode</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%2Forganization%2Fprofile_image%2F1494%2F6f13dab5-3cbb-43f5-ae45-816faa386d6b.jpg</url>
      <title>DEV Community: ArdentCode</title>
      <link>https://dev.to/ardentcode</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ardentcode"/>
    <language>en</language>
    <item>
      <title>Stop adding npm dependencies (thoughtlessly) !  </title>
      <dc:creator>majo44</dc:creator>
      <pubDate>Thu, 07 Nov 2019 12:43:52 +0000</pubDate>
      <link>https://dev.to/ardentcode/stop-adding-npm-dependencies-thoughtlessly-19bi</link>
      <guid>https://dev.to/ardentcode/stop-adding-npm-dependencies-thoughtlessly-19bi</guid>
      <description>&lt;p&gt;Have you ever checked what happens when you run npm install xyz --save ?  Or looked at the real &lt;em&gt;weight&lt;/em&gt; of used packages? Or maybe examined the dependencies of your dependencies?&lt;/p&gt;

&lt;p&gt;Let's assume that we have a few packages which deliver the same or similar value. There are many factors which we can consider when we have to make a choice &lt;br&gt;
between them.  Personally, for long time I used some kind of popularity contest, what my team is using, downloads count on npmjs.com, stars on Github... &lt;br&gt;
I also used different factors like the quality of documentation, the state of the project, is it still maintained or not, etc., ect. But I've never thought about the &lt;em&gt;weight&lt;/em&gt; of the dependencies.&lt;/p&gt;

&lt;p&gt;If you look at &lt;a href="https://stackoverflow.com/questions/16389851/how-do-i-choose-a-node-module"&gt;this answer&lt;/a&gt; on stackoverflow.com or &lt;a href="https://www.quora.com/How-does-one-choose-npm-modules-to-use-for-a-project"&gt;this one&lt;/a&gt; on quora.com or check how the &lt;a href="https://npms.io/"&gt;npms.io&lt;/a&gt; is &lt;a href="https://npms.io/about"&gt;measure the quality&lt;/a&gt; of the package, you can notice that &lt;em&gt;weight&lt;/em&gt; is not mentioned there. &lt;/p&gt;

&lt;p&gt;You probably saw that image:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4XJpg2qU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/vu4h6o8blxajz1dqj48u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4XJpg2qU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/vu4h6o8blxajz1dqj48u.png" alt="Node modules heaviest objects in the universe"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Source: &lt;a href="https://devrant.com/rants/760537/heaviest-objects-in-the-universe"&gt;devrant.com/rants/760537...&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;But you probably did not saw that one:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Z1S_dG0c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/2j08x0dpfhfpwhbu0bwg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Z1S_dG0c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/2j08x0dpfhfpwhbu0bwg.png" alt="Storybook Galaxy"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Storybook galaxy&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;No, this is not Andromeda Galaxy. This is a dependencies galaxy of &lt;a href="https://github.com/storybookjs/storybook"&gt;Storybook&lt;/a&gt;. Storybook depends on more than 700 packages, which are connected by almost 1300 connections, and based on more than 10 different licenses. It is "just" 117 MB of code, but the amount of packages scares me. What's more, there are addons for the Storybook. In order to use it with React (&lt;a href="https://www.npmjs.com/package/@storybook/react"&gt;@storybook/react&lt;/a&gt;) you have to install at least 1450 packages! &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4tkmOIuT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/t34rqhwu57pmmyetsu7s.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4tkmOIuT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/t34rqhwu57pmmyetsu7s.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Recently, I have been looking for a simple cli tool for deleting files by the glob pattern. There a few options, so I compared the &lt;em&gt;weight&lt;/em&gt; of the first few:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;name&lt;/th&gt;
&lt;th&gt;dependencies tree nodes&lt;/th&gt;
&lt;th&gt;size&lt;/th&gt;
&lt;th&gt;npms.io score&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;rimraf&lt;/td&gt;
&lt;td&gt;12&lt;/td&gt;
&lt;td&gt;170 kB&lt;/td&gt;
&lt;td&gt;82&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;trash-cli&lt;/td&gt;
&lt;td&gt;179&lt;/td&gt;
&lt;td&gt;2.3 MB&lt;/td&gt;
&lt;td&gt;71&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;del-cli&lt;/td&gt;
&lt;td&gt;94&lt;/td&gt;
&lt;td&gt;2.1 MB&lt;/td&gt;
&lt;td&gt;72&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Hello, I just want to delete some files, I do not need the &lt;a href="https://en.wikipedia.org/wiki/Spaceballs"&gt;Spaceball One&lt;/a&gt;, for this task.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--aiB9yQFl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/tctd4b1hgwmg8rqf92ji.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--aiB9yQFl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/tctd4b1hgwmg8rqf92ji.jpg" alt="Spaceball One"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Spaceball One transformed into Mega Maid, in the mission &lt;a href="https://www.youtube.com/watch?v=O7aeWQCF1jM"&gt;"Vacu-Suck"&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I know there are tools that try to solve the problem like &lt;a href="https://yarnpkg.com/lang/en/"&gt;yarn&lt;/a&gt;, but it would be better to do not create that problem at all. Let's consider that we have to pay for the time and disk space for every environment where our package is used, CI, my next desk colleague, a developer from another place in the world. Do not use the Spaceball One if you do not need it, do not create the Spaceball One if it is not your goal. Remember, every time you add a dependency, anyone who uses your code adds it as well. &lt;/p&gt;

&lt;p&gt;There are some useful tools which we can use to evaluate &lt;em&gt;weight&lt;/em&gt; of packages. For some time I have been using:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://npm.anvaka.com/"&gt;npm.anvaka.com&lt;/a&gt; - Visualization of npm dependencies&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://npm.broofa.com/"&gt;NPMGraph&lt;/a&gt; - Visualize NPM Module Dependencies&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://bundlephobia.com/"&gt;bundlephobia&lt;/a&gt; - Cost of adding a npm package to your bundle&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://npms.io/"&gt;npms.io&lt;/a&gt; - A better and open source search for node packages&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Do you know any other tools? Do you have any advice on how to prevent the project from becoming a GIANT?&lt;/p&gt;

&lt;p&gt;P.S. I know that rimraf, trash-cli and del-cli are "different" :)&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>node</category>
    </item>
  </channel>
</rss>
