forked from cyruzzo/AboveVTT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlock.js
30 lines (25 loc) · 767 Bytes
/
lock.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// basic script to create a simple LOCK file of our external dependencies
const crypto = require('crypto');
const fs = require('fs');
const lockFile = 'LOCK';
const externalDependencies = [
"color-picker.js",
"jitsi_external_api.js",
"mousetrap.1.6.5.min.js",
"purify.min.js",
"rpg-dice-roller.bundle.min.js",
]
let out = "# This file was generated, to update it run `node lock.js`"
externalDependencies.forEach(file => {
const fileBuffer = fs.readFileSync(file);
const hashSum = crypto.createHash('sha1');
hashSum.update(fileBuffer);
const hex = hashSum.digest('hex');
out += `\n${hex}\t${file}`
});
fs.writeFile(lockFile, out + "\n", err => {
if (err) {
console.error(err)
process.exit(1);
}
});