Believe It or Not, People Forget What NPM Dependencies They have Installed!
Guess what?, working on a project can be a long task, specially if you want to make it as neat as possible but this will usually make you play with several ways to implement whatever functions your trying to accomplish. One of these ways is by using external libraries, the so called NPM dependencies.
These libraries are wondeful to work with and there are thousands if not millions of them already out there in the Internet free to be used by you. However, no matter how cool they are, sometimes they become obsolete in your project and unnecessary for you to keep. This is where Depcheck comes into play.
Depcheck is a tool for analyzing the dependencies in a project to see: how each dependency is used, which dependencies are useless, and which dependencies are missing from package.json– depcheck
In order to use this incredible library, you need to install it (I highly recommend to put it in the root folder of your project) first by running the following command:
npm install depcheck
Then you simply run the following command:
The above command will return something like:
kebin@KEVIN-BACKTRACK MINGW64 ~/Desktop/htdocs/kevinfonseca-next (main) $ depcheck (node:19448) [DEP0128] DeprecationWarning: Invalid 'main' field in 'C:\Users\kebin\Desktop\htdocs\kevinfonseca-next\node_modules\react-icons\package.json' of 'lib'. Please either fix that or report it to the module author (Use `node --trace-deprecation ...` to show where the warning was created) Unused dependencies * @next/font * @uiw/codemirror-extensions-basic-setup * @uiw/codemirror-extensions-classname * @uiw/codemirror-extensions-color * @uiw/codemirror-extensions-events * @uiw/codemirror-extensions-hyper-link * @uiw/codemirror-extensions-line-numbers-relative * @uiw/codemirror-extensions-mentions * @uiw/codemirror-extensions-zebra-stripes * @uiw/codemirror-themes * @uiw/codemirror-themes-all * bootstrap * depcheck * plyr
Now that you have this information, it is up to you what to do with it. You can uninstall them or you can look through all your files and figure out if it is really worth to keep them. Remember, a project is like a computer, the less crap you have the faster the loading time is.
Is worth to mention, that npm-check is an alternative that can be used, whatsoever, I felt like it was not that great based on the community support it has and the weekly downloads found on its official NPM package webpage.
Don’t forget to read my previous post, Wi-Fi Password Forgotten? Find It! where I explain how to find out your Wi-Fi password!
Bye Bye 🙂
If you want to know more about Web Development with NodeJS, take a look into this book: