5.1 KiB
Electron Build Documentation
Welcome to the Shakespeare Electron build documentation! This directory contains everything needed to build and run Shakespeare as a native desktop application.
📚 Documentation Index
Getting Started
- QUICKSTART.md - Quick start guide for building and running Electron builds
- Development mode setup
- Building for distribution
- Platform-specific instructions
- Icon generation
Integration
- INTEGRATION.md - Guide for integrating Electron features into Shakespeare
- Detecting Electron environment
- Using the Electron API
- Adding new features
- Security best practices
- Code examples
Troubleshooting
- TROUBLESHOOTING.md - Solutions to common issues
- Development issues
- Build issues
- Runtime issues
- Platform-specific problems
Technical Reference
- README.md - Complete technical documentation
- File structure
- Build configuration
- Security implementation
- Customization options
- ESM.md - Why we use ES Modules (ESM) instead of CommonJS
- Benefits and rationale
- Examples and patterns
- Migration guide
🗂️ File Structure
electron/
├── INDEX.md # This file - documentation index
├── README.md # Complete technical documentation
├── QUICKSTART.md # Quick start guide
├── INTEGRATION.md # Integration guide for developers
├── TROUBLESHOOTING.md # Troubleshooting guide
├── main.js # Electron main process (ESM)
├── preload.js # Preload script (ESM)
├── builder.config.js # electron-builder configuration (ESM)
├── electron.d.ts # TypeScript definitions for Electron API
├── generate-icons.sh # Script to generate platform icons
├── test-config.js # Configuration validation script (ESM)
└── resources/ # Build resources (icons, etc.)
└── .gitkeep
🚀 Quick Commands
# Development
npm run electron:dev # Run in development mode
# Building
npm run electron:build # Build for current platform
npm run electron:build:mac # Build for macOS
npm run electron:build:win # Build for Windows
npm run electron:build:linux # Build for Linux
npm run electron:build:all # Build for all platforms
# Utilities
npm run electron:icons # Generate icons from Shakespeare logo
🎯 What You Need to Know
For Users
- Read QUICKSTART.md to build and run the app
- Check TROUBLESHOOTING.md if you encounter issues
For Developers
- Start with QUICKSTART.md for basic setup
- Read INTEGRATION.md to add Electron features
- Refer to README.md for technical details
- Use TROUBLESHOOTING.md when debugging
🔒 Security
The Electron build implements security best practices:
- Context isolation enabled (primary security boundary)
- Sandbox mode disabled (required for ESM preload scripts)
- Node integration disabled
- Minimal API surface through preload script
- Navigation and window opening restrictions
See README.md for complete security details.
🎨 Icons
Before building for distribution, generate platform-specific icons:
npm run electron:icons
This requires ImageMagick. Alternatively, use online tools or electron-icon-builder.
See QUICKSTART.md for details.
📦 Build Output
Built applications are placed in electron-dist/:
- macOS:
.dmginstaller and.appbundle - Windows: NSIS installer and portable
.exe - Linux: AppImage,
.deb, and.rpmpackages
🆘 Need Help?
-
Check the documentation files in order:
-
Search existing issues on GitLab
-
Create a new issue with:
- OS and version
- Steps to reproduce
- Error messages
- Relevant logs
🔄 Updating
When updating the Electron build:
- Update Electron version:
npm install electron@latest --save-dev - Update electron-builder:
npm install electron-builder@latest --save-dev - Test thoroughly on all target platforms
- Update documentation if APIs change
🌟 Features
Current Electron features:
- ✅ Platform detection
- ✅ App version info
- ✅ Secure IPC bridge
- ✅ External link handling
- ✅ Native window management
Potential future features (see README.md):
- Auto-updates
- Native menus
- System tray
- File associations
- Native dialogs
📝 Contributing
When contributing to the Electron build:
- Keep the web version working - it should not depend on Electron
- Use progressive enhancement - Electron features should be optional
- Follow security best practices
- Update documentation
- Test on all platforms if possible
📄 License
The Electron build is part of Shakespeare and is licensed under GNU AGPLv3.