chore(ci): address quality review feedback

This commit is contained in:
wiiiii123
2026-07-11 02:49:40 +07:00
parent 7082547b34
commit c97f67ec4d
3 changed files with 24 additions and 15 deletions
+5
View File
@@ -47,6 +47,11 @@ jobs:
if: ${{ !cancelled() && steps.install.outcome == 'success' }}
run: npm run lint
- name: Check formatting (advisory)
if: ${{ !cancelled() && steps.install.outcome == 'success' }}
continue-on-error: true
run: npm run format:check
- name: Test
if: ${{ !cancelled() && steps.install.outcome == 'success' }}
run: npm test
+8
View File
@@ -27,6 +27,14 @@ describe("Windows native helper path resolution", () => {
await fs.rm(tempRoot, { recursive: true, force: true });
});
it("resolves a requested platform tag independently of the host platform", async () => {
const { getNativeArchTag } = await import("./binaries");
expect(getNativeArchTag("win32")).toBe(
process.arch === "arm64" ? "win32-arm64" : "win32-x64",
);
});
it("prefers the branch-staged helper over a stale local CMake build in dev", async () => {
const buildOutputPath = path.join(
appPath,
+11 -15
View File
@@ -29,31 +29,33 @@ export function getNativeCaptureHelperSourcePath(): string {
return resolveUnpackedAppPath("electron", "native", "ScreenCaptureKitRecorder.swift");
}
export function getNativeArchTag(): string {
if (process.platform === "darwin") {
export function getNativeArchTag(platform: NodeJS.Platform = process.platform): string {
if (platform === "darwin") {
return process.arch === "arm64" ? "darwin-arm64" : "darwin-x64";
}
if (process.platform === "win32") {
if (platform === "win32") {
return process.arch === "arm64" ? "win32-arm64" : "win32-x64";
}
if (process.platform === "linux") {
if (platform === "linux") {
return process.arch === "arm64" ? "linux-arm64" : "linux-x64";
}
return `${process.platform}-${process.arch}`;
return `${platform}-${process.arch}`;
}
export function getPrebundledNativeHelperPath(binaryName: string): string {
return resolveUnpackedAppPath("electron", "native", "bin", getNativeArchTag(), binaryName);
export function getPrebundledNativeHelperPath(
binaryName: string,
archTag = getNativeArchTag(),
): string {
return resolveUnpackedAppPath("electron", "native", "bin", archTag, binaryName);
}
export function resolvePreferredWindowsNativeHelperPath(
helperDirectory: string,
binaryName: string,
): string {
const windowsArchTag = process.arch === "arm64" ? "win32-arm64" : "win32-x64";
const buildOutputPath = resolveUnpackedAppPath(
"electron",
"native",
@@ -62,13 +64,7 @@ export function resolvePreferredWindowsNativeHelperPath(
"Release",
binaryName,
);
const prebundledPath = resolveUnpackedAppPath(
"electron",
"native",
"bin",
windowsArchTag,
binaryName,
);
const prebundledPath = getPrebundledNativeHelperPath(binaryName, getNativeArchTag("win32"));
if (app.isPackaged && existsSync(prebundledPath)) {
return prebundledPath;