Skip to content

Instantly share code, notes, and snippets.

@jackinf
Created July 2, 2019 13:52
Show Gist options
  • Save jackinf/398a2aa64ae097895e19b09c9348f36e to your computer and use it in GitHub Desktop.
Save jackinf/398a2aa64ae097895e19b09c9348f36e to your computer and use it in GitHub Desktop.
Useful bash scripts

Useful bash scripts

Removes unused dependencies

#!/bin/bash

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