Skip to content

feat(migration): fully replace Go binary app-builder-bin with TS implementation#9829

Merged
mmaietta merged 6 commits into
masterfrom
migrate-off-app-builder-bin
Jun 4, 2026
Merged

feat(migration): fully replace Go binary app-builder-bin with TS implementation#9829
mmaietta merged 6 commits into
masterfrom
migrate-off-app-builder-bin

Conversation

@mmaietta

@mmaietta mmaietta commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • app-builder-bin fully removedexecuteAppBuilder and its entire call surface deleted from builder-util and app-builder-lib. The app-builder-bin npm package is no longer a dependency.
  • 7-Zip toolset (packages/app-builder-lib/src/toolsets/7zip.ts) — New pure-TS downloader for 7za from electron-userland/electron-builder-binaries. Replaces builder-util/src/7za.ts. getPath7za() now resets its memoized promise on failure so callers can retry on transient errors.
  • Wine toolset (packages/app-builder-lib/src/toolsets/wine.ts) — Replaces wine.ts and the old execWine() helper. Supports legacy wine-4.0.1-mac (default), wine@1.0.1 (Wine 11), and ELECTRON_BUILDER_WINE_TOOLSET_DIR local override. Env var merging fixed: DYLD_FALLBACK_LIBRARY_PATH and LD_LIBRARY_PATH now correctly merge with existing process env without duplication. Env-override path probes both bin/wine and bin/wine64 to handle legacy bundles.
  • WineVmManager (packages/app-builder-lib/src/vm/WineVm.ts) — exec() now spreads process.env as the base so PATH, HOME, and TMPDIR are preserved when invoking Wine.
  • Snap build — pure TS (packages/app-builder-lib/src/targets/snap/coreLegacy.ts):
    • buildWithTemplate: downloads snap template tarball with pinned SHA-256 checksums; calls mksquashfs directly.
    • buildWithoutTemplate: stages desktop-integration shell scripts from templates/snap/; command.sh now correctly references $SNAP/scripts/desktop-*.sh (not $SNAP/desktop-*.sh) in no-template builds.
    • executableName validated via validateShellEmbeddable before embedding in the generated command.sh to prevent shell injection via crafted app names.
    • desktop-common.sh fixed: LIBVA_DRIVERS_PATH now uses $SNAP_DESKTOP_ARCH_TRIPLET (exported) instead of $ARCH (local only).
  • Node module collector (packages/app-builder-lib/src/node-module-collector/nodeModulesCollector.ts):
    • Race condition fixed: settles only after both child close and write stream finish.
    • On outStream error: child.kill() and outStream.destroy() are now called (best-effort) before rejecting, preventing orphaned processes.
    • Retry logic extended to catch "No JSON content found in output".
    • PowerShell -EncodedCommand wrapping on Windows to avoid .cmd shim spawn issues.
  • ProtonFramework / LibUiFramework — Replaces app-builder proton-native command with downloadBuilderToolset.
  • NSIS unpackedSize — Replaces 7za l archive listing with the unpackedSize value already computed during packaging.
  • Snap template checksums — SHA-256 checksums computed and pinned for both amd64 and armhf templates; downloadBuilderToolset signature restored to accept optional checksums (callers without pre-known hashes remain compatible via unsafelyDisableChecksums).

@changeset-bot

changeset-bot Bot commented Jun 3, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 87f5e49

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 10 packages
Name Type
app-builder-lib Major
builder-util Major
dmg-builder Major
electron-builder-squirrel-windows Major
electron-builder Major
electron-forge-maker-appimage Major
electron-forge-maker-nsis-web Major
electron-forge-maker-nsis Major
electron-forge-maker-snap Major
electron-publish Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR completes the removal of the app-builder-bin (Go) native binary dependency by replacing its remaining responsibilities with TypeScript implementations and separately downloaded toolsets (7-Zip, Wine, snap templates), reducing native binary surface area across electron-builder.

Changes:

  • Removed executeAppBuilder / app-builder-bin and migrated remaining call sites to TS implementations and toolset downloads.
  • Introduced downloadable toolsets for 7-Zip and Wine, and updated packaging flows (snap, NSIS/Wine, Proton/LibUI, extraction paths) to use them.
  • Added/updated Vitest coverage for the new behaviors (archive args, snap helpers, wine toolset, stream collector race fix, extraction security).

Reviewed changes

Copilot reviewed 40 out of 42 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
we-need-to-remove-app-builder-bin.md New migration plan/inventory doc for removing app-builder-bin.
test/src/node-module-collector/streamCollectorTest.ts Updates mocks + adds test for outStream error handling.
test/src/mac/wineToolsetSuite.ts Adds integration tests for getWineToolset() on macOS.
test/src/linux/snapCoreLegacyTest.ts Adds unit tests for shellQuote() helper.
test/src/libUiFrameworkTest.ts Adds tests for LibUI helper mapping + shell-embeddable validation.
test/src/ksuidTest.ts Removes parity tests that depended on executeAppBuilder(["ksuid"]).
test/src/helpers/winHelper.ts Updates Wine-based installer verification wiring to use the new toolset.
test/src/helpers/wine.ts Allows injecting wine path/env; uses toolset env and derived wineboot path.
test/src/extractArchiveTest.ts Adds ZIP traversal/symlink guard tests for extractArchive().
test/src/certInfoTest.ts Removes parity tests that depended on executeAppBuilder(["certificate-info"]).
test/src/blockmapTest.ts Removes parity comparisons to app-builder-bin golden output.
test/src/archiveUtilTest.ts Adds tests for compute7zCompressArgs and archive guards.
test/package.json Removes app-builder-bin dev dependency from tests.
pnpm-lock.yaml Removes app-builder-bin and 7zip-bin lock entries.
packages/electron-builder-squirrel-windows/src/SquirrelWindowsTarget.ts Switches wine execution to WineVmManager (toolset-based).
packages/builder-util/src/util.ts Removes executeAppBuilder and 7za exports (API change).
packages/builder-util/src/7za.ts Deletes old 7zip-bin wrapper.
packages/builder-util/package.json Drops 7zip-bin and app-builder-bin dependencies.
packages/app-builder-lib/templates/snap/desktop-init.sh Adds desktop integration script template.
packages/app-builder-lib/templates/snap/desktop-gnome-specific.sh Adds GNOME-specific desktop integration script template.
packages/app-builder-lib/templates/snap/desktop-common.sh Adds common desktop integration script template.
packages/app-builder-lib/src/wine.ts Deletes old execWine wrapper around app-builder.
packages/app-builder-lib/src/vm/WineVm.ts Updates WineVmManager to use getWineToolset().
packages/app-builder-lib/src/vm/vm.ts Minor tweak in Parallels VM selection logic.
packages/app-builder-lib/src/util/electronGet.ts Adds .tar.xz extraction path and increases lock retries.
packages/app-builder-lib/src/toolsets/wine.ts New Wine toolset downloader/env builder.
packages/app-builder-lib/src/toolsets/7zip.ts New 7-Zip toolset downloader + cached resolver.
packages/app-builder-lib/src/targets/snap/coreLegacy.ts Rewrites legacy snap builder to TS/template download + snapcraft flow.
packages/app-builder-lib/src/targets/nsis/NsisTarget.ts Removes last direct 7za listing usage; uses unpackedSize and toolset wine VM.
packages/app-builder-lib/src/targets/MsiTarget.ts Updates Wine VM construction to accept toolset config.
packages/app-builder-lib/src/targets/archive.ts Refactors compression args; removes zip-specific helper; adds path guard.
packages/app-builder-lib/src/ProtonFramework.ts Passes launchUiVersion through to LibUI.
packages/app-builder-lib/src/packager.ts Respects string launchUiVersion (not just boolean).
packages/app-builder-lib/src/node-module-collector/nodeModulesCollector.ts Fixes stream flush race; expands retry conditions.
packages/app-builder-lib/src/frameworks/LibUiFramework.ts Replaces proton-native app-builder command with TS downloads + shell safety validation.
packages/app-builder-lib/src/electron/ElectronFramework.ts Uses extractArchive() instead of direct 7za unzip path.
packages/app-builder-lib/src/configuration.ts Adds toolsets.wine config option.
packages/app-builder-lib/scheme.json Adds schema support for toolsets.wine.
packages/app-builder-lib/package.json Minor ordering change (no functional change).
.changeset/remove-app-builder-bin-snap-wine.md Changeset for snap/wine migration + full removal.
.changeset/remove-app-builder-bin-proton-native.md Changeset for proton-native migration.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/app-builder-lib/src/targets/snap/coreLegacy.ts Outdated
Comment thread packages/app-builder-lib/src/targets/snap/coreLegacy.ts
Comment thread packages/app-builder-lib/src/toolsets/wine.ts
Comment thread packages/app-builder-lib/src/toolsets/wine.ts
Comment thread packages/app-builder-lib/src/vm/WineVm.ts Outdated
Comment thread .changeset/remove-app-builder-bin-snap-wine.md Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 41 out of 42 changed files in this pull request and generated 5 comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Comment thread packages/app-builder-lib/src/targets/snap/coreLegacy.ts
Comment thread packages/app-builder-lib/src/toolsets/wine.ts
Comment thread packages/app-builder-lib/src/toolsets/7zip.ts
Comment thread packages/app-builder-lib/templates/snap/desktop-common.sh Outdated
Comment thread we-need-to-remove-app-builder-bin.md Outdated
… equivalents; `executeAppBuilder` and `app-builder-bin` package fully removed from codebase; snap templates now downloaded via `downloadBuilderToolset` with pinned checksums; Wine is downloaded automatically on macOS (legacy 4.0.1 bundle by default, Wine 11 bundle available via `toolsets.wine: "1.0.1"`); on Linux with legacy config and when `USE_SYSTEM_WINE=true`, system wine is used instead

feat: replace app-builder-bin `proton-native` command with pure-TS equivalents; Node.js and LaunchUI binaries are now downloaded via `downloadBuilderToolset`; `config.launchUiVersion` string is now respected
@mmaietta mmaietta force-pushed the migrate-off-app-builder-bin branch from fd61254 to bbf67e9 Compare June 4, 2026 00:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Security issue in 7zip-bin dependency.

2 participants