Skip to content

Commit 7c9e693

Browse files
committed
Added electron compilation
1 parent 937e41d commit 7c9e693

File tree

9 files changed

+4271
-53
lines changed

9 files changed

+4271
-53
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ node_modules
1111
dist
1212
dist-ssr
1313
dist-electron
14+
release
1415
*.local
1516

1617
# Editor directories and files

DESKTOP_BUILD_GUIDE.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
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

Comments
 (0)