fix(release): reset cached asar metadata between checks
This commit is contained in:
@@ -5,7 +5,7 @@ import os from "node:os";
|
|||||||
import { spawnSync } from "node:child_process";
|
import { spawnSync } from "node:child_process";
|
||||||
import { fileURLToPath } from "node:url";
|
import { fileURLToPath } from "node:url";
|
||||||
import { parse } from "yaml";
|
import { parse } from "yaml";
|
||||||
import { extractFile } from "@electron/asar";
|
import { extractFile, uncache } from "@electron/asar";
|
||||||
|
|
||||||
const EXPECTED_PUBLISH = Object.freeze({
|
const EXPECTED_PUBLISH = Object.freeze({
|
||||||
provider: "github",
|
provider: "github",
|
||||||
@@ -143,10 +143,15 @@ function hasExtraResource(extraResources, expected) {
|
|||||||
|
|
||||||
function readPackagedMainVersion(asarPath) {
|
function readPackagedMainVersion(asarPath) {
|
||||||
requireNonEmptyFile(asarPath, "packaged app.asar");
|
requireNonEmptyFile(asarPath, "packaged app.asar");
|
||||||
|
uncache(asarPath);
|
||||||
|
try {
|
||||||
const packagePayload = JSON.parse(extractFile(asarPath, "package.json").toString("utf8"));
|
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 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] || "";
|
const bundled = /name:\s*["']multi-debrid-downloader["']\s*,\s*version:\s*["']([^"']+)["']/.exec(mainBundle)?.[1] || "";
|
||||||
return { packageVersion: String(packagePayload?.version || ""), bundledVersion: bundled };
|
return { packageVersion: String(packagePayload?.version || ""), bundledVersion: bundled };
|
||||||
|
} finally {
|
||||||
|
uncache(asarPath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function sha256File(filePath) {
|
function sha256File(filePath) {
|
||||||
|
|||||||
Reference in New Issue
Block a user