refactor(build): extract Electron shell to apps/desktop#216
Merged
Conversation
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>
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Pull
electron+electron-builderout of root devDeps into a dedicated@traderalice/desktopworkspace 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
apps/desktop/workspace package ownselectron,electron-builder, and the 4 source files (main.ts/preload.ts/probe-port.ts/probe-port.spec.ts)pnpm-workspace.yaml:apps/*addedpackage.json: dropped electron devDeps; the 4electron:*scripts forward topnpm -F @traderalice/desktop ...;mainfield + electron-builderbuildblock stay at root so packaging behavior is identicalvitest.config.ts: spec globelectron/**→apps/**src/core/paths.tsandscripts/probe-port.tsBehavior preserved
dist/electron/{main,preload,probe-port}.js— same paths as before (apps/desktop's tsconfig pointsoutDirback at root'sdist/electron/)pnpm electron:dev/pnpm electron:pack— same commands, forwarders workpackage.json#buildat root (invoked with--projectDir ../..from desktop pkg)main.tsnow pinsOPENALICE_HOME/OPENALICE_APP_HOMEto the repo root explicitly (was implicit via cwd before the script-forwarder indirection)Numbers
pnpm install --filter='!@traderalice/desktop')Test plan
npx tsc --noEmitcleanpnpm -F @traderalice/desktop typecheckcleancd ui && npx tsc -bcleanpnpm test— 97 files / 1789 tests passedpnpm electron:tsc— produces expecteddist/electron/*.jspnpm -F @traderalice/desktop exec electron --versionresolves to v38.8.6pnpm -F @traderalice/desktop exec electron-builder --versionresolves to 25.1.8rm -rf node_modules && pnpm install --filter='!@traderalice/desktop'→ 748M, zero electron / electron-builder / app-builder-bin in.pnpmpnpm electron:devend-to-end (didn't launch GUI in this session — defer to next local dev session)pnpm electron:packproduces a working app bundle (release-only, deferred)Boundary touch
None — no trading / auth / broker / migrations code touched.
🤖 Generated with Claude Code