Skip to content

Commit 30ec27c

Browse files
committed
feat (core): 添加自动化版本脚本
1 parent 5dc13cb commit 30ec27c

5 files changed

Lines changed: 37 additions & 4 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "codeforge",
33
"private": true,
4-
"version": "25.0.0",
4+
"version": "25.0.1",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",

scripts/bump-version.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env node
2+
import fs from 'fs';
3+
import path from 'path';
4+
import {fileURLToPath} from 'url';
5+
6+
const __filename = fileURLToPath(import.meta.url);
7+
const __dirname = path.dirname(__filename);
8+
9+
const newVersion = process.argv[2];
10+
if (!newVersion) {
11+
console.error('请提供新版本号: node scripts/bump-version.js 25.0.1');
12+
process.exit(1);
13+
}
14+
15+
// 更新 package.json
16+
const packagePath = path.join(__dirname, '../package.json');
17+
const packageJson = JSON.parse(fs.readFileSync(packagePath, 'utf8'));
18+
packageJson.version = newVersion;
19+
fs.writeFileSync(packagePath, JSON.stringify(packageJson, null, 2) + '\n');
20+
21+
// 更新 Cargo.toml
22+
const cargoPath = path.join(__dirname, '../src-tauri/Cargo.toml');
23+
let cargoContent = fs.readFileSync(cargoPath, 'utf8');
24+
cargoContent = cargoContent.replace(/^version = ".*"$/m, `version = "${newVersion}"`);
25+
fs.writeFileSync(cargoPath, cargoContent);
26+
27+
// 更新 tauri.conf.json
28+
const tauriConfigPath = path.join(__dirname, '../src-tauri/tauri.conf.json');
29+
const tauriConfig = JSON.parse(fs.readFileSync(tauriConfigPath, 'utf8'));
30+
tauriConfig.version = newVersion;
31+
fs.writeFileSync(tauriConfigPath, JSON.stringify(tauriConfig, null, 2) + '\n');
32+
33+
console.log(`✅ 版本已更新为 ${newVersion}`);

src-tauri/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src-tauri/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "CodeForge"
3-
version = "25.0.0"
3+
version = "25.0.1"
44
description = "CodeForge 是一款轻量级、高性能的桌面代码执行器,专为开发者、学生和编程爱好者设计。"
55
authors = ["devlive-community"]
66
edition = "2024"

src-tauri/tauri.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://schema.tauri.app/config/2",
33
"productName": "CodeForge",
4-
"version": "25.0.0",
4+
"version": "25.0.1",
55
"identifier": "org.devlive.codeforge",
66
"build": {
77
"beforeDevCommand": "pnpm dev",

0 commit comments

Comments
 (0)