build: add release script, MSI+NSIS dual bundle, artifacts versioned dir
This commit is contained in:
@@ -34,14 +34,21 @@ Tauri 开发模式会先启动 Vite 开发服务器(端口 5173),然后打
|
|||||||
## 构建
|
## 构建
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 1. 构建前端 + Rust 二进制
|
# 构建前端 + Rust 二进制 + 安装包(MSI + NSIS)
|
||||||
npm run tauri build
|
npm run tauri build
|
||||||
|
|
||||||
# 2. 产物位于 src-tauri/target/release/bundle/
|
# 或者一键构建并汇集产物到版本目录
|
||||||
# - Windows: MSI 安装包 (.msi) 或 NSIS 安装程序 (.exe)
|
npm run release
|
||||||
# - 便携版: src-tauri/target/release/ai-grading-assistant.exe
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
产物位于 `src-tauri/target/release/v{版本号}/`:
|
||||||
|
|
||||||
|
| 文件 | 说明 |
|
||||||
|
|------|------|
|
||||||
|
| `AI阅卷助手_v{版本}_x64.exe` | 便携版(免安装,直接运行) |
|
||||||
|
| `AI阅卷助手_{版本}_x64_zh-CN.msi` | MSI 安装包 |
|
||||||
|
| `AI阅卷助手_{版本}_x64-setup.exe` | NSIS 安装程序 |
|
||||||
|
|
||||||
## 项目结构
|
## 项目结构
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -64,6 +71,7 @@ AIGA-Tauri/
|
|||||||
│ ├── icons/ # 应用图标
|
│ ├── icons/ # 应用图标
|
||||||
│ ├── Cargo.toml
|
│ ├── Cargo.toml
|
||||||
│ └── tauri.conf.json
|
│ └── tauri.conf.json
|
||||||
|
├── scripts/ # 构建工具脚本
|
||||||
├── package.json
|
├── package.json
|
||||||
└── README.md
|
└── README.md
|
||||||
```
|
```
|
||||||
|
|||||||
+2
-1
@@ -7,7 +7,8 @@
|
|||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "vue-tsc --noEmit --skipLibCheck && vite build",
|
"build": "vue-tsc --noEmit --skipLibCheck && vite build",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"tauri": "tauri"
|
"tauri": "tauri",
|
||||||
|
"release": "npm run tauri build && node scripts/copy-artifacts.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tauri-apps/api": "^2.0.0",
|
"@tauri-apps/api": "^2.0.0",
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
import { copyFileSync, mkdirSync, readdirSync, existsSync, readFileSync } from 'fs'
|
||||||
|
import { resolve, dirname } from 'path'
|
||||||
|
import { fileURLToPath } from 'url'
|
||||||
|
|
||||||
|
const __dirname = dirname(fileURLToPath(import.meta.url))
|
||||||
|
const root = resolve(__dirname, '..')
|
||||||
|
const pkg = JSON.parse(readFileSync(resolve(root, 'package.json'), 'utf-8'))
|
||||||
|
const ver = pkg.version
|
||||||
|
|
||||||
|
const releaseDir = resolve(root, 'src-tauri/target/release')
|
||||||
|
const outDir = resolve(releaseDir, `v${ver}`)
|
||||||
|
if (!existsSync(outDir)) mkdirSync(outDir, { recursive: true })
|
||||||
|
|
||||||
|
const exe = resolve(releaseDir, 'ai-grading-assistant.exe')
|
||||||
|
if (existsSync(exe)) copyFileSync(exe, resolve(outDir, `AI阅卷助手_v${ver}_x64.exe`))
|
||||||
|
|
||||||
|
const bundleDir = resolve(releaseDir, 'bundle')
|
||||||
|
if (existsSync(bundleDir)) {
|
||||||
|
for (const sub of readdirSync(bundleDir)) {
|
||||||
|
for (const file of readdirSync(resolve(bundleDir, sub))) {
|
||||||
|
copyFileSync(resolve(bundleDir, sub, file), resolve(outDir, file))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(`Artifacts copied to ${outDir}`)
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
"$schema": "https://raw.githubusercontent.com/nicegui-org/nicegui-tauri/main/tauri.conf.schema.json",
|
"$schema": "https://raw.githubusercontent.com/nicegui-org/nicegui-tauri/main/tauri.conf.schema.json",
|
||||||
"productName": "AI阅卷助手",
|
"productName": "AI阅卷助手",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"identifier": "com.ai-grading-assistant.app",
|
"identifier": "com.aigrading.assistant",
|
||||||
"build": {
|
"build": {
|
||||||
"frontendDist": "../dist",
|
"frontendDist": "../dist",
|
||||||
"devUrl": "http://localhost:5173",
|
"devUrl": "http://localhost:5173",
|
||||||
@@ -17,11 +17,17 @@
|
|||||||
},
|
},
|
||||||
"bundle": {
|
"bundle": {
|
||||||
"active": true,
|
"active": true,
|
||||||
"targets": "all",
|
"targets": ["msi", "nsis"],
|
||||||
"icon": [
|
"icon": [
|
||||||
"icons/32x32.png",
|
"icons/32x32.png",
|
||||||
"icons/128x128.png",
|
"icons/128x128.png",
|
||||||
"icons/128x128@2x.png"
|
"icons/128x128@2x.png",
|
||||||
]
|
"icons/icon.ico"
|
||||||
|
],
|
||||||
|
"windows": {
|
||||||
|
"wix": {
|
||||||
|
"language": "zh-CN"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user