Skip to content

Conversation

Copy link

Copilot AI commented Feb 8, 2026

Modernizes the application from Electron 9 (Node 12) to Electron 37 (Node 22), removing Python 2 dependency and enabling Apple Silicon builds. Refactors renderer-process operations to main process via IPC handlers.

Core Upgrades

  • Electron 9.4.4 → 37.0.0
  • Node.js 12 → 22 (bundled)
  • serialport 9.0.7 → 13.0.0 (required for Node 22)
  • Dependencies: electron-log, electron-settings, exceljs, johnny-five updated to compatible versions

Architecture Changes

IPC Layer (preload.js)

New preload script exposes secure APIs via window.electronAPI:

  • File operations (async): read/write/delete/list
  • Configuration management (nconf-backed)
  • Race data storage (electron-settings-backed)
  • Hardware I/O: Johnny-Five board, sensors, LEDs, buzzer
  • System dialogs and shell operations

Backend Migration (window.js)

Moved 1000+ LOC from renderer to main process:

  • All ipcMain.handle() implementations for file system, configuration, storage
  • Hardware initialization and I/O operations
  • Dialog and window management
  • Global state management for board/sensors/LEDs

Renderer Refactoring

  • js/main.js: Removed electron.remote, converted to IPC calls and async/await
  • js/storage.js: Complete rewrite with async IPC + in-memory cache for backward compatibility
  • js/configuration.js: Async IPC-based config operations
  • js/client.js, js/export.js, js/ui.js: Updated to async patterns
// Before
const { app } = require('electron').remote;
const racePath = path.join(app.getPath('userData'), 'races');
fs.mkdirSync(racePath);

// After
const racePath = await window.electronAPI.getAppPath('userData');
await window.electronAPI.ensureDir(path.join(racePath, 'races'));

Trade-offs

  • Drops Windows 7 support (Windows 10+ required)
  • DevTools enabled during transition period
  • Context isolation prepared but disabled (contextIsolation: false) for compatibility—hardware operations accessible via window.nodeRequire

Build Changes

  • Updated electron-rebuild scripts for native module compilation
  • Added serialport override in package.json for dependency resolution
  • ESLint rules tightened for async/await patterns

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Update node/electron and implement proper IPC Upgrade Electron 9→37 and implement IPC architecture Feb 8, 2026
Copilot AI requested a review from Pimentoso February 8, 2026 16:43
@Pimentoso Pimentoso closed this Feb 9, 2026
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.

2 participants