Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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