Skip to content

Instantly share code, notes, and snippets.

@doshyt
Last active November 9, 2021 19:03
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 doshyt/81fe7b9004de53726e067e8d79f88468 to your computer and use it in GitHub Desktop.
Save doshyt/81fe7b9004de53726e067e8d79f88468 to your computer and use it in GitHub Desktop.
One-liner to find all versions of a given package in node_modules of multiple repos. Add the list of folders to scan as TARGETS and the name of a culprit package - i.e. "rc".
CULPRIT="rc"; TARGETS=( "awesome-repo-1" "awesome-repo-2" ); for element in "${TARGETS[@]}"; do echo "Checking $element"; find $element/node_modules -path "*/$CULPRIT/**" -prune -name "package.json" -exec cat {} + | grep -e \"version\": -e _location ; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment