Beautiful, AI-native markdown IDE and LLM wiki
TypeScript 2nd-brainagent-skillsclaudecodexcompany-braindocsknowledge-knowledge-baseknowledge-managementllmllm-wikillm-wiki-karpathymarkdownmarkdown-editormdmdxnotespkmsecond-brainskills
Package the QA desktop lanes through package-desktop.mjs under pnpm (#5305)
Nick Gomeze4700e301a43
diff --git a/.github/scripts/package-desktop.test.mjs b/.github/scripts/package-desktop.test.mjsindex 39bdc6b30..015cf2b59 100644--- a/.github/scripts/package-desktop.test.mjs+++ b/.github/scripts/package-desktop.test.mjs@@ -1,5 +1,5 @@import { execFileSync, spawnSync } from 'node:child_process';-import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';+import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';import { tmpdir } from 'node:os';import { join } from 'node:path';import { fileURLToPath } from 'node:url';@@ -8,6 +8,19 @@ import { packagingInvocation } from './package-desktop.mjs';const script = fileURLToPath(new URL('./package-desktop.mjs', import.meta.url));+function launcherFixture(body) {+ const cwd = mkdtempSync(join(tmpdir(), 'ok-package-failure-'));+ mkdirSync(join(cwd, 'scripts'), { recursive: true });+ writeFileSync(join(cwd, 'scripts', 'run-electron-builder.mjs'), body);+ return cwd;+}++const wrapperEnv = {+ ...process.env,+ npm_config_user_agent: 'pnpm/10.33.0',+ OK_DESKTOP_VARIANT: 'beta',+};+test.each([false, true].flatMap((modern) =>['--mac', '--win', '--linux'].map((platform) => [modern, platform]),@@ -63,3 +76,54 @@ test.each(}},);++test('a launcher that fails fails the wrapper with its exit status', () => {+ const cwd = launcherFixture('process.exit(7);');+ try {+ const result = spawnSync(process.execPath, [script, '--linux', '--publish', 'never'], {+ cwd,+ env: wrapperEnv,+ encoding: 'utf8',+ });+ expect(result.status).toBe(7);+ } finally {+ rmSync(cwd, { recursive: true, force: true });+ }+});++test.skipIf(process.platform === 'win32')(+ 'a launcher killed by a signal fails the wrapper and names the signal',+ () => {+ const cwd = launcherFixture("process.kill(process.pid, 'SIGTERM');");+ try {+ const result = spawnSync(process.execPath, [script, '--linux', '--publish', 'never'], {+ cwd,+ env: wrapperEnv,+ encoding: 'utf8',+ });+ expect(result.status).not.toBe(0);+ expect(result.stderr).toContain('Desktop packaging terminated by SIGTERM');+ } finally {+ rmSync(cwd, { recursive: true, force: true });+ }+ },+);++test('an npm user agent is refused before the launcher runs', () => {+ const cwd = launcherFixture("(await import('node:fs')).writeFileSync('launched', '');");+ try {+ const result = spawnSync(process.execPath, [script, '--linux', '--publish', 'never'], {+ cwd,+ env: {+ ...wrapperEnv,+ npm_config_user_agent: 'npm/10.9.2 node/v24.21.0 linux x64 workspaces/false',+ },+ encoding: 'utf8',+ });+ expect(result.status).not.toBe(0);+ expect(result.stderr).toContain('pnpm exec node');+ expect(existsSync(join(cwd, 'launched'))).toBe(false);+ } finally {+ rmSync(cwd, { recursive: true, force: true });+ }+});diff --git a/.github/scripts/release-cascade-shape.test.mjs b/.github/scripts/release-cascade-shape.test.mjsindex 8d5238cc4..2982bd0d8 100644--- a/.github/scripts/release-cascade-shape.test.mjs+++ b/.github/scripts/release-cascade-shape.test.mjs@@ -1087,7 +1087,22 @@ describe('public desktop product variants stay independently buildable', () => {for (const workflow of [desktopBuild, desktopBuildWinLinux]) {expect(workflow).toContain('options: [stable, beta]');expect(workflow).toContain('OK_DESKTOP_VARIANT:');- expect(workflow).toContain('run-electron-builder.mjs');+ }+ });++ test('every manual public packaging call runs the wrapper under pnpm exec', () => {+ for (const workflow of [desktopBuild, desktopBuildWinLinux]) {+ const calls = workflow+ .split('\n')+ .map((line) => line.trim())+ .filter((line) => !line.startsWith('#'))+ .filter((line) => /--publish |(?:run-electron-builder|package-desktop)\.mjs/.test(line));+ expect(calls.length).toBeGreaterThan(0);+ for (const call of calls) {+ expect(call).toMatch(+ /^pnpm exec node "\$GITHUB_WORKSPACE\/\.github\/scripts\/package-desktop\.mjs" --/,+ );+ }}});diff --git a/.github/workflows/desktop-build-win-linux.yml b/.github/workflows/desktop-build-win-linux.ymlindex c86eb67ef..2f098df44 100644--- a/.github/workflows/desktop-build-win-linux.yml+++ b/.github/workflows/desktop-build-win-linux.yml@@ -276,7 +276,7 @@ jobs:echo "::warning::No (complete) Azure signing config — building UNSIGNED installers (internal QA only; never distribute)."echo "signing_requested=false" >> "$GITHUB_OUTPUT"fi- node scripts/run-electron-builder.mjs --win --publish never "${extra[@]}"+ pnpm exec node "$GITHUB_WORKSPACE/.github/scripts/package-desktop.mjs" --win --publish never "${extra[@]}"- name: Attest signed Windows packages and preserved Microsoft signaturesid: attest-windows-signing@@ -516,7 +516,7 @@ jobs:# The variant wrapper turns off the native-rebuild pass for `--linux`# without asserting that node_modules are staged externally.run: |- node scripts/run-electron-builder.mjs --linux ${{ matrix.targets }} --publish never+ pnpm exec node "$GITHUB_WORKSPACE/.github/scripts/package-desktop.mjs" --linux ${{ matrix.targets }} --publish never- name: Assert Linux terminal native package compatibilityworking-directory: packages/desktopdiff --git a/.github/workflows/desktop-build.yml b/.github/workflows/desktop-build.ymlindex 0d1daa4b0..d7cdd32ce 100644--- a/.github/workflows/desktop-build.yml+++ b/.github/workflows/desktop-build.yml@@ -343,9 +343,9 @@ jobs:working-directory: packages/desktoprun: |if [[ "${{ steps.signmode.outputs.mode }}" == "unsigned" ]]; then- node scripts/run-electron-builder.mjs --mac --publish never -c.mac.identity=null+ pnpm exec node "$GITHUB_WORKSPACE/.github/scripts/package-desktop.mjs" --mac --publish never -c.mac.identity=nullelse- node scripts/run-electron-builder.mjs --mac --publish never+ pnpm exec node "$GITHUB_WORKSPACE/.github/scripts/package-desktop.mjs" --mac --publish neverfi# Twin of desktop-release.yml's "Attest the signed macOS app": with