mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-08-22 02:29:55 +00:00
Always write hash on build. https://github.com/Koenkk/zigbee2mqtt/issues/8145
This commit is contained in:
@@ -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
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user