feat: Add NSIS installer target and persistent SQLite storage

- Add NSIS installer as default target (--target nsis)
- Keep portable option available (--target portable)
- Store SQLite database in %APPDATA%\Meeting-Assistant for persistence
- Portable temp folder cleanup no longer affects SQLite data
- Update build-client.bat with --target parameter support
- Update DEPLOYMENT.md with new options and comparisons

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
egg
2025-12-18 08:13:32 +08:00
parent bc37a5392a
commit 08cffbb74a
4 changed files with 113 additions and 17 deletions

View File

@@ -238,11 +238,14 @@ npm start
### 打包方式
```batch
# Windows 全包打包(MySQL 雲端資料庫,預設
# Windows 全包打包(NSIS 安裝檔,推薦
.\scripts\build-client.bat build --embedded-backend --clean
# Windows 全包打包SQLite 本地資料庫,適合離線/防火牆環境)
.\scripts\build-client.bat build --embedded-backend --database-type sqlite --clean
# Windows 全包打包Portable 免安裝,注意臨時資料夾限制)
.\scripts\build-client.bat build --embedded-backend --target portable --clean
```
**打包參數說明:**
@@ -251,8 +254,18 @@ npm start
|------|------|
| `--embedded-backend` | 啟用內嵌後端模式 |
| `--database-type TYPE` | 資料庫類型:`mysql`(雲端)或 `sqlite`(本地) |
| `--target TARGET` | 打包目標:`nsis`(安裝檔,預設)或 `portable`(免安裝) |
| `--clean` | 建置前清理所有暫存檔案 |
### 打包目標比較
| 特性 | NSIS 安裝檔(推薦) | Portable 免安裝 |
|------|---------------------|-----------------|
| 安裝方式 | 執行安裝精靈 | 直接執行 |
| 資料持久性 | ✅ 安裝目錄內持久保存 | ⚠️ 臨時資料夾關閉後清空 |
| SQLite 位置 | 安裝目錄/data/ | %APPDATA%\Meeting-Assistant |
| 適用場景 | 正式部署 | 快速測試、展示 |
### config.json 配置
全包模式需要在 `config.json` 中配置資料庫和 API 金鑰:
@@ -334,7 +347,9 @@ npm start
}
```
> **注意**SQLite 模式下,資料庫檔案位於 `%TEMP%\Meeting-Assistant\resources\backend\backend\data\meeting.db`
> **注意**SQLite 資料庫位置會根據打包目標不同:
> - **NSIS 安裝檔**:安裝目錄內的 `data/meeting.db`
> - **Portable**`%APPDATA%\Meeting-Assistant\data\meeting.db`(持久保存,不會因關閉程式而清空)
### 配置說明
@@ -359,12 +374,14 @@ npm start
| 適用場景 | 企業部署、多人共用 | 離線環境、防火牆限制 |
| 資料備份 | 使用資料庫工具 | 複製 `.db` 檔案即可 |
### Portable 執行檔解壓縮位置
### Portable 執行檔說明
Portable exe 執行時會解壓縮到 `%TEMP%\Meeting-Assistant` 資料夾(固定路徑,非隨機資料夾)。
- **優點**Windows Defender 不會每次都提示警告
- **SQLite 資料庫位置**`%TEMP%\Meeting-Assistant\resources\backend\backend\data\meeting.db`
- **注意**:關閉程式後,臨時資料夾會被清空
- **SQLite 資料庫位置**:自動儲存到 `%APPDATA%\Meeting-Assistant\data\meeting.db`(不會被清空)
- **建議**:正式部署請使用 NSIS 安裝檔(`--target nsis`,預設)
### 啟動流程
@@ -456,10 +473,13 @@ SHOW TABLES LIKE 'meeting_%';
SQLite 資料庫檔案會在首次啟動時自動建立:
- **開發環境**`backend/data/meeting.db`
- **打包後**`%TEMP%\Meeting-Assistant\resources\backend\backend\data\meeting.db`
- **NSIS 安裝檔**:安裝目錄內的 `data/meeting.db`
- **Portable**`%APPDATA%\Meeting-Assistant\data\meeting.db`
**備份方式**:直接複製 `.db` 檔案即可。
> **注意**Portable 模式下SQLite 資料庫自動儲存到 `%APPDATA%` 以確保持久性(不會因關閉程式而清空)。
### Expected tables
- `meeting_users`