|
| 1 | +# Emerald UI - Desktop & Web App |
| 2 | + |
| 3 | +This project supports both web deployment and desktop application builds using Electron. |
| 4 | + |
| 5 | +## Available Build Commands |
| 6 | + |
| 7 | +### Web Version (GitHub Pages) |
| 8 | +```bash |
| 9 | +# Development |
| 10 | +npm run dev |
| 11 | + |
| 12 | +# Build for web deployment |
| 13 | +npm run build |
| 14 | + |
| 15 | +# Preview web build |
| 16 | +npm run preview |
| 17 | + |
| 18 | +# Deploy to GitHub Pages |
| 19 | +npm run deploy |
| 20 | +``` |
| 21 | + |
| 22 | +### Desktop Version (Electron) |
| 23 | +```bash |
| 24 | +# Development with hot reload |
| 25 | +npm run electron:dev |
| 26 | + |
| 27 | +# Build desktop app files |
| 28 | +npm run build:desktop |
| 29 | + |
| 30 | +# Run desktop app (after building) |
| 31 | +npm run electron |
| 32 | + |
| 33 | +# Package desktop app for distribution |
| 34 | +npm run electron:pack # Creates unpacked app in dist/ |
| 35 | +npm run electron:build # Creates installer packages |
| 36 | +``` |
| 37 | + |
| 38 | +## Architecture |
| 39 | + |
| 40 | +### Dual Build System |
| 41 | +- **Web build**: Uses `vite build` with GitHub Pages base URL |
| 42 | +- **Desktop build**: Uses `vite build --mode electron` with relative paths for Electron |
| 43 | + |
| 44 | +### Directory Structure |
| 45 | +``` |
| 46 | +dist/ # Web build output |
| 47 | +dist-electron/ # Electron build output |
| 48 | +├── main.js # Electron main process |
| 49 | +└── preload.js # Electron preload script |
| 50 | +src-electron/ # Electron source files |
| 51 | +├── main.ts # Main process (window management) |
| 52 | +└── preload.ts # Preload script (security layer) |
| 53 | +``` |
| 54 | + |
| 55 | +### Key Features |
| 56 | +- **Cross-platform**: Builds for Windows, macOS, and Linux |
| 57 | +- **Security**: Uses context isolation and disabled node integration |
| 58 | +- **Development**: Hot reload support for Electron development |
| 59 | +- **Packaging**: Automated installer creation with electron-builder |
| 60 | + |
| 61 | +## Development Workflow |
| 62 | + |
| 63 | +### For Web Development |
| 64 | +1. `npm run dev` - Start development server |
| 65 | +2. Make changes to React components |
| 66 | +3. `npm run build` - Build for production |
| 67 | +4. `npm run deploy` - Deploy to GitHub Pages |
| 68 | + |
| 69 | +### For Desktop Development |
| 70 | +1. `npm run electron:dev` - Start Electron with hot reload |
| 71 | +2. Make changes to React components or Electron files |
| 72 | +3. App automatically reloads on React changes |
| 73 | +4. For Electron file changes, restart the command |
| 74 | + |
| 75 | +### Building for Distribution |
| 76 | +1. `npm run build:desktop` - Build all components |
| 77 | +2. `npm run electron:build` - Create installers |
| 78 | +3. Find packages in `release/` directory |
| 79 | + |
| 80 | +## Platform-Specific Builds |
| 81 | +- **Windows**: Creates NSIS installer (.exe) |
| 82 | +- **macOS**: Creates DMG package (.dmg) for both Intel and Apple Silicon |
| 83 | +- **Linux**: Creates AppImage (.AppImage) |
| 84 | + |
| 85 | +## Configuration |
| 86 | +- **Electron settings**: `package.json` build section |
| 87 | +- **Web settings**: `vite.config.ts` |
| 88 | +- **Electron main process**: `src-electron/main.ts` |
| 89 | +- **Electron preload**: `src-electron/preload.ts` |
0 commit comments