<?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>Forem: Kate</title>
    <description>The latest articles on Forem by Kate (@katepapineni).</description>
    <link>https://forem.com/katepapineni</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%2F428787%2F3f317b1e-b28f-411c-8580-72c6e7277385.png</url>
      <title>Forem: Kate</title>
      <link>https://forem.com/katepapineni</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/katepapineni"/>
    <language>en</language>
    <item>
      <title>How to check for missing, unused, or out-of-date JavaScript dependencies</title>
      <dc:creator>Kate</dc:creator>
      <pubDate>Mon, 07 Sep 2020 00:29:43 +0000</pubDate>
      <link>https://forem.com/katepapineni/how-to-check-for-missing-unused-or-out-of-date-javascript-dependencies-34i5</link>
      <guid>https://forem.com/katepapineni/how-to-check-for-missing-unused-or-out-of-date-javascript-dependencies-34i5</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Managing dependencies is very important to developing and maintaining a JavaScript application. Here are three quick tips to help with checking for missing, unused, or out-of-date dependencies!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Want to check a project for dependencies missing from the package.json?
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Use &lt;a href="https://www.npmjs.com/package/depcheck" rel="noopener noreferrer"&gt;depcheck&lt;/a&gt;!
&lt;/h3&gt;

&lt;p&gt;Install the &lt;code&gt;Depcheck&lt;/code&gt; tool to analyze JavaScript projects for dependencies missing from the &lt;code&gt;package.json&lt;/code&gt;.&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%2Fi%2Fusa3yux0yhw4f885s9du.jpeg" 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%2Fi%2Fusa3yux0yhw4f885s9du.jpeg" alt="console output"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Any &lt;code&gt;npm&lt;/code&gt; packages that are missing from the &lt;code&gt;package.json&lt;/code&gt; file and the associated JavaScript file path where the package is used are listed. The packages can then be installed using the &lt;a href="https://docs.npmjs.com/cli/install.html" rel="noopener noreferrer"&gt;npm-install&lt;/a&gt; command.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Want to check a project for unused dependencies?
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Use &lt;a href="https://www.npmjs.com/package/depcheck" rel="noopener noreferrer"&gt;depcheck&lt;/a&gt;!
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;Depcheck&lt;/code&gt; also analyzes JavaScript projects for unused dependencies. &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%2Fi%2Fclk168o761zwc80uy0c3.jpeg" 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%2Fi%2Fclk168o761zwc80uy0c3.jpeg" alt="console output"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The unused &lt;code&gt;npm&lt;/code&gt; packages are listed and it is safe to remove these from the project by running the &lt;a href="https://docs.npmjs.com/cli/uninstall.html" rel="noopener noreferrer"&gt;npm-uninstall&lt;/a&gt; command. &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Want check a project for out-of-date dependencies?
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Use &lt;a href="https://docs.npmjs.com/cli-commands/outdated.html" rel="noopener noreferrer"&gt;npm-outdated&lt;/a&gt;!
&lt;/h3&gt;

&lt;p&gt;This command will check the registry and compare with the versions specified in the &lt;code&gt;package.json&lt;/code&gt; file. Simply run the command &lt;code&gt;npm outdated&lt;/code&gt; in the same directory as the project &lt;code&gt;package.json&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;Given this &lt;code&gt;package.json&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;{
  "@material-ui/core": "^4.10.0",
  "@okta/okta-react": "1.1.4",
  "@testing-library/jest-dom": "^4.2.4",
  "@testing-library/react": "^9.3.2",
  "@testing-library/user-event": "^7.1.2",
  "axios": "^0.19.2"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here is the &lt;code&gt;npm outdated&lt;/code&gt; output:&lt;br&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%2Fi%2F5cgig3ki8lqhfphaojge.jpeg" 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%2Fi%2F5cgig3ki8lqhfphaojge.jpeg" alt="console output"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Red&lt;/code&gt; means update now -&amp;gt; A newer version is available matching the specified &lt;code&gt;package.json&lt;/code&gt; version so this should be updated now.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Yellow&lt;/code&gt; means use caution -&amp;gt; A newer version is available above the specified &lt;code&gt;package.json&lt;/code&gt; version. Make sure to test your application with the higher package version to ensure there are no breaking changes introduced when updating.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use the &lt;a href="https://docs.npmjs.com/cli-commands/update.html" rel="noopener noreferrer"&gt;npm-update&lt;/a&gt; command to update the dependencies accordingly.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;span&gt;Cover image by &lt;a href="https://unsplash.com/@wordsmithmedia?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Allie&lt;/a&gt; on &lt;a href="https://unsplash.com/s/photos/coffee-computer?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Unsplash&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;

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