mirror of
https://github.com/Novattz/creamlinux-installer.git
synced 2026-01-28 06:12:49 -05:00
feat: Started on updates and workflows
This commit is contained in:
29
scripts/sync-version.js
Normal file
29
scripts/sync-version.js
Normal file
@@ -0,0 +1,29 @@
|
||||
const fs = require('fs')
|
||||
const path = require('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!')
|
||||
Reference in New Issue
Block a user