This commit is contained in:
Koen Kanters
2021-07-27 19:47:39 +02:00
parent 26ade49513
commit bf29fa8164
2 changed files with 13 additions and 7 deletions
+12 -6
View File
@@ -32,6 +32,11 @@ async function currentHash() {
});
}
async function writeHash() {
const hash = await currentHash();
fs.writeFileSync(hashFile, hash);
}
async function build(reason) {
return new Promise((resolve, reject) => {
process.stdout.write(`Building Zigbee2MQTT... (${reason})`);
@@ -42,8 +47,6 @@ async function build(reason) {
reject(err);
} else {
process.stdout.write(', finished\n');
const hash = await currentHash();
fs.writeFileSync(hashFile, hash);
resolve();
}
});
@@ -102,7 +105,10 @@ async function handleQuit() {
}
}
process.on('SIGINT', handleQuit);
process.on('SIGTERM', handleQuit);
start();
if (process.argv.length === 3 && process.argv[2] === 'writehash') {
writeHash();
} else {
process.on('SIGINT', handleQuit);
process.on('SIGTERM', handleQuit);
start();
}
+1 -1
View File
@@ -20,7 +20,7 @@
"cc2531"
],
"scripts": {
"build": "node_modules/.bin/tsc",
"build": "node_modules/.bin/tsc && node index.js writehash",
"build-watch": "node_modules/.bin/tsc --watch",
"eslint": "node_modules/.bin/eslint lib/ --max-warnings=0",
"start": "node index.js",