chore: bump version to 0.1.5 and add version synchronization script
- Updated version in package.json, Cargo.toml, Cargo.lock, and tauri.conf.json to 0.1.5. - Introduced a new script (sync-version.mjs) to synchronize version across configuration files. - Modified build and release scripts to include version synchronization.
This commit is contained in:
1 parent
fca033fe29
commit
7894e410c4
5 files changed
+36
-6
No files matched your search
+4
-2
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "dragonfly",
|
||||
"private": true,
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.5",
|
||||
"description": "A modern, high-performance SSH client built with Tauri and React.",
|
||||
"author": "CoderKang",
|
||||
"homepage": "https://github.com/CoderKang/Dragonfly",
|
||||
@@ -14,8 +14,10 @@
|
||||
},
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"version-sync": "node scripts/sync-version.mjs",
|
||||
"release": "node scripts/sync-version.mjs --commit && tsc && vite build",
|
||||
"dev": "vite",
|
||||
"build": "tsc && vite build",
|
||||
"build": "node scripts/sync-version.mjs && tsc && vite build",
|
||||
"preview": "vite preview",
|
||||
"tauri": "tauri",
|
||||
"lint": "biome check src/",
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
import { readFileSync, writeFileSync } from 'fs';
|
||||
import { execSync } from 'child_process';
|
||||
|
||||
const pkg = JSON.parse(readFileSync('package.json', 'utf-8'));
|
||||
const version = pkg.version;
|
||||
|
||||
// 同步到 tauri.conf.json
|
||||
const tauriConf = JSON.parse(readFileSync('src-tauri/tauri.conf.json', 'utf-8'));
|
||||
tauriConf.version = version;
|
||||
writeFileSync('src-tauri/tauri.conf.json', JSON.stringify(tauriConf, null, 2) + '\n');
|
||||
|
||||
// 同步到 Cargo.toml(仅替换 [package] 下的 version,不影响依赖项的 version)
|
||||
let cargo = readFileSync('src-tauri/Cargo.toml', 'utf-8');
|
||||
cargo = cargo.replace(
|
||||
/(\[package\]\s*\nname\s*=\s*"[^"]*"\s*\n)version\s*=\s*"[^"]*"/,
|
||||
`$1version = "${version}"`
|
||||
);
|
||||
writeFileSync('src-tauri/Cargo.toml', cargo);
|
||||
|
||||
console.log(`✅ Version synced to ${version}`);
|
||||
|
||||
// 如果传入 --commit 参数,自动提交版本变更
|
||||
if (process.argv.includes('--commit')) {
|
||||
const files = ['package.json', 'src-tauri/tauri.conf.json', 'src-tauri/Cargo.toml'];
|
||||
execSync(`git add ${files.join(' ')}`, { stdio: 'inherit' });
|
||||
execSync(`git commit -m "chore: bump version to v${version}"`, { stdio: 'inherit' });
|
||||
console.log(`✅ Committed: chore: bump version to v${version}`);
|
||||
}
|
||||
Generated
+1
-1
@@ -1237,7 +1237,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "dragonfly"
|
||||
version = "0.1.0"
|
||||
version = "0.1.5"
|
||||
dependencies = [
|
||||
"aes-gcm",
|
||||
"async-http-proxy",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "dragonfly"
|
||||
version = "0.1.0"
|
||||
version = "0.1.5"
|
||||
description = "A Tauri App"
|
||||
authors = ["Kang"]
|
||||
edition = "2021"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"productName": "Dragonfly",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.5",
|
||||
"identifier": "com.kang.dragonfly",
|
||||
"build": {
|
||||
"beforeDevCommand": "pnpm dev",
|
||||
@@ -34,4 +34,4 @@
|
||||
"icons/icon.ico"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user