Skip to content

Instantly share code, notes, and snippets.

@diversemix
Created May 9, 2022 09:36
Show Gist options
  • Save diversemix/d307c8a53ecda661be894e962e7877c0 to your computer and use it in GitHub Desktop.
Save diversemix/d307c8a53ecda661be894e962e7877c0 to your computer and use it in GitHub Desktop.
Audit npm in repositories below cwd
#!/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