Recently we ran into a couple of bugs on our main fairly large monorepo which were caused my the same package existing twice but having different versions. This made me search for some dependency checking tools, and while there are existing ones none of them really had good monorepo support.
So I decided to make one, this is a brief about how I made it and also how to use it.
If you want to just try the tool without hearing ramble about it, feel free to checkout the repo
CryogenicPlanet
/
depp
A fast unused and duplicate dependency checker
Basic Usage and Features
Install
npm install -g depp-installer
depp --help # Will should all avaliable options
Usage
Default Config
depp
Will check only typescript (.ts, .tsx) files in your root folder and all its children. It will also read the packages from then root package.json but also any package.json inside child folder (It supports mono repositories by default)
It will show unused packages, unused @type packages and duplicate packages with different versions
It will also generate a temporary html report file and open it in your browser. This file will look something like the following
https://cryogenicplanet.github.io/depp/static/htmlReport.html
Some Major Flags
-
--jsWill enable checking js files -
--devWill enable checking dev dependencies (this is not very accurate) -
--reportWill save the report to.depp/report.md -
--externalsCan use this to external certain packages, useful if the build fails by default -
--ignore-namespaceCan ignore namspaced internal packages using thing, good for ignore@monorepopackages -
--show-versionsWill explicitly print the versions of duplicate packages in console
This is not an exhaustive list of all flags, for that run depp --help
Example advance usage is
depp -e mobx -e magic-sdk -e domain -e @daybrush/utils -e yjs -e constants -e ws -v -in @editor -in @server -j -e perf_hooks --report
In the next part, I will dig a little deeper into how this tool was built and how it works under the hood
Top comments (0)