Created
May 9, 2022 09:36
-
-
Save diversemix/d307c8a53ecda661be894e962e7877c0 to your computer and use it in GitHub Desktop.
Audit npm in repositories below cwd
This file contains 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 | |
file=$PWD/audit.md | |
[ -f $file ] && rm $file | |
repos=$(find . -name package.json | grep -v node_modules) | |
echo "# Repository Audit $(date)" >> $file | |
for repo in $repos | |
do | |
echo "## $repo" >> $file | |
pushd $(dirname $repo) >> /dev/null | |
[ -f package-lock.json ] || echo "Missing package-lock" >> $file | |
echo '```' >> $file | |
npm audit >> $file | |
echo '```' >> $file | |
popd >>/dev/null | |
done | |
pandoc -o audit.pdf $file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment