feat: write appVersion into the packaged app's package.json#1926
Open
claude[bot] wants to merge 1 commit into
Open
feat: write appVersion into the packaged app's package.json#1926claude[bot] wants to merge 1 commit into
claude[bot] wants to merge 1 commit into
Conversation
MarshallOfSound
approved these changes
Jul 3, 2026
3873f61 to
633650b
Compare
5 tasks
633650b to
de3b711
Compare
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
de3b711 to
2c370dc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Samuel Attard · Slack thread
Summarize your changes:
Before: the
appVersionoption was only stamped into executable metadata (rcedit/resedit on Windows,Info.pliston macOS). On Linux there is no such metadata, soapp.getVersion()falls back to the packagedpackage.json— meaning--app-version=99on Linux still givesapp.getVersion() === "0.0"when the app'spackage.jsonhas noversionfield, and a staleversionfield silently wins over--app-version.After: the resolved
appVersionis always written into theversionfield of the packaged app'spackage.json, soapp.getVersion()returns the same value on every platform. WhenappVersionwas inferred frompackage.jsonin 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
Appclass insrc/platform.ts— a newwriteAppVersion()step runs inbuildApp()aftercopyTemplate()/validation and before asar packing, so the updatedpackage.jsonlands insideapp.asar(or theappdirectory when asar is disabled). Only the copy in the staging directory is modified, never the user's source directory. TheappVersionJSDoc insrc/types.tsis updated accordingly, with unit tests intest/platform.spec.tsand end-to-end assertions intest/packager.spec.ts.Closes #1331
Generated by Claude Code