21 lines
735 B
JavaScript
21 lines
735 B
JavaScript
import { createHash } from "node:crypto";
|
|
import { readFile, writeFile } from "node:fs/promises";
|
|
import path from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
const manifest = JSON.parse(
|
|
await readFile(path.join(root, "package.json"), "utf8"),
|
|
);
|
|
for (const kind of ["Setup", "Portable"]) {
|
|
const name = `ForgeFlow-${kind}-${manifest.version}-win-x64.exe`;
|
|
const binary = await readFile(path.join(root, "dist", name));
|
|
const sha256 = createHash("sha256").update(binary).digest("hex");
|
|
await writeFile(
|
|
path.join(root, "dist", `${name}.sha256`),
|
|
`${sha256} ${name}\n`,
|
|
"utf8",
|
|
);
|
|
console.log(`${name}: ${sha256}`);
|
|
}
|