Skip to content

refactor(build): extract Electron shell to apps/desktop#216

Merged
luokerenx4 merged 2 commits into
masterfrom
local
May 26, 2026
Merged

refactor(build): extract Electron shell to apps/desktop#216
luokerenx4 merged 2 commits into
masterfrom
local

Conversation

@luokerenx4
Copy link
Copy Markdown
Contributor

Summary

Pull electron + electron-builder out of root devDeps into a dedicated @traderalice/desktop workspace package, so cloud Claude Code sessions (and anyone who doesn't need to pack a desktop installer) skip ~1G of Chromium / app-builder-bin install weight.

Acknowledges the structural reality that the Electron shell is a release artifact — not a runtime dependency of Alice. Sets up the same boundary that a future "UI-only" install profile (for the planned frontend test-mode) would naturally use.

What changed

  • New: apps/desktop/ workspace package owns electron, electron-builder, and the 4 source files (main.ts / preload.ts / probe-port.ts / probe-port.spec.ts)
  • pnpm-workspace.yaml: apps/* added
  • Root package.json: dropped electron devDeps; the 4 electron:* scripts forward to pnpm -F @traderalice/desktop ...; main field + electron-builder build block stay at root so packaging behavior is identical
  • vitest.config.ts: spec glob electron/**apps/**
  • Comment-only path updates in src/core/paths.ts and scripts/probe-port.ts

Behavior preserved

  • Output: dist/electron/{main,preload,probe-port}.js — same paths as before (apps/desktop's tsconfig points outDir back at root's dist/electron/)
  • pnpm electron:dev / pnpm electron:pack — same commands, forwarders work
  • electron-builder still reads package.json#build at root (invoked with --projectDir ../.. from desktop pkg)
  • One tiny dev-mode adjustment: main.ts now pins OPENALICE_HOME/OPENALICE_APP_HOME to the repo root explicitly (was implicit via cwd before the script-forwarder indirection)

Numbers

Install mode node_modules size
Before split, full install 1.7G
After split, cloud filter (pnpm install --filter='!@traderalice/desktop') 748M (-1G)
After split, full install (local dev) 1.2G + Electron.app 253M

Test plan

  • npx tsc --noEmit clean
  • pnpm -F @traderalice/desktop typecheck clean
  • cd ui && npx tsc -b clean
  • pnpm test — 97 files / 1789 tests passed
  • pnpm electron:tsc — produces expected dist/electron/*.js
  • pnpm -F @traderalice/desktop exec electron --version resolves to v38.8.6
  • pnpm -F @traderalice/desktop exec electron-builder --version resolves to 25.1.8
  • rm -rf node_modules && pnpm install --filter='!@traderalice/desktop' → 748M, zero electron / electron-builder / app-builder-bin in .pnpm
  • Manual: pnpm electron:dev end-to-end (didn't launch GUI in this session — defer to next local dev session)
  • Manual: pnpm electron:pack produces a working app bundle (release-only, deferred)

Boundary touch

None — no trading / auth / broker / migrations code touched.

🤖 Generated with Claude Code

Ame and others added 2 commits May 26, 2026 16:56
Move electron source + electron-builder config from root into a dedicated
workspace package (@traderalice/desktop). Root `pnpm install` no longer
pulls electron's ~1G of Chromium binaries + app-builder-bin; cloud Claude
Code sessions can opt out with `pnpm install --filter='!@traderalice/desktop'`
for a 1.7G → 748M install.

Behavior preserved:
- dist/electron/ and dist/main.js output paths unchanged
- pnpm electron:dev / electron:pack work via forwarders to the desktop pkg
- electron-builder reads root package.json via --projectDir ../.. so the
  packaged-app file layout is identical
- Dev backend home pinned to repo root explicitly in main.ts (replaces
  the implicit cwd=root that the old direct-electron invocation relied on)

Verified:
- npx tsc --noEmit clean
- pnpm test 97 files / 1789 tests passed
- pnpm -F @traderalice/desktop typecheck clean
- pnpm electron:tsc produces dist/electron/{main,preload,probe-port}.js
- Filtered install confirmed 748M with zero electron/app-builder-bin in .pnpm

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ions

Surface the slim-install command in Quick Start so cloud Claude Code
sessions pick it up immediately instead of defaulting to the full 1.7G
install.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@luokerenx4 luokerenx4 merged commit 65d586e into master May 26, 2026
1 check passed
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.

1 participant