Last active
June 15, 2017 23:12
-
-
Save geek/074251de4c9ba15307dbaa7d5d72ef4d to your computer and use it in GitHub Desktop.
Compare registry entry for module vs website
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Example usage | |
# cat modules | while LINE='$\n' read -r LINE; do ./valid.sh $LINE; done; | |
MODULE=$1 | |
if [ -z "$MODULE" ]; then | |
MODULE=$(tee); | |
fi | |
SITE=$(curl -s https://www.npmjs.com/package/${MODULE} | pup 'body > div.container.content > div.sidebar > ul:nth-child(3) > li:nth-child(2) > strong text{}') | |
REGISTRY=$(npm info ${MODULE} -j | json version) | |
if [ "$SITE" != "$REGISTRY" ]; then | |
echo "version mismatch for module: ${MODULE}"; | |
exit 1; | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Requires
npm install -g json
andbrew install https://raw.githubusercontent.com/EricChiang/pup/master/pup.rb