mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-23 17:52:49 +00:00
The ESM main-module guard compared import.meta.url with "file://" + process.argv[1],
which never matches on Windows (file://D:\a\... vs file:///D:/a/...). On the Windows
desktop release job, scripts/github-release.mjs therefore printed nothing and
gh release upload received an empty release lookup ("release not found"), leaving
v0.8.0-beta.1 without a Windows build. Compare resolved paths instead, shared by
every release script that runs as a CLI.
30 lines
1.1 KiB
JavaScript
30 lines
1.1 KiB
JavaScript
import fs from "node:fs";
|
|
import { dump, load } from "js-yaml";
|
|
import { isMainModule } from "./is-main-module.mjs";
|
|
|
|
// electron-updater compares this with os.release(), which reports the Darwin
|
|
// kernel version. Darwin 22 is macOS 13 Ventura.
|
|
export const MACOS_MINIMUM_DARWIN_VERSION = "22.0.0";
|
|
|
|
export function mergeMacManifest(arm64Path, x64Path, outputPath) {
|
|
const arm64 = load(fs.readFileSync(arm64Path, "utf8"));
|
|
const x64 = load(fs.readFileSync(x64Path, "utf8"));
|
|
const files = [...(arm64.files ?? []), ...(x64.files ?? [])].filter(
|
|
(file, index, all) => all.findIndex((entry) => entry.url === file.url) === index,
|
|
);
|
|
const output = dump(
|
|
{ ...arm64, files, minimumSystemVersion: MACOS_MINIMUM_DARWIN_VERSION },
|
|
{ lineWidth: -1, noRefs: true },
|
|
);
|
|
fs.writeFileSync(outputPath, output);
|
|
return output;
|
|
}
|
|
|
|
if (isMainModule(import.meta.url)) {
|
|
const [, , arm64Path, x64Path, outputPath] = process.argv;
|
|
if (!arm64Path || !x64Path || !outputPath) {
|
|
throw new Error("Usage: node scripts/merge-mac-manifest.mjs <arm64.yml> <x64.yml> <out.yml>");
|
|
}
|
|
process.stdout.write(mergeMacManifest(arm64Path, x64Path, outputPath));
|
|
}
|