| 177 | } |
| 178 | |
| 179 | async function isBundleSame() { |
| 180 | const bundle = Buffer.concat([ |
| 181 | await fs.readFile(path.join(__dirname, "..", "build", "electron.js")), |
| 182 | await fs.readFile(path.join(__dirname, "..", "build", "preload.js")) |
| 183 | ]); |
| 184 | |
| 185 | const hashSum = crypto.createHash("sha256"); |
| 186 | hashSum.update(bundle); |
| 187 | const hex = hashSum.digest("hex"); |
| 188 | |
| 189 | if (!lastBundleHash) { |
| 190 | lastBundleHash = hex; |
| 191 | return false; |
| 192 | } |
| 193 | if (hex === lastBundleHash) return true; |
| 194 | lastBundleHash = hex; |
| 195 | return false; |
| 196 | } |