djLint/docs/src/lib/generate-content-hash.js
Christopher Pickering 4c0caccdf6
feat(npm): updated npm installer
Updated release so npm package will be deployed.

closes #192
2022-07-06 11:24:45 -05:00

13 lines
358 B
JavaScript

const fs = require('fs');
const glob = require('fast-glob');
const md5 = require('md5');
function generateContentHash(dir) {
const sourceFiles = glob.sync([`${dir}`]);
const sourceContent = sourceFiles
.map((sourceFile) => fs.readFileSync(sourceFile))
.join('');
return md5(sourceContent).slice(0, 8);
}
module.exports = generateContentHash;