Skip to content

feat: write appVersion into the packaged app's package.json#1926

Open
claude[bot] wants to merge 1 commit into
mainfrom
feat/write-app-version-to-package-json
Open

feat: write appVersion into the packaged app's package.json#1926
claude[bot] wants to merge 1 commit into
mainfrom
feat/write-app-version-to-package-json

Conversation

@claude

@claude claude Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Requested by Samuel Attard · Slack thread

  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project follows, as appropriate.
  • The changes are appropriately documented (if applicable).
  • The changes have sufficient test coverage (if applicable).
  • The testsuite passes successfully on my local machine (if applicable).

Summarize your changes:

Before: the appVersion option was only stamped into executable metadata (rcedit/resedit on Windows, Info.plist on macOS). On Linux there is no such metadata, so app.getVersion() falls back to the packaged package.json — meaning --app-version=99 on Linux still gives app.getVersion() === "0.0" when the app's package.json has no version field, and a stale version field silently wins over --app-version.

After: the resolved appVersion is always written into the version field of the packaged app's package.json, so app.getVersion() returns the same value on every platform. When appVersion was inferred from package.json in the first place, the write is a no-op (and is skipped entirely if the value already matches, preserving the file's original formatting).

How: the write happens in the platform-agnostic App class in src/platform.ts — a new writeAppVersion() step runs in buildApp() after copyTemplate()/validation and before asar packing, so the updated package.json lands inside app.asar (or the app directory when asar is disabled). Only the copy in the staging directory is modified, never the user's source directory. The appVersion JSDoc in src/types.ts is updated accordingly, with unit tests in test/platform.spec.ts and end-to-end assertions in test/packager.spec.ts.

Closes #1331


Generated by Claude Code

@MarshallOfSound MarshallOfSound marked this pull request as ready for review July 3, 2026 19:10
@MarshallOfSound MarshallOfSound requested a review from a team as a code owner July 3, 2026 19:10
@claude claude Bot force-pushed the feat/write-app-version-to-package-json branch from 3873f61 to 633650b Compare July 3, 2026 19:12
@claude claude Bot mentioned this pull request Jul 3, 2026
5 tasks
@claude claude Bot force-pushed the feat/write-app-version-to-package-json branch from 633650b to de3b711 Compare July 3, 2026 19:23
The resolved appVersion is now written to the version field of the
copied app's package.json (in the staging directory, never the user's
source directory) before asar packing. This makes app.getVersion()
return the correct version on platforms without executable version
metadata (i.e. Linux), consistent with the existing metadata stamping
on Windows and macOS.

Closes #1331
@claude claude Bot force-pushed the feat/write-app-version-to-package-json branch from de3b711 to 2c370dc Compare July 3, 2026 19:28
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.

Packaging apps for linux does not set correct appVersion

2 participants