Skip to content

feat(build): adopt electron-vite for dev + build pipeline#228

Merged
CoderCoco merged 24 commits into
mainfrom
claude/issue-144-feat-build-adopt-electron-vite-for-dev-build-pipel
Jun 3, 2026
Merged

feat(build): adopt electron-vite for dev + build pipeline#228
CoderCoco merged 24 commits into
mainfrom
claude/issue-144-feat-build-adopt-electron-vite-for-dev-build-pipel

Conversation

@CoderCoco
Copy link
Copy Markdown
Owner

Closes #144

Summary

  • Adds electron-vite ^5.0.0 as the build orchestrator at the workspace root, replacing separate tsc -b / vite invocations with a single three-pipeline build (main, preload, renderer)
  • Introduces electron-entry.ts — the Electron app shell that creates the BrowserWindow, wires the preload script, loads ELECTRON_RENDERER_URL in dev (HMR) or the production out/renderer/index.html, and starts the NestJS IPC microservice; bootstrap failures surface via .catch() + app.quit() instead of being silently swallowed
  • Exports bootstrap() from main.ts so electron-entry.ts controls call timing; wires desktop:dev / desktop:build scripts at root and removes Epic A placeholder stubs

Changes

CLAUDE.md                                        +5   docs: desktop:dev / desktop:build commands
app/eslint.config.js                             +1   ignore **/out/** (electron-vite build output)
app/package.json                                 ±4   replace echo/exit-1 stubs with electron-vite scripts
app/packages/desktop-main/package.json           ±4   same
app/packages/desktop-main/src/electron-entry.ts  +55  new Electron app entry
app/packages/desktop-main/src/electron-entry.test.ts  +241  6 unit tests (dev/prod/bootstrap/quit/macOS/rejection)
app/packages/desktop-main/src/main.ts            ±10  export bootstrap(), remove module-level call
app/packages/desktop-main/src/main.test.ts       ±13  explicit bootstrap() calls; accurate descriptions
electron.vite.config.ts                          +40  main/preload/renderer pipelines
package.json                                     +2   desktop:dev + desktop:build scripts

Test plan

  • 559 unit tests pass (npm run app:test)
  • Lint passes — 0 errors (npm run app:lint)
  • TypeScript clean (tsc --noEmit)
  • electron-vite build exits 0 and produces out/main, out/preload, out/renderer
  • Manual: npm run desktop:dev launches Electron with HMR on renderer saves
  • Manual: editing a main-process file triggers auto-restart
🚀 Mission log
═══════════════════════════════════════════════════════
  MISSION  issue #144 — feat(build): adopt electron-vite for dev + build pipeline
═══════════════════════════════════════════════════════
  pre-launch      ✓  (6 tasks planned)
  liftoff         ✓  (6/6 passed — Apollo Borman Collins Duke Eisele Frost)
  systems-check   ✓  (2 repairs — Glenn Haise)
  docking         ✓
═══════════════════════════════════════════════════════

🤖 Generated via /mission

Copilot AI review requested due to automatic review settings June 1, 2026 00:32
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR switches the desktop app dev/build workflow to electron-vite, adding a dedicated Electron entrypoint and adjusting scripts so the desktop main/preload/renderer pipelines can be built and run under a single orchestrator.

Changes:

  • Add electron-vite at the workspace root and introduce desktop:dev / desktop:build scripts.
  • Add a new Electron main-process entry (electron-entry.ts) that creates the BrowserWindow, loads dev/prod renderer targets, and boots the NestJS IPC microservice.
  • Update desktop-main bootstrap flow (export bootstrap() and adjust tests accordingly); add dedicated unit tests for the new Electron entry module.

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
package.json Adds electron-vite and root desktop:* scripts.
package-lock.json Locks electron-vite@5.0.0 and transitive deps.
electron.vite.config.ts Defines electron-vite pipelines for main/preload/renderer.
CLAUDE.md Documents the new desktop:dev / desktop:build commands.
app/eslint.config.js Ignores **/out/** build output.
app/package.json Replaces prior placeholder dev/start scripts with electron-vite commands.
app/packages/desktop-main/package.json Updates desktop-main scripts to use electron-vite for dev/build entrypoints.
app/packages/desktop-main/src/main.ts Exports bootstrap() and removes the module-level invocation.
app/packages/desktop-main/src/main.test.ts Updates tests to call bootstrap() explicitly.
app/packages/desktop-main/src/electron-entry.ts New Electron entry that wires preload, loads renderer, and starts IPC microservice.
app/packages/desktop-main/src/electron-entry.test.ts Adds unit tests covering dev/prod loading and lifecycle behaviors.

Comment thread package.json
CoderCoco added 2 commits May 31, 2026 20:53
…s-platform optional packages

npm 10 on Linux omitted optional platform packages for darwin/win32/android from
the lockfile. npm 11 (Node 24, used by CI) requires them to be present for npm ci.

Refs #144
electron-vite@5.0.0 requires ^20.19.0 || >=22.12.0. The previous
>=20 allowed versions where electron-vite would refuse to run.

Refs #144
Copilot AI review requested due to automatic review settings June 1, 2026 01:08
CoderCoco added 2 commits May 31, 2026 21:10
Without caching, every run re-downloads ~280MB of Chromium binaries
via npx playwright install, which was causing hangs on slow runners.

Refs #144
Node 20 EOL was April 2026. CI already runs on Node 24. electron-vite
requires ^20.19.0 || >=22.12.0 so Node 22.12+ covers it cleanly.

Refs #144
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 13 changed files in this pull request and generated 2 comments.

Comment thread electron.vite.config.ts
Comment thread CLAUDE.md Outdated
CoderCoco added 2 commits May 31, 2026 21:14
Both files were fully commented out (no-ops) but still appeared as
failed check runs on every PR push. Removing them cleans up the
CI status view.

Refs #144
--with-deps in a single step was hanging silently. Split into:
- install-deps (DEBIAN_FRONTEND=noninteractive, 5min timeout)
- install binary (5min timeout)
Added job-level timeout-minutes: 20 so hung jobs fail fast.

Refs #144
Copilot AI review requested due to automatic review settings June 1, 2026 01:24
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 15 changed files in this pull request and generated 6 comments.

Comment thread app/package.json Outdated
Comment thread app/packages/desktop-main/package.json Outdated
Comment thread app/package.json Outdated
Comment thread app/packages/desktop-main/package.json Outdated
Comment thread app/package.json Outdated
Comment thread app/packages/desktop-main/package.json Outdated
CoderCoco added 2 commits May 31, 2026 21:32
npx playwright install chromium hangs after download (extraction
phase never exits). ubuntu-latest ships google-chrome-stable; use
channel: 'chrome' in CI so Playwright picks it up with no download.

Drops the browser binary install step from both e2e and integration
workflows. Keeps install-deps for system library requirements.

Refs #144
Ensures apt-get step can't hang silently — the job-level 20min cap
remains as the overall ceiling.

Refs #144
Copilot AI review requested due to automatic review settings June 1, 2026 01:33
video: 'retain-on-failure' requires ffmpeg. Previously it was pulled
in by 'npx playwright install chromium --with-deps' but we switched
to system Chrome. Install ffmpeg explicitly (3min timeout).

Refs #144
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 16 out of 17 changed files in this pull request and generated 1 comment.

Comment thread CLAUDE.md Outdated
npx playwright install hangs post-download on ubuntu-latest regardless
of binary size. Video is not needed in CI — traces retain-on-failure
are sufficient for debugging. Locally video still records on failure.

Refs #144
…on binary in tests

electron-store v11 imports electron at the top of its index.js, so any
require('electron-store') fails in plain-Node environments where the
electron binary hasn't been downloaded (e.g. integration test CI).

Switch the import to `import type` (type-only, no runtime effect) and
use createRequire inside createStore(), which is only called when
readIsElectron() returns true. Plain-Node paths continue to use the
in-memory Map fallback without ever loading electron-store.

Refs #144
Copilot AI review requested due to automatic review settings June 1, 2026 01:49
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 17 out of 18 changed files in this pull request and generated no new comments.

…hs and stale docs

- electron.vite.config.ts: renderer input was 'app/packages/web/index.html' which
  double-prefixed the root; change to 'index.html' (resolved relative to root)
- app/package.json: add --config ../electron.vite.config.ts to dev; fix start to
  launch the built app instead of re-building it
- app/packages/desktop-main/package.json: same --config fix at correct relative depth
- CLAUDE.md: remove stale 'Nest on 3001 / http://localhost:3001' description;
  document that app:dev now launches the Electron desktop app

Refs #144
Co-Authored-By: copilot-pull-request-reviewer (via PR comment)
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 17 out of 18 changed files in this pull request and generated 1 comment.

Comment thread app/packages/desktop-main/src/services/ElectronStoreService.ts Outdated
typeof Store is invalid when Store is an import-type binding — TypeScript
treats it as a value reference even in type positions. Replace the cast
with typeof import('electron-store') which queries the module type directly.

Refs #144
Co-Authored-By: copilot-pull-request-reviewer (via PR comment)
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 17 out of 18 changed files in this pull request and generated 1 comment.

Comment thread app/packages/desktop-main/src/electron-entry.ts Outdated
void-ing the promise dropped renderer-load failures silently. Chain a
.catch() that logs and calls app.quit(), consistent with the bootstrap
failure path. Adds a unit test for the new rejection branch.

Refs #144
Co-Authored-By: copilot-pull-request-reviewer (via PR comment)
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 17 out of 18 changed files in this pull request and generated 4 comments.

Comment thread app/packages/desktop-main/src/services/ElectronStoreService.ts Outdated
Comment thread app/packages/desktop-main/src/services/ElectronStoreService.ts
Comment thread electron.vite.config.ts
Comment thread electron.vite.config.ts
…s to import.meta.url

electron-store@11 is ESM-only — require() throws ERR_REQUIRE_ESM at runtime.
Replace createRequire with a module-level conditional dynamic import guarded
by process.versions.electron; plain-Node tests never trigger the import.

All entrypoint/root paths in electron.vite.config.ts were relative strings
resolved against cwd, breaking workspace invocations with --config. Anchor
every path via fileURLToPath(new URL(p, import.meta.url)) so the config is
cwd-independent.

Refs #144
Co-Authored-By: copilot-pull-request-reviewer (via PR comment)
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 17 out of 18 changed files in this pull request and generated 1 comment.

Comment thread CLAUDE.md Outdated
npm run app:build compiles TypeScript workspaces but does not run
electron-vite, so out/main/index.js is never produced. app:start
(electron out/main/index.js) therefore fails unless desktop:build ran
first. Document the correct three-step production flow.

Refs #144
Co-Authored-By: copilot-pull-request-reviewer (via PR comment)
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 17 out of 18 changed files in this pull request and generated no new comments.

@CoderCoco CoderCoco merged commit 1dac960 into main Jun 3, 2026
9 checks passed
@CoderCoco CoderCoco deleted the claude/issue-144-feat-build-adopt-electron-vite-for-dev-build-pipel branch June 3, 2026 03:18
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.

feat(build): adopt electron-vite for dev + build pipeline

2 participants