Skip to content

fix: keep app-version and related CLI args as strings#1923

Open
claude[bot] wants to merge 1 commit into
mainfrom
fix/app-version-string-coercion
Open

fix: keep app-version and related CLI args as strings#1923
claude[bot] wants to merge 1 commit into
mainfrom
fix/app-version-string-coercion

Conversation

@claude

@claude claude Bot commented Jun 25, 2026

Copy link
Copy Markdown

Requested by Samuel Attard · Slack thread

Before / After

Running electron-packager … --app-version "1.0" (or any numeric-looking version) failed with the generic error Invalid processed options in 19.x. With this change it packages correctly with version "1.0".

What was happening

The CLI parses args with yargs-parser. The string: allow-list in parseArgs (src/cli.ts) only included electron-version and out, so --app-version 1.0 was auto-coerced to the JS number 1 (also truncating 1.01). That fails the typeof opts.appVersion === 'string' check in src/packager.ts and throws. The same applied to --build-version and --app-copyright.

Fix

Add app-version, build-version, and app-copyright to the yargs string: array so they're never coerced. Adds a regression test in test/cli.spec.ts asserting these stay strings (e.g. appVersion === "1.0"). tsc builds clean; full vitest suite passes (19/19).

Fixes #1853.


Generated by Claude Code

yargs-parser was coercing numeric-looking values for app-version,
build-version and app-copyright into JS numbers (e.g. --app-version 1.0
became the number 1). This failed the `typeof opts.appVersion === 'string'`
check in src/packager.ts and threw the generic "Invalid processed options"
error.

Add these flags to the yargs `string:` allow-list so they are never
coerced, plus a regression test asserting they stay strings.

Fixes #1853.
@welcome

welcome Bot commented Jun 25, 2026

Copy link
Copy Markdown

Thanks for opening a pull request!

Here are some highlighted action items that will help get it across the finish line, from the
pull request guidelines:

  • Follow the JavaScript coding style.
  • Run npm run lint locally to catch formatting errors earlier.
  • Document any user-facing changes in NEWS.md and other docs.
  • Include tests when adding/changing behavior.

Development and triage is community-driven, so please be patient and we will get back to you as soon as we can.

@MarshallOfSound MarshallOfSound marked this pull request as ready for review June 25, 2026 15:03
@MarshallOfSound MarshallOfSound requested a review from a team as a code owner June 25, 2026 15:03
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.

--app-version 1.0 gives error message "Invalid processed options"

2 participants