Skip to content

Package the desktop app for Windows - #4662

Merged
SawyerHood merged 1 commit into
mainfrom
bb/windows-desktop-build-thr_jensq3v9th
Oct 2, 2026
Merged

SawyerHood merged 1 commit into
mainfrom
bb/windows-desktop-build-thr_jensq3v9th

Conversation

@SawyerHood

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

The desktop app could not be built for Windows, and a Windows build would have misbehaved:

  • run-electron-builder.mjs spawned node_modules/.bin/electron-builder, which on Windows is a .cmd/.ps1 shim that spawn cannot execute; the script exited 1 with no output.
  • electron-builder.config.json had no Windows target, afterPack computed a Linux-style binary path, and the release-channel helpers threw for win32.
  • electron-builder left @parcel/watcher-win32-x64 out of the package, so the daemon's file-watcher child crashed in a loop ("No prebuild or local build of @parcel/watcher found").
  • resolveBbDesktopPlatform mapped every non-macOS platform to linux, so a Windows build would read the Linux version feed and announce Linux releases.
  • A one-click per-user NSIS install used the sanitized package name as its directory: %LOCALAPPDATA%\Programs\@bbdesktop.

Part of #1206. Stacked on #4657, which is what lets bb build and start on Windows at all.

What changed

  • run-electron-builder.mjs runs electron-builder's cli.js with process.execPath on every platform. For --win it sets the per-channel icon and extraMetadata.name (bb / bb-nightly) so the install directory is %LOCALAPPDATA%\Programs\bb.
  • electron-builder.config.json gains an x64 NSIS target (oneClick, per-user). apps/desktop declares win32 in os, and adds package:win and desktop:build:win with matching Turbo tasks. pnpm desktop resolves package:win on Windows.
  • prepare-native-modules.cjs (afterPack): uses <productName>.exe on Windows, copies the platform @parcel/watcher-<platform>-<arch> package from the workspace when the packaged app lacks it (macOS and Windows; Linux names carry a libc suffix and are left to electron-builder), and loads that binary with the packaged Electron version. A package without @parcel/watcher now fails the build.
  • New windows value in bbDesktopVersionFeedPlatformSchema with desktop-version-windows.json; latest.yml / nightly.yml are the updater metadata names. resolveDesktopUpdateSupport turns both the version check and auto-update off on Windows, because no Windows feed is published.
  • smoke-packaged-app.mjs and packaged-app-paths.mjs handle win-unpacked\bb.exe.
  • The Windows app smoke CI job now also runs package:win and smoke:packaged; its timeout goes from 25 to 40 minutes.
  • apps/desktop/README.md documents Windows packaging.

Not included: a published Windows release (no change to build-desktop.yml or the nightly workflow), code signing, auto-update, and bb-app's npm os field.

How you verified

On a Windows 11 Enterprise VM (build 26300), with this branch (which contains #4657):

  • The three CI steps in order: turbo run smoke:boot --filter=bb-app passed (49 s); turbo run package:win --filter=@bb/desktop passed (102 s), including afterPack's packaged-npm check with Electron 44.3.0; turbo run smoke:packaged --filter=@bb/desktop --force printed Packaged desktop smoke passed: …\release\win-unpacked\bb.exe.
  • desktop:build:win produced bb-0.44.0-x64.exe (175 MB) and latest.yml. A silent install (/S) created %LOCALAPPDATA%\Programs\bb\bb.exe, a Start Menu shortcut, and an uninstall entry. The installed app started its server and daemon, showed the main window, and two watcher child processes were running; the earlier build without the watcher package logged the "No prebuild" error on every respawn.
  • Closing the main window left zero bb.exe processes after 15 s. Force-killing only the main process also left zero after 12 s, and the next launch started normally.
  • Before the directory-name change the same installer created %LOCALAPPDATA%\Programs\@bbdesktop.

On Linux: turbo run lint typecheck test --filter=@bb/desktop --filter=@bb/desktop-contract --filter=@bb/scripts passes (11 of 11 tasks). New tests cover the Windows platform mapping, update support, the printed builder config for --win on both channels, the Windows launch arguments, and the packaging task name.

Not verified: the macOS path through the new watcher copy and load check (it runs only when the package lacks the platform package, and I have no macOS host here); the Windows build on the CI runner, which this PR's run will show.

🤖 Generated with Claude Code

AGENT GENERATED

@SawyerHood
SawyerHood added this pull request to stack #4663 October 1, 2026 23:45
@SawyerHood
SawyerHood marked this pull request as ready for review October 2, 2026 01:41
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-02T01:44:50.733460Z 1103cab Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Base automatically changed from bb/windows-boot-and-cli-thr_jensq3v9th to main October 2, 2026 03:21
The desktop build scripts only knew macOS and Linux: electron-builder was
spawned through a shim Windows cannot execute, there was no Windows target,
the packaged app lacked the Windows file-watcher binary, and the app reported
itself as the Linux build.

- Run electron-builder through Node and add an x64 NSIS target, a per-user
  install directory named after the product, and `package:win` and
  `desktop:build:win` tasks.
- Copy and load-check `@parcel/watcher-win32-x64` in afterPack.
- Add a `windows` desktop platform with its own feed and updater metadata
  names; Windows builds do not check for or install updates yet.
- Run the packaged-app smoke on Windows and package the app in the Windows
  CI job.

Co-Authored-By: Claude Code <[email protected]>
@SawyerHood
SawyerHood force-pushed the bb/windows-desktop-build-thr_jensq3v9th branch from 1103cab to f8f98ce Compare October 2, 2026 03:21
@SawyerHood
SawyerHood merged commit 049d6a9 into main Oct 2, 2026
22 checks passed
@SawyerHood
SawyerHood deleted the bb/windows-desktop-build-thr_jensq3v9th branch October 2, 2026 03:27
SawyerHood added a commit that referenced this pull request Oct 2, 2026
## Human comments

## What was wrong

The Windows desktop app could be packaged (#4662) but nothing built or
published it, and `resolveDesktopUpdateSupport` returned no version
check and no auto-update for Windows, so an installed Windows app would
never learn about a newer release. Part of #1206.

## What changed

- `.github/workflows/build-desktop.yml`: new `windows` job (Blacksmith
Windows 2025) that packages the NSIS x64 installer with
`desktop:build:win`, smoke tests the packaged app, and writes
`desktop-version-windows.json`. The single `publish` job now needs it
and uploads the installer, block map, `latest.yml`, and the Windows feed
with the other platforms. A Windows build failure therefore stops the
release, as a Linux one does.
- `.github/workflows/publish-bb-app.yml`: new `nightly-desktop-windows`
job with the same shape; the nightly publish requires its version to
match the others and uploads `nightly.yml` and the Windows feed.
- Signing: both Windows jobs pass `WINDOWS_CERTIFICATE_PFX` and
`WINDOWS_CERTIFICATE_PASSWORD` to electron-builder as `WIN_CSC_LINK` and
`WIN_CSC_KEY_PASSWORD`. With neither secret the installer is unsigned
and still published (Windows SmartScreen warns before running it); with
only one the stable job fails.
- `apps/desktop/src/desktop-update-provider.ts`: Windows checks its
version feed and installs updates through electron-updater, like macOS.
- `apps/desktop/README.md` and `docs/bb-release-process.md` describe the
Windows artifacts, feeds, and secrets.

The Windows jobs do not run the desktop and launcher unit tests that the
macOS and Linux jobs run; those suites pass on Windows only with #4738
and #4739.

## How you verified

- Windows 11 Enterprise VM (build 26300): built installers for 0.44.0
and 0.44.1 from this change with the update URL pointed at a local HTTP
server holding the 0.44.1 installer, block map, `latest.yml`, and
`desktop-version-windows.json` (generated by `desktop:version-feed`).
The installed 0.44.0 fetched the version feed and `latest.yml`,
downloaded the 0.44.1 installer in the background, and after the window
was closed the installer ran silently; `bb.exe` then reported 0.44.1 and
the app started. The silent install took about a minute and a half,
during which `bb.exe` was absent.
- Linux: `desktop-update-provider.test.ts` passes; both workflow files
parse as YAML. On this branch before the last rebase, `turbo run lint
typecheck test --filter='...[origin/main]'`: 14 of 14 tasks passed.
After the rebase onto current main, lint and typecheck pass for the same
filter.

Not verified: the workflow jobs have never run (they only run from
`workflow_dispatch` and the nightly schedule); signing with a real
certificate; the Relaunch button path (the install-on-quit path is what
the test above exercised).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

> AGENT GENERATED

Co-authored-by: Claude Code <[email protected]>
tomdale added a commit to tomdale/bb that referenced this pull request Oct 20, 2026
The Personal and Lab build profiles were written against a base that
predated upstream's Windows packaging (get-bb#4662), and resolving them onto
main replaced upstream files wholesale. That dropped win32 from the
desktop package, the desktop:build:win and package:win scripts, the
win32 build platform, Windows update metadata and install names, and
Windows auto-update support.

Restore those files to upstream and move the profile helpers
(resolveDesktopBuildProfile, createDesktopApplicationIdentity) into the
fork-owned desktop-build-profiles module, so desktop-release-channel
matches upstream exactly. A profile test now fails if release builds
lose Windows packaging again.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant