Files
creamlinux-installer/scripts/sync-version.js
Tickbase 3f5e1c3fd7 dumb
2025-05-18 21:13:06 +02:00

30 lines
1.1 KiB
JavaScript

import fs from 'node:fs'
import path from 'node:path'
// Read current version from package.json
const packageJsonPath = path.join(__dirname, '..', 'package.json')
const packageJson = require(packageJsonPath)
const version = packageJson.version
console.log(`Current version: ${version}`)
// Update Cargo.toml
const cargoTomlPath = path.join(__dirname, '..', 'src-tauri', 'Cargo.toml')
let cargoToml = fs.readFileSync(cargoTomlPath, 'utf8')
// Replace the version in Cargo.toml
cargoToml = cargoToml.replace(/version\s*=\s*"[^"]+"/m, `version = "${version}"`)
fs.writeFileSync(cargoTomlPath, cargoToml)
console.log(`Updated Cargo.toml version to ${version}`)
// Update tauri.conf.json
const tauriConfigPath = path.join(__dirname, '..', 'src-tauri', 'tauri.conf.json')
const tauriConfig = JSON.parse(fs.readFileSync(tauriConfigPath, 'utf8'))
// Set the version in tauri.conf.json
tauriConfig.version = version
fs.writeFileSync(tauriConfigPath, JSON.stringify(tauriConfig, null, 2))
console.log(`Updated tauri.conf.json version to ${version}`)
console.log('Version synchronization completed!')