Last active
April 15, 2018 09:00
-
-
Save nire0510/be972248e44d0a07b75001a2e1cb0554 to your computer and use it in GitHub Desktop.
Scans all projects in a directory and generates a global npm & bower dependencies list
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
# npm-deps-scanner | |
# Scans all projects in a directory and generates a global npm & bower dependencies list. | |
# dependencies: jq, npm, json2csv | |
# extract all dependencies: | |
find ./*/{package,bower}.json | xargs cat | jq '(.dependencies + .devDependencies) | keys[]' | sort | uniq | tr -d '"' > npm-deps-scan-pname.txt | |
# fetch each package info and write to file: | |
echo "[" > npm-deps-scan-pinfo.json | |
while read f; do | |
npm view --json $f name version license homepage description >> npm-deps-scan-pinfo.json | |
echo "," >> npm-deps-scan-pinfo.json | |
done < npm-deps-scan-pname.txt | |
echo "]" >> npm-deps-scan-pinfo.json | |
# save as CSV: | |
json2csv -i npm-deps-scan-pinfo.json -o npm-deps-scan-pinfo.csv | |
# remove files: | |
rm npm-deps-scan-pname.txt npm-deps-scan-pinfo.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment