🎉 init: 小龙的工作空间

This commit is contained in:
大海
2026-06-06 10:40:48 +08:00
commit a188ee1426
3201 changed files with 231817 additions and 0 deletions
+82
View File
@@ -0,0 +1,82 @@
# noteapp — Desktop
> Electron desktop application wrapping the noteapp fullstack web project.
## Architecture
```
Web Fullstack Project
×
Desktop Shell (Electron)
=
Desktop Application
```
- **Main Process** — Window management, menu, tray, IPC, auto-update
- **Preload** — Secure bridge between main and renderer
- **Renderer** — Your existing web frontend (Next.js)
## Development
```bash
# Install dependencies
npm install
# Start dev mode (web + api + electron concurrently)
npm run dev
```
Dev mode:
- Web frontend: `http://localhost:3000`
- API backend: `http://localhost:3001`
- Electron loads the web URL directly
## Build
```bash
# Build for current platform
npm run build
# Platform-specific builds
npm run build:electron:mac
npm run build:electron:win
npm run build:electron:linux
```
Output: `release/` directory with platform installers.
## Project Structure
```
electron/
├── main.ts — Main process (BrowserWindow, Menu, lifecycle)
├── preload.ts — Secure IPC bridge (contextBridge)
├── ipc.ts — IPC handlers (dialogs, store, notifications)
├── tray.ts — System tray
├── updater.ts — Auto-update (electron-updater)
└── utils.ts — Shared utilities
```
## IPC API (available in renderer)
```typescript
window.electronAPI.getAppVersion()
window.electronAPI.getPlatform()
window.electronAPI.minimizeWindow()
window.electronAPI.maximizeWindow()
window.electronAPI.closeWindow()
window.electronAPI.openFile(options?)
window.electronAPI.saveFile(options?)
window.electronAPI.showNotification(title, body)
window.electronAPI.openExternal(url)
window.electronAPI.storeGet(key)
window.electronAPI.storeSet(key, value)
window.electronAPI.checkForUpdates()
window.electronAPI.downloadUpdate()
window.electronAPI.quitAndInstall()
```
## Auto Update
Configured via `electron-builder.yml`. Uses `electron-updater` with generic provider.
Set your release URL in the `publish` section.