Phase 3: Electron shell — basic viewer#40
Merged
jamesainslie merged 6 commits intomainfrom Mar 20, 2026
Merged
Conversation
Add packages/electron/ with three-process architecture (main, preload, renderer), electron-vite build config, vitest workspace integration, and convenience scripts in root package.json.
…bridge Implement StorageAdapter (electron-store), FileAdapter (fs + chokidar), IdentityAdapter (os.userInfo), ExportAdapter (dialog + printToPDF). Define typed IPC channels and preload API shape. Wire contextBridge with all 15 channels including event listeners. 32 new tests.
…nderer adapters Wire up full main process with electron-store, chokidar file watching, state management, and 14 IPC handlers. Add renderer-side adapter wrappers that delegate through window.mdview preload bridge. 33 new tests.
Implement MDViewElectronViewer with 6-stage render pipeline, theme engine, TOC, export UI, comments, and auto-reload via chokidar IPC. Copy content.css from chrome-ext (to be consolidated in Phase 4). 5 new viewer tests.
Configure electron-builder with dmg/zip (mac), AppImage (linux), nsis (win) targets and markdown file associations. Add icon generation script and placeholder icons.
Vite's default IIFE worker format doesn't support code-splitting needed by @mdview/core's render-worker. Use ES modules instead.
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
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
packages/electron/— a standalone Electron desktop app that imports@mdview/corewith Electron-native adapter implementationsWhat's included
3.1 Scaffold — package.json, tsconfigs, electron-vite 3-process build config, vitest workspace integration
3.2 Main-process adapters — StorageAdapter (electron-store), FileAdapter (fs/promises + chokidar), IdentityAdapter (os.userInfo), ExportAdapter (showSaveDialog + printToPDF)
3.3 IPC bridge — 17 typed IPC channel constants,
MdviewPreloadAPIinterface, contextBridge preload script with 15 invoke channels + 3 event listeners3.4 Main process + state — StateManager with electron-store persistence, 14 IPC handlers, file watcher lifecycle management, macOS
open-fileevent handling3.5 Renderer adapters — Thin wrappers delegating through
window.mdviewpreload bridge: MessagingAdapter, StorageAdapter, FileAdapter, IdentityAdapter, ExportAdapter3.6 Viewer —
MDViewElectronViewerclass orchestrating: file load → state → theme → 6-stage render pipeline → TOC → export UI → comments → auto-reload → event listeners3.7 Build pipeline — electron-builder config with dmg/zip (mac), AppImage (linux), nsis (win) targets and .md/.markdown file associations
Test plan
npm run test:ci— 1277 tests pass (1207 original + 70 new)npm -w @mdview/electron run build— electron-vite builds all 3 processesnpm -w @mdview/electron run dev— launches Electron window