0b51d133a4
Move legacy Steam-related docs into documentation/archived and add a new UPLOAD-ITCH.md describing how to publish builds to itch.io with Butler. Update top-level README to state official releases will be on itch.io. Remove Steam-specific UI/features: drop steamCloudOptIn from first-run preferences, remove the Steam Cloud teaser and summary from the setup flow, and adjust settings/setup copy to reference handheld devices and non‑Steam distribution. Also make a small wording tweak in the plugins doc about rendererPreload.
4.0 KiB
4.0 KiB
Electron Upgrade Feature - Bug Fixes
Problem Identified
The upgrade feature was downloading and installing new Electron versions successfully, but the app always showed the old version (1.0.0) after restart because:
- Version Source Issue: The app was reading
app.getVersion()which gets the version frompackage.jsonat startup time - Package.json Not Re-read: Even after npm installed a new Electron version, the app didn't re-read the updated
package.json - Runtime Display: The About tab showed the bundled Electron version (37.x) which is baked into the binary at build time
Solutions Implemented
1. New Helper Function: getInstalledElectronVersion()
- Reads
package.jsondirectly every time it's called (not cached) - Extracts the actual installed Electron version from
devDependencies - Handles both stable (
electron) and nightly (electron-nightly) packages - Strips version specifiers (^, ~, etc.) to get the clean version number
- Falls back to
app.getVersion()if reading fails
function getInstalledElectronVersion() {
try {
const packageJsonPath = path.join(__dirname, 'package.json');
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
const electronDep = packageJson.devDependencies?.electron;
const electronNightlyDep = packageJson.devDependencies?.['electron-nightly'];
if (electronDep) {
return electronDep.replace(/^\D+/, '');
}
if (electronNightlyDep) {
return electronNightlyDep.replace(/^\D+/, '');
}
return app.getVersion();
} catch (err) {
return app.getVersion();
}
}
2. Updated get-electron-versions Handler
- Now uses
getInstalledElectronVersion()instead ofapp.getVersion() - Returns the actual installed version that was modified by npm
- Performs fresh version checks each time (no caching)
3. Improved upgrade-electron Handler
- Increased
maxBufferto handle large npm output - Added cleanup logic to remove the old Electron variant when switching types
- Removes
electronwhen upgrading tonightly - Removes
electron-nightlywhen upgrading tostable
- Removes
- Better error logging to debug npm failures
- Returns clearer messages about installation status
4. Enhanced UI/UX in settings.js
- Added more descriptive status text ("Downloading and installing..." instead of just "Upgrading...")
- Disables all controls during upgrade to prevent multiple clicks
- Reduced restart delay from 2000ms to 1500ms for faster feedback
- Better error handling with proper cleanup of disabled states
How It Works Now
-
User clicks "Check for Updates"
- Queries npm registry for latest version
- Uses
getInstalledElectronVersion()to read current version frompackage.json - Compares versions and shows if update is available
-
User clicks "Upgrade Electron"
- Confirms action
- Runs
npm install --save-dev electron@latest(orelectron-nightly@latest) - npm downloads and installs new version
- Handler removes the other Electron variant from
package.jsonif needed - Shows success message
-
App Restarts
- Uses
app.relaunch()andapp.quit() - When app relaunches, it:
- Loads new Electron binary from
node_modules - Runs new Electron version
- Settings page shows correct new version on next check
- Loads new Electron binary from
- Uses
Testing Recommendations
- Test upgrading from stable to nightly version
- Test upgrading from nightly back to stable
- Verify version display updates after restart
- Check that old variant is removed from
package.json - Verify app runs stably with new Electron version
Notes for Future Development
- The About tab displays
process.versions.electronwhich is the bundled Chromium version, not the Electron framework version - The Electron version we display in the upgrade section comes from
package.jsonwhich is the actual framework version - When building with electron-builder, the bundled version becomes fixed until next rebuild
- For development/testing, the upgrade feature reads live from
package.json