Skip to content

fix: add --platform CLI argument - #1285

Merged
dsanders11 merged 1 commit into
mainfrom
fix/cli-platform-arg
Jun 27, 2026
Merged

dsanders11 merged 1 commit into
mainfrom
fix/cli-platform-arg

Conversation

@claude

@claude claude Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Requested by Samuel Attard · Slack thread

Before / After

Before: platform is a documented RebuildOptions field consumed by the rebuild() API, but the CLI never exposed it. Running electron-rebuild --platform=... had no effect — the flag wasn't defined, so the value was never accepted or forwarded, and the rebuild always fell back to the host's process.platform.

After: --platform is a recognized CLI flag (it now shows up in --help) and its value is forwarded into the rebuild() call, letting users override the target platform the same way --arch overrides the target architecture.

How

The change is in src/cli.ts:

  • Added a platform entry to the options object, mirroring the existing arch option (type: 'string' with a matching description).
  • Threaded platform: (argv.platform as NodeJS.Platform) || process.platform into the rebuild() options object, alongside arch.

Fixes #1240


Generated by Claude Code

The platform option is a documented RebuildOptions field used by the
rebuild() API, but the CLI never defined a --platform flag nor passed
platform through, so it always defaulted to process.platform.

Add a platform entry to the CLI options object and thread
platform: argv.platform into the rebuild() call alongside arch.

Fixes #1240

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Pz3ypFU3omZPd7LFeTcSEU
@MarshallOfSound
MarshallOfSound marked this pull request as ready for review June 27, 2026 21:45
@MarshallOfSound
MarshallOfSound requested a review from a team as a code owner June 27, 2026 21:46
@dsanders11
dsanders11 merged commit 3e73e57 into main Jun 27, 2026
9 checks passed
@dsanders11
dsanders11 deleted the fix/cli-platform-arg branch June 27, 2026 23:33
@electron-npm-package-publisher

Copy link
Copy Markdown

🎉 This PR is included in version 4.0.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing --platform CLI argument

3 participants