feat(构建): 添加生成关于页面内容的脚本并更新构建流程

添加 generate-about-content.mjs 脚本用于从 README.md 生成关于页面内容
修改构建命令在 vite 构建前执行生成脚本
更新版本号同步逻辑以包含 tauri 配置和 Cargo.toml
在设置页面新增关于内容展示功能
This commit is contained in:
Yukino_fox
2026-03-28 13:20:28 +08:00
parent 0a689cc2d8
commit 2004516075
4 changed files with 116 additions and 5 deletions
+10
View File
@@ -70,3 +70,13 @@ const pkgPath = path.join(process.cwd(), "package.json")
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"))
pkg.version = version
fs.writeFileSync(pkgPath, `${JSON.stringify(pkg, null, 2)}\n`, "utf-8")
const tauriConfPath = path.join(process.cwd(), "src-tauri", "tauri.conf.json")
const tauriConf = JSON.parse(fs.readFileSync(tauriConfPath, "utf-8"))
tauriConf.version = version
fs.writeFileSync(tauriConfPath, `${JSON.stringify(tauriConf, null, 2)}\n`, "utf-8")
const cargoPath = path.join(process.cwd(), "src-tauri", "Cargo.toml")
let cargoContent = fs.readFileSync(cargoPath, "utf-8")
cargoContent = cargoContent.replace(/^version = "[^"]+"/m, `version = "${version}"`)
fs.writeFileSync(cargoPath, cargoContent, "utf-8")