Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
// The macOS release job packs with `--dir`, which electron-builder treats as "no updater target"
// and so writes no app-update.yml (#1431). after-pack.cjs fills that gap; these pin that it writes
// the file on macOS only, never overwrites electron-builder's own, and writes what electron-updater
// reads.
import fs from "node:fs";
import { createRequire } from "node:module";
import os from "node:os";
import path from "node:path";
import { afterEach, describe, expect, it } from "vitest";
const require = createRequire(import.meta.url);
const afterPack = require("./after-pack.cjs").default;
const dirs = [];
afterEach(() => {
for (const dir of dirs.splice(0)) fs.rmSync(dir, { recursive: true, force: true });
});
function context(electronPlatformName) {
const appOutDir = fs.mkdtempSync(path.join(os.tmpdir(), "after-pack-"));
dirs.push(appOutDir);
const resources = path.join(appOutDir, "Openscreen.app/Contents/Resources");
fs.mkdirSync(resources, { recursive: true });
return {
electronPlatformName,
appOutDir,
file: path.join(resources, "app-update.yml"),
packager: {
getResourcesDir: () => resources,
config: { publish: [{ provider: "github", owner: "getopenscreen", repo: "openscreen" }] },
appInfo: { updaterCacheDirName: "openscreen-updater" },
},
};
}
describe("afterPack app-update.yml", () => {
it("writes the file into a macOS bundle", async () => {
const ctx = context("darwin");
await afterPack(ctx);
expect(fs.readFileSync(ctx.file, "utf8")).toBe(
"provider: github\nowner: getopenscreen\nrepo: openscreen\nupdaterCacheDirName: openscreen-updater\n",
);
});
it("leaves electron-builder's own file alone", async () => {
const ctx = context("darwin");
fs.writeFileSync(ctx.file, "provider: generic\n");
await afterPack(ctx);
expect(fs.readFileSync(ctx.file, "utf8")).toBe("provider: generic\n");
});
it("accepts a single publish object as well as an array", async () => {
const ctx = context("darwin");
ctx.packager.config.publish = ctx.packager.config.publish[0];
await afterPack(ctx);
expect(fs.readFileSync(ctx.file, "utf8")).toMatch(/^provider: github\n/);
});
it("prefers the first mac.publish entry over the global list", async () => {
const ctx = context("darwin");
ctx.packager.platformSpecificBuildOptions = {
publish: [
{ provider: "generic", url: "x" },
{ provider: "github", owner: "o", repo: "r" },
],
};
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);
await afterPack(ctx);
expect(fs.existsSync(ctx.file)).toBe(false);
}
});
});