Skip to content

Instantly share code, notes, and snippets.

@a1300
Last active December 22, 2019 18:06
Show Gist options
  • Save a1300/4c4fdb2074c6ee47ed09a1222ded4b24 to your computer and use it in GitHub Desktop.
Save a1300/4c4fdb2074c6ee47ed09a1222ded4b24 to your computer and use it in GitHub Desktop.
get hash of all package-lock.json files in a lerna monrepo | find

Search for all package-lock.json files in the current directory. Don't search in node_modules.

find -name "package-lock.json" -not -path "**/node_modules/*"

Create a md5 hash of all package-lock.json files.

find -type f -name "package-lock.json" -exec md5sum "{}" + > checklist.chk

Together

find -type f -name "package-lock.json" -not -path "**/node_modules/*" -exec md5sum "{}" + > checklist.chk

Together + sum up

find -type f -name "package-lock.json" -not -path "**/node_modules/*" -exec md5sum "{}" + | md5sum | awk '{print $1}'

Package.json and Package-lock.json sorted

find -type f \( -name "package-lock.json" -o -name "package.json" \) -not -path "**/node_modules/*" -exec md5sum "{}" + | sort -k2,2 | md5sum | awk '{print $1}'

Package.json and Package-lock.json sort | without node_modules and without dist

find -type f \( -name "package-lock.json" -o -name "package.json" \)  -not -path "**/node_modules/*" -not -path "**/dist/*" -exec md5sum "{}" + | sort -k2,2 | md5sum | awk '{print $1}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment