fix(macos): derive bundle Info.plist version from VERSION constant
The release tag bumps VERSION in src/index.tsx, but build.ts hardcoded 0.3.1 in the app bundle's plist — shipped bundles reported a stale version (lsappinfo/System Settings). Extract VERSION at bundle-assembly time and interpolate into CFBundleShortVersionString/CFBundleVersion.
This commit is contained in:
15
build.ts
15
build.ts
@@ -173,7 +173,16 @@ if (COMPILE) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Keep CFBundleShortVersionString in sync with src/index.tsx VERSION.
|
// Version for the bundle comes from src/index.tsx (single source of
|
||||||
|
// truth — release.yml requires bumping it in the tag commit).
|
||||||
|
const srcIndex = await Bun.file(join("src", "index.tsx")).text();
|
||||||
|
const versionMatch = srcIndex.match(/const VERSION = "([^"]+)"/);
|
||||||
|
const bundleVersion = versionMatch?.[1];
|
||||||
|
if (!bundleVersion) {
|
||||||
|
console.error("Error: could not read VERSION from src/index.tsx");
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
Bun.write(
|
Bun.write(
|
||||||
join(appRoot, "Contents", "Info.plist"),
|
join(appRoot, "Contents", "Info.plist"),
|
||||||
`<?xml version="1.0" encoding="UTF-8"?>
|
`<?xml version="1.0" encoding="UTF-8"?>
|
||||||
@@ -193,9 +202,9 @@ if (COMPILE) {
|
|||||||
<key>CFBundleIconFile</key>
|
<key>CFBundleIconFile</key>
|
||||||
<string>AppIcon</string>
|
<string>AppIcon</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>0.3.1</string>
|
<string>${bundleVersion}</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>0.3.1</string>
|
<string>${bundleVersion}</string>
|
||||||
<key>LSMinimumSystemVersion</key>
|
<key>LSMinimumSystemVersion</key>
|
||||||
<string>12.0</string>
|
<string>12.0</string>
|
||||||
</dict>
|
</dict>
|
||||||
|
|||||||
Reference in New Issue
Block a user