This content originally appeared on DEV Community and was authored by Rahul Tarak
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
-
--js
Will enable checking js files -
--dev
Will enable checking dev dependencies (this is not very accurate) -
--report
Will save the report to.depp/report.md
-
--externals
Can use this to external certain packages, useful if the build fails by default -
--ignore-namespace
Can ignore namspaced internal packages using thing, good for ignore@monorepo
packages -
--show-versions
Will 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
This content originally appeared on DEV Community and was authored by Rahul Tarak
Rahul Tarak | Sciencx (2021-11-03T04:54:23+00:00) Depp – Basic Usage and Features. Retrieved from https://www.scien.cx/2021/11/03/depp-basic-usage-and-features/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.