Skip to content

Instantly share code, notes, and snippets.

@guilhermejcgois
Created December 17, 2018 13:07
Show Gist options
  • Save guilhermejcgois/29245fe657891faa27f48b6be41c82cb to your computer and use it in GitHub Desktop.
Save guilhermejcgois/29245fe657891faa27f48b6be41c82cb to your computer and use it in GitHub Desktop.
Get MD5 hash from dependencies and devDependencies from a package.json
const crypto = require('crypto');
const pjson = require('../package.json');
const depsStr = JSON.stringify(pjson.dependencies);
const devDepsStr = JSON.stringify(pjson.devDependencies);
const allDepsStr = depsStr + devDepsStr;
console.log(crypto.createHash('md5').update(allDepsStr).digest("hex"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment