-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate-tauri-version.js
More file actions
26 lines (21 loc) · 860 Bytes
/
Copy pathupdate-tauri-version.js
File metadata and controls
26 lines (21 loc) · 860 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const fs = require("fs");
const path = require("path");
const frontendDir = path.join(__dirname, "validflow-frontend");
const cargoPath = path.join(frontendDir, "src-tauri", "Cargo.toml");
const tauriConfPath = path.join(frontendDir, "src-tauri", "tauri.conf.json");
const pkg = require("./package.json");
const newVersion = pkg.version;
// === Update Cargo.toml ===
let cargoToml = fs.readFileSync(cargoPath, "utf-8");
cargoToml = cargoToml.replace(
/^version\s*=\s*"\d+\.\d+\.\d+"/m,
`version = "${newVersion}"`
);
fs.writeFileSync(cargoPath, cargoToml);
// === Update tauri.conf.json ===
const tauriConf = JSON.parse(fs.readFileSync(tauriConfPath, "utf-8"));
tauriConf.version = newVersion;
fs.writeFileSync(tauriConfPath, JSON.stringify(tauriConf, null, 2));
console.log(
`✅ Synced version to Cargo.toml and tauri.conf.json: ${newVersion}`
);