fix(release): reset cached asar metadata between checks

This commit is contained in:
Sucukdeluxe
2026-08-21 07:46:01 +02:00
parent fafb278153
commit 9710007430
+10 -5
View File
@@ -5,7 +5,7 @@ import os from "node:os";
import { spawnSync } from "node:child_process";
import { fileURLToPath } from "node:url";
import { parse } from "yaml";
import { extractFile } from "@electron/asar";
import { extractFile, uncache } from "@electron/asar";
const EXPECTED_PUBLISH = Object.freeze({
provider: "github",
@@ -143,10 +143,15 @@ function hasExtraResource(extraResources, expected) {
function readPackagedMainVersion(asarPath) {
requireNonEmptyFile(asarPath, "packaged app.asar");
const packagePayload = JSON.parse(extractFile(asarPath, "package.json").toString("utf8"));
const mainBundle = extractFile(asarPath, path.win32.join("build", "main", "main", "main.js")).toString("utf8");
const bundled = /name:\s*["']multi-debrid-downloader["']\s*,\s*version:\s*["']([^"']+)["']/.exec(mainBundle)?.[1] || "";
return { packageVersion: String(packagePayload?.version || ""), bundledVersion: bundled };
uncache(asarPath);
try {
const packagePayload = JSON.parse(extractFile(asarPath, "package.json").toString("utf8"));
const mainBundle = extractFile(asarPath, path.win32.join("build", "main", "main", "main.js")).toString("utf8");
const bundled = /name:\s*["']multi-debrid-downloader["']\s*,\s*version:\s*["']([^"']+)["']/.exec(mainBundle)?.[1] || "";
return { packageVersion: String(packagePayload?.version || ""), bundledVersion: bundled };
} finally {
uncache(asarPath);
}
}
function sha256File(filePath) {