forked from cyruzzo/AboveVTT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lock.js
executable file
·34 lines (28 loc) · 842 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
31
32
33
34
#! /usr/bin/env node
// 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",
'jquery-ui.min.js',
'jquery-3.6.0.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('sha256');
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);
}
});