mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-01-08 19:38:51 +01:00
4ef921bdd1
* Add linux makers * missed some * remove eu-strip * blah * add description * remove v from version * add exec name * use bin * add bin to both * test flatpak * test adding dev dependencies * remove flatpak for now * add command to flatten directory structure * update package info * save rpm info * save work * add bin to packagerConfig * save work * okay let's see what happens * iterate array * test more * remove large * test * test * remove linux arm * test addl targets * add quiet to zip * revert dir flatten * remove pacman * add s3 bucket to electron-builder config * make dir * only copy artifacts * don't merge * zip recurse * blah * replace with electronupdater * make generic * fix * fix stuff * Update build-helper.yml * test fix * fix path * remove tree * messed up comment * remove touch * add platform name to artifact * remove license * remove forge * cleanup builder config * switch artifact name order * Remove darwin restriction on autoupdate * try adding back pacman * fix license * remove pacman again * rewrite scripts * add binary paths to builder * clean up * Update scripts * update interval and readme * remove flatpak and snap dependencies for now * upload with a wildcard * fix paths for addl binaries * add back blockmap * update release path * add newline * remove forge config * 2 small fixes - remove double cd for waveshell building, and remove GOARCH for wavesrv binary in dev mode
47 lines
1.5 KiB
JavaScript
47 lines
1.5 KiB
JavaScript
// Usage: node generate-hash.js <path-to-installer>
|
|
// Example: node generate-hash.js ./make/Wave-0.0.1.dmg
|
|
// This script will generate a hash of the installer file, as defined by electron-builder.
|
|
// Courtesy of https://github.com/electron-userland/electron-builder/issues/3913#issuecomment-504698845
|
|
|
|
const path = require("path");
|
|
const fs = require("fs");
|
|
const crypto = require("crypto");
|
|
|
|
/**
|
|
* Generate a hash of a file, as defined by electron-builder
|
|
* @param {string} file - Path to the file
|
|
* @param {string} algorithm - Hash algorithm to use
|
|
* @param {string} encoding - Encoding to use
|
|
* @returns {Promise<string>} - The hash of the file
|
|
*/
|
|
async function hashFile(file, algorithm = "sha512", encoding = "base64") {
|
|
return new Promise((resolve, reject) => {
|
|
const hash = crypto.createHash(algorithm);
|
|
hash.on("error", reject).setEncoding(encoding);
|
|
fs.createReadStream(file, {
|
|
highWaterMark: 1024 * 1024,
|
|
/* better to use more memory but hash faster */
|
|
})
|
|
.on("error", reject)
|
|
.on("end", () => {
|
|
hash.end();
|
|
resolve(hash.read());
|
|
})
|
|
.pipe(hash, {
|
|
end: false,
|
|
});
|
|
});
|
|
}
|
|
|
|
if (require.main === module) {
|
|
const installerPath = path.resolve(process.cwd(), process.argv[2]);
|
|
(async () => {
|
|
const hash = await hashFile(installerPath);
|
|
console.log(`hash of ${installerPath}: ${hash}`);
|
|
})();
|
|
}
|
|
|
|
module.exports = {
|
|
hashFile,
|
|
};
|