Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

fix(mac): prefer mac.publish when writing app-update.yml

EtienneLescot18bee3f11522
diff --git a/scripts/after-pack.cjs b/scripts/after-pack.cjs
index 557f3db2f..688e2ea5f 100644
--- a/scripts/after-pack.cjs
+++ b/scripts/after-pack.cjs
@@ -27,7 +27,9 @@ exports.default = async function afterPack(context) {
const { packager } = context;
const file = path.join(packager.getResourcesDir(context.appOutDir), "app-update.yml");
if (fs.existsSync(file)) return;
- const [publish] = [packager.config.publish ?? []].flat();
+ const [publish] = [
+ packager.platformSpecificBuildOptions?.publish ?? packager.config.publish ?? [],
+ ].flat();
if (publish == null) throw new Error("afterPack: no publish config to write app-update.yml from");
fs.writeFileSync(file, appUpdateYaml(publish, packager.appInfo.updaterCacheDirName));
console.log(` • wrote ${path.relative(context.appOutDir, file)}`);
diff --git a/scripts/after-pack.test.mjs b/scripts/after-pack.test.mjs
index c3c79d87c..898de266c 100644
--- a/scripts/after-pack.test.mjs
+++ b/scripts/after-pack.test.mjs
@@ -58,6 +58,13 @@ describe("afterPack app-update.yml", () => {
expect(fs.readFileSync(ctx.file, "utf8")).toMatch(/^provider: github\n/);
});
+ it("prefers mac.publish over the global list", async () => {
+ const ctx = context("darwin");
+ ctx.packager.platformSpecificBuildOptions = { publish: { provider: "generic", url: "x" } };
+ await afterPack(ctx);
+ expect(fs.readFileSync(ctx.file, "utf8")).toMatch(/^provider: generic\nurl: x\n/);
+ });
+
it("writes nothing on Windows or Linux", async () => {
for (const platform of ["win32", "linux"]) {
const ctx = context(platform);