|
1 | | -# Edge AI Studio - Electron App |
| 1 | +# Edge AI Studio - Electron Builder Version |
2 | 2 |
|
3 | | -This directory contains the Electron application for Edge AI Studio. |
| 3 | +This directory contains the Electron Builder implementation of Edge AI Studio, running in parallel with the Electron Forge version for comparison and testing. |
4 | 4 |
|
5 | | -## Development |
| 5 | +## Differences from Electron Forge |
6 | 6 |
|
7 | | -### Prerequisites |
| 7 | +| Feature | Electron Forge | Electron Builder | |
| 8 | +|---------|---------------|------------------| |
| 9 | +| Configuration | `forge.config.js` | `build` in `package.json` | |
| 10 | +| Package Command | `electron-forge package` | `electron-builder --dir` | |
| 11 | +| Make Command | `electron-forge make` | `electron-builder` | |
| 12 | +| Dependencies | Multiple `@electron-forge/*` packages | Single `electron-builder` package | |
8 | 13 |
|
9 | | -Before starting, ensure you have the following installed: |
| 14 | +## Setup |
10 | 15 |
|
11 | | -- **Node.js** and **npm** |
| 16 | +From the project root, run: |
12 | 17 |
|
13 | | -If you're behind a proxy, export the following environment variable before installing dependencies: |
| 18 | +```bash |
| 19 | +# Linux/macOS |
| 20 | +./setup.sh |
14 | 21 |
|
15 | | -For Linux/macOS: |
| 22 | +# Windows PowerShell |
| 23 | +./setup.ps1 |
| 24 | +``` |
| 25 | + |
| 26 | +Or setup just this directory: |
16 | 27 |
|
17 | 28 | ```bash |
18 | | -export ELECTRON_GET_USE_PROXY=http://proxy:port |
| 29 | +# Linux/macOS |
| 30 | +cd electron-builder |
| 31 | +./setup.sh |
| 32 | + |
| 33 | +# Windows PowerShell |
| 34 | +cd electron-builder |
| 35 | +./setup.ps1 |
19 | 36 | ``` |
20 | 37 |
|
21 | | -For Windows (PowerShell): |
| 38 | +## Development |
| 39 | + |
| 40 | +### Start in Development Mode |
22 | 41 |
|
23 | | -```powershell |
24 | | -$env:ELECTRON_GET_USE_PROXY="http://proxy:port" |
| 42 | +```bash |
| 43 | +cd electron-builder |
| 44 | +npm start |
25 | 45 | ``` |
26 | 46 |
|
| 47 | +This will launch the Electron app pointing to your local frontend server. |
27 | 48 |
|
28 | | -### Starting the Electron App |
| 49 | +## Building |
29 | 50 |
|
30 | | -To start the Electron app in development mode: |
| 51 | +### Build Package Directory (No Installer) |
31 | 52 |
|
32 | 53 | ```bash |
33 | | -npm run start |
| 54 | +cd electron-builder |
| 55 | +npm run build:dir |
34 | 56 | ``` |
35 | 57 |
|
36 | | -### Packaging the Electron App |
| 58 | +This creates an unpacked directory at `../out/linux-unpacked/` (or `win-unpacked` on Windows). |
37 | 59 |
|
38 | | -To package the Electron app for distribution: |
| 60 | +### Build Distributable |
39 | 61 |
|
40 | 62 | ```bash |
41 | | -npm run make |
42 | | -``` |
| 63 | +# Linux |
| 64 | +npm run build:linux |
43 | 65 |
|
44 | | -**Note:** Before running `npm run make`, ensure that all dependencies are set up properly by running the package script: |
| 66 | +# Windows |
| 67 | +npm run build:win |
45 | 68 |
|
46 | | -```bash |
47 | | -../scripts/package.sh |
| 69 | +# Both |
| 70 | +npm run build |
48 | 71 | ``` |
49 | 72 |
|
50 | | -This script will help ensure all dependencies are installed and configured correctly before packaging. |
| 73 | +This creates distributable installers: |
| 74 | +- **Linux**: ZIP and DEB files |
| 75 | +- **Windows**: Squirrel installer |
| 76 | + |
| 77 | +Output is in `../out/`. |
| 78 | + |
| 79 | +## Configuration |
| 80 | + |
| 81 | +The build configuration is in `package.json` under the `build` key. Key settings: |
| 82 | + |
| 83 | +- **appId**: `com.intel.edge-ai-studio` |
| 84 | +- **productName**: `EdgeAIStudio` |
| 85 | +- **extraResources**: Copies `frontend`, `workers`, and `scripts` from `../build/` |
| 86 | +- **electronFuses**: Same security settings as Forge version |
| 87 | +- **Linux targets**: ZIP and DEB |
| 88 | +- **Windows targets**: Squirrel |
51 | 89 |
|
52 | | -## Running on Ubuntu 24.04 |
| 90 | +## Package Script |
53 | 91 |
|
54 | | -If you're running the packaged Electron app on Ubuntu 24.04, you may need to adjust AppArmor settings to allow the application to run properly: |
| 92 | +To use the automated package script (similar to Forge): |
55 | 93 |
|
56 | 94 | ```bash |
57 | | -sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 |
| 95 | +cd ../scripts |
| 96 | +./package-builder.sh |
58 | 97 | ``` |
59 | 98 |
|
60 | | -This command disables AppArmor restrictions on unprivileged user namespaces, which is required for Electron apps to function correctly on Ubuntu 24.04. |
| 99 | +This will: |
| 100 | +1. Create `../build/` directory |
| 101 | +2. Copy workers (excluding `.venv`, `__pycache__`, etc.) |
| 102 | +3. Copy scripts |
| 103 | +4. Build frontend |
| 104 | +5. Run `electron-builder` |
| 105 | +6. Create final ZIP package |
| 106 | + |
| 107 | +## Comparing with Forge |
| 108 | + |
| 109 | +Both versions are functionally identical. You can test both to compare: |
| 110 | + |
| 111 | +1. **Build time**: Which is faster? |
| 112 | +2. **Package size**: Any difference in final output? |
| 113 | +3. **Ease of use**: Which configuration is clearer? |
| 114 | +4. **Features**: Any missing capabilities? |
| 115 | + |
| 116 | +## Migration Status |
61 | 117 |
|
62 | | -## Project Structure |
| 118 | +✅ **Completed**: |
| 119 | +- Package.json with build configuration |
| 120 | +- All source files (main.js, preload.js, splash files) |
| 121 | +- Setup scripts (Linux & Windows) |
| 122 | +- Electron Fuses configuration |
| 123 | +- Extra resources configuration |
63 | 124 |
|
64 | | -- `main.js` - Main Electron process |
65 | | -- `preload.js` - Preload script for renderer process |
66 | | -- `splash.html` - Splash screen HTML |
67 | | -- `splash.js` - Splash screen JavaScript |
68 | | -- `forge.config.js` - Electron Forge configuration |
69 | | -- `logs/` - Application log files |
| 125 | +📋 **To Do**: |
| 126 | +- Create package script for automated builds |
| 127 | +- Test on Windows |
| 128 | +- Compare output with Forge version |
70 | 129 |
|
71 | | -## Prerequisites |
| 130 | +## Notes |
72 | 131 |
|
73 | | -Make sure you have Node.js and npm installed before running the commands above. |
| 132 | +- The `main.js` file is identical to the Forge version |
| 133 | +- Output directory is shared (`../out/`) but different subdirectories |
| 134 | +- Both versions can coexist without conflicts |
0 commit comments