This commit is contained in:
949036910@qq.com
2026-05-30 18:44:16 +08:00
parent e10a66ccf2
commit 9c6650373f
162 changed files with 624 additions and 26788 deletions

View File

@@ -1,15 +1,20 @@
/**
* 构建前将版本号 patch 段 +1并同步写入 tauri.conf.json / Cargo.toml / package.json
* 构建前将版本号 patch 段 +1并同步写入 tauri.conf.json / Cargo.toml / aiclient_ui / npmrelease
*/
const fs = require("node:fs");
const path = require("node:path");
const tauriDir = path.join(__dirname, "..");
const rootDir = path.join(tauriDir, "..");
const tauriConfPath = path.join(tauriDir, "tauri.conf.json");
const cargoTomlPath = path.join(tauriDir, "Cargo.toml");
const packageJsonPath = path.join(rootDir, "package.json");
const uiPackageJsonPath = path.join(tauriDir, "..", "aiclient_ui", "package.json");
const npmReleasePackageJsonPath = path.join(
tauriDir,
"..",
"..",
"npmrelease",
"package.json",
);
function bumpPatch(version) {
const parts = String(version)
@@ -50,7 +55,14 @@ const conf = JSON.parse(fs.readFileSync(tauriConfPath, "utf8"));
const newVersion = bumpPatch(conf.version);
updateJsonVersion(tauriConfPath, newVersion);
updateJsonVersion(packageJsonPath, newVersion);
if (fs.existsSync(uiPackageJsonPath)) {
updateJsonVersion(uiPackageJsonPath, newVersion);
}
if (fs.existsSync(npmReleasePackageJsonPath)) {
updateJsonVersion(npmReleasePackageJsonPath, newVersion);
} else {
console.warn(`未找到 npmrelease/package.json: ${npmReleasePackageJsonPath}`);
}
updateCargoVersion(cargoTomlPath, newVersion);
console.log(`版本号已更新: ${conf.version} -> ${newVersion}`);