diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-17 09:07:48 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-17 09:07:48 +0000 |
commit | 5bd24a54ef4ce3a38a860eb53b66d062c2382971 (patch) | |
tree | 5f5e65571dfcb2c62c27600ee7655dec4b44c923 /config/helpers | |
parent | 74673d04d25ffed35cbcf17cd42969bed0a4e705 (diff) | |
download | gitlab-ce-5bd24a54ef4ce3a38a860eb53b66d062c2382971.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'config/helpers')
-rw-r--r-- | config/helpers/vendor_dll_hash.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/config/helpers/vendor_dll_hash.js b/config/helpers/vendor_dll_hash.js new file mode 100644 index 00000000000..cfd7be66ad3 --- /dev/null +++ b/config/helpers/vendor_dll_hash.js @@ -0,0 +1,23 @@ +const fs = require('fs'); +const path = require('path'); +const crypto = require('crypto'); + +const CACHE_PATHS = [ + './config/webpack.config.js', + './config/webpack.vendor.config.js', + './package.json', + './yarn.lock', +]; + +const resolvePath = file => path.resolve(__dirname, '../..', file); +const readFile = file => fs.readFileSync(file); +const fileHash = buffer => + crypto + .createHash('md5') + .update(buffer) + .digest('hex'); + +module.exports = () => { + const fileBuffers = CACHE_PATHS.map(resolvePath).map(readFile); + return fileHash(Buffer.concat(fileBuffers)).substr(0, 12); +}; |