Skip to content

Instantly share code, notes, and snippets.

@Powell-v2
Created March 15, 2019 15:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Powell-v2/c3feffcac834d1c94a8898c9c4abdf29 to your computer and use it in GitHub Desktop.
Save Powell-v2/c3feffcac834d1c94a8898c9c4abdf29 to your computer and use it in GitHub Desktop.
Checks whether deps listed in package.json are in actual use and suggests removing those that are not used directly.
for dep in $(jq -r ".dependencies | keys | .[]" package.json); do
if ! grep "from .*$dep.*" -Rq --exclude-dir="node_modules" .; then
echo "you can probably remove $dep"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment