chore: ✏️ 升级版本+升级版本的脚本
This commit is contained in:
58
build/updateVersion.js
Normal file
58
build/updateVersion.js
Normal file
@@ -0,0 +1,58 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
|
||||
// 从命令行参数获取版本号
|
||||
const args = process.argv.slice(2);
|
||||
let version = args[0];
|
||||
|
||||
if (!version) {
|
||||
console.error('错误: 请提供版本号作为参数');
|
||||
console.error('用法: node build/updateVersion.js <version>');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// 验证版本号格式 (遵循语义化版本号格式,如 x.y.z)
|
||||
const versionRegex = /^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/;
|
||||
if (!versionRegex.test(version)) {
|
||||
console.error(`错误: 版本号格式不正确: ${version}`);
|
||||
console.error('正确的版本号格式示例: 1.0.0, 2.1.3, 0.5.0-beta 等');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// 更新 package.json
|
||||
const packageJsonPath = path.join(__dirname, '..', 'package.json');
|
||||
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
||||
packageJson.version = version;
|
||||
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
|
||||
|
||||
// 读取并更新 tauri.conf.json
|
||||
const tauriConfPath = path.join(__dirname, '..', 'src-tauri', 'tauri.conf.json');
|
||||
const tauriConf = JSON.parse(fs.readFileSync(tauriConfPath, 'utf8'));
|
||||
|
||||
// 更新版本号
|
||||
tauriConf.version = version;
|
||||
|
||||
// 写回 tauri.conf.json
|
||||
fs.writeFileSync(tauriConfPath, JSON.stringify(tauriConf, null, 2));
|
||||
|
||||
// 读取并更新 Cargo.toml
|
||||
const cargoTomlPath = path.join(__dirname, '..', 'src-tauri', 'Cargo.toml');
|
||||
let cargoToml = fs.readFileSync(cargoTomlPath, 'utf8');
|
||||
|
||||
// 使用正则表达式替换版本号
|
||||
cargoToml = cargoToml.replace(
|
||||
/^(\s*version\s*=\s*["'])([^"']*)(["']\s*)$/m,
|
||||
`$1${version}$3`
|
||||
);
|
||||
|
||||
// 写回 Cargo.toml
|
||||
fs.writeFileSync(cargoTomlPath, cargoToml);
|
||||
|
||||
console.log(`版本号已更新至: ${version}`);
|
||||
console.log(`- package.json`);
|
||||
console.log(`- tauri.conf.json`);
|
||||
console.log(`- Cargo.toml`);
|
||||
223
package.json
223
package.json
@@ -1,113 +1,114 @@
|
||||
{
|
||||
"name": "log-lottery",
|
||||
"private": true,
|
||||
"version": "0.5.0",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"dev": "vite --host 0.0.0.0",
|
||||
"build": "vue-tsc --noEmit && vite build",
|
||||
"build:pre": "vue-tsc --noEmit && vite build --mode prebuild",
|
||||
"build:file": "vue-tsc --noEmit && vite build --mode file",
|
||||
"tauri": "node ./build/syncVersion.js && tauri",
|
||||
"test": "vitest",
|
||||
"test:ui": "vitest --ui",
|
||||
"preview": "vite preview",
|
||||
"lint": "eslint ./src",
|
||||
"lint:fix": "eslint ./src --fix",
|
||||
"prepare": "husky"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tweenjs/tween.js": "23.1.2",
|
||||
"@vueuse/core": "^14.1.0",
|
||||
"axios": "^1.13.2",
|
||||
"canvas-confetti": "^1.9.4",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
"dayjs": "^1.11.19",
|
||||
"dexie": "^4.2.1",
|
||||
"github-markdown-css": "^5.8.1",
|
||||
"gsap": "^3.14.2",
|
||||
"localforage": "^1.10.0",
|
||||
"lodash-es": "^4.17.22",
|
||||
"lucide-vue-next": "^0.562.0",
|
||||
"markdown-it": "^14.1.0",
|
||||
"masonry-layout": "^4.2.2",
|
||||
"pinia": "^3.0.4",
|
||||
"pinia-plugin-persist": "^1.0.0",
|
||||
"reka-ui": "^2.7.0",
|
||||
"sparticles": "^1.3.1",
|
||||
"tailwind-merge": "^3.4.0",
|
||||
"three": "0.166.0",
|
||||
"three-css3d": "1.0.6",
|
||||
"uuid": "^13.0.0",
|
||||
"vue": "^3.5.26",
|
||||
"vue-dompurify-html": "^5.3.0",
|
||||
"vue-draggable-plus": "^0.6.0",
|
||||
"vue-i18n": "^11.2.7",
|
||||
"vue-router": "^4.6.4",
|
||||
"vue-sonner": "^2.0.9",
|
||||
"vue-toast-notification": "^3",
|
||||
"vue3-colorpicker": "^2.3.0",
|
||||
"xlsx": "^0.18.5",
|
||||
"zod": "^4.2.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@antfu/eslint-config": "^6.7.3",
|
||||
"@eslint/eslintrc": "^3.3.3",
|
||||
"@eslint/js": "^9.39.2",
|
||||
"@iconify-json/ep": "^1.2.3",
|
||||
"@iconify-json/fluent": "^1.2.36",
|
||||
"@tailwindcss/typography": "^0.5.19",
|
||||
"@tailwindcss/vite": "^4.1.18",
|
||||
"@tauri-apps/cli": "^2.9.6",
|
||||
"@testing-library/vue": "^8.1.0",
|
||||
"@types/canvas-confetti": "^1.9.0",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"@types/markdown-it": "^14.1.2",
|
||||
"@types/masonry-layout": "^4.2.8",
|
||||
"@types/node": "^25.0.3",
|
||||
"@types/three": "0.166.0",
|
||||
"@typescript-eslint/eslint-plugin": "^8.50.1",
|
||||
"@typescript-eslint/parser": "^8.50.1",
|
||||
"@vitejs/plugin-legacy": "^7.2.1",
|
||||
"@vitejs/plugin-vue": "^6.0.3",
|
||||
"@vitest/ui": "^4.0.16",
|
||||
"@vue/test-utils": "^2.4.6",
|
||||
"@vue/tsconfig": "^0.8.1",
|
||||
"autoprefixer": "^10.4.23",
|
||||
"baseline-browser-mapping": "^2.9.11",
|
||||
"child_process": "^1.0.2",
|
||||
"daisyui": "^5.5.14",
|
||||
"eslint": "^9.39.2",
|
||||
"eslint-plugin-vue": "^10.6.2",
|
||||
"fast-glob": "^3.3.3",
|
||||
"globals": "^16.5.0",
|
||||
"happy-dom": "^20.0.11",
|
||||
"husky": "^9.1.7",
|
||||
"jsdom": "^27.3.0",
|
||||
"path": "^0.12.7",
|
||||
"postcss": "^8.5.6",
|
||||
"rollup-plugin-visualizer": "^6.0.5",
|
||||
"sass": "^1.97.1",
|
||||
"sass-loader": "^16.0.6",
|
||||
"tailwindcss": "^4.1.18",
|
||||
"terser": "^5.44.1",
|
||||
"tw-animate-css": "^1.4.0",
|
||||
"typescript": "~5.9.3",
|
||||
"unplugin-auto-import": "^20.3.0",
|
||||
"unplugin-icons": "^22.5.0",
|
||||
"unplugin-vue-components": "^30.0.0",
|
||||
"vite": "^7.3.0",
|
||||
"vite-plugin-compression": "^0.5.1",
|
||||
"vite-plugin-inspect": "^11.3.3",
|
||||
"vite-plugin-svg-icons": "^2.0.1",
|
||||
"vite-plugin-vue-devtools": "^8.0.5",
|
||||
"vitest": "^4.0.16",
|
||||
"vue-tsc": "^3.2.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=22.x"
|
||||
},
|
||||
"packageManager": "pnpm@10.26.1"
|
||||
"name": "log-lottery",
|
||||
"private": true,
|
||||
"version": "0.5.2",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"dev": "vite --host 0.0.0.0",
|
||||
"build": "vue-tsc --noEmit && vite build",
|
||||
"build:pre": "vue-tsc --noEmit && vite build --mode prebuild",
|
||||
"build:file": "vue-tsc --noEmit && vite build --mode file",
|
||||
"tauri": "node ./build/syncVersion.js && tauri",
|
||||
"update-version": "node ./build/updateVersion.js",
|
||||
"test": "vitest",
|
||||
"test:ui": "vitest --ui",
|
||||
"preview": "vite preview",
|
||||
"lint": "eslint ./src",
|
||||
"lint:fix": "eslint ./src --fix",
|
||||
"prepare": "husky"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tweenjs/tween.js": "23.1.2",
|
||||
"@vueuse/core": "^14.1.0",
|
||||
"axios": "^1.13.2",
|
||||
"canvas-confetti": "^1.9.4",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
"dayjs": "^1.11.19",
|
||||
"dexie": "^4.2.1",
|
||||
"github-markdown-css": "^5.8.1",
|
||||
"gsap": "^3.14.2",
|
||||
"localforage": "^1.10.0",
|
||||
"lodash-es": "^4.17.22",
|
||||
"lucide-vue-next": "^0.562.0",
|
||||
"markdown-it": "^14.1.0",
|
||||
"masonry-layout": "^4.2.2",
|
||||
"pinia": "^3.0.4",
|
||||
"pinia-plugin-persist": "^1.0.0",
|
||||
"reka-ui": "^2.7.0",
|
||||
"sparticles": "^1.3.1",
|
||||
"tailwind-merge": "^3.4.0",
|
||||
"three": "0.166.0",
|
||||
"three-css3d": "1.0.6",
|
||||
"uuid": "^13.0.0",
|
||||
"vue": "^3.5.26",
|
||||
"vue-dompurify-html": "^5.3.0",
|
||||
"vue-draggable-plus": "^0.6.0",
|
||||
"vue-i18n": "^11.2.7",
|
||||
"vue-router": "^4.6.4",
|
||||
"vue-sonner": "^2.0.9",
|
||||
"vue-toast-notification": "^3",
|
||||
"vue3-colorpicker": "^2.3.0",
|
||||
"xlsx": "^0.18.5",
|
||||
"zod": "^4.2.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@antfu/eslint-config": "^6.7.3",
|
||||
"@eslint/eslintrc": "^3.3.3",
|
||||
"@eslint/js": "^9.39.2",
|
||||
"@iconify-json/ep": "^1.2.3",
|
||||
"@iconify-json/fluent": "^1.2.36",
|
||||
"@tailwindcss/typography": "^0.5.19",
|
||||
"@tailwindcss/vite": "^4.1.18",
|
||||
"@tauri-apps/cli": "^2.9.6",
|
||||
"@testing-library/vue": "^8.1.0",
|
||||
"@types/canvas-confetti": "^1.9.0",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"@types/markdown-it": "^14.1.2",
|
||||
"@types/masonry-layout": "^4.2.8",
|
||||
"@types/node": "^25.0.3",
|
||||
"@types/three": "0.166.0",
|
||||
"@typescript-eslint/eslint-plugin": "^8.50.1",
|
||||
"@typescript-eslint/parser": "^8.50.1",
|
||||
"@vitejs/plugin-legacy": "^7.2.1",
|
||||
"@vitejs/plugin-vue": "^6.0.3",
|
||||
"@vitest/ui": "^4.0.16",
|
||||
"@vue/test-utils": "^2.4.6",
|
||||
"@vue/tsconfig": "^0.8.1",
|
||||
"autoprefixer": "^10.4.23",
|
||||
"baseline-browser-mapping": "^2.9.11",
|
||||
"child_process": "^1.0.2",
|
||||
"daisyui": "^5.5.14",
|
||||
"eslint": "^9.39.2",
|
||||
"eslint-plugin-vue": "^10.6.2",
|
||||
"fast-glob": "^3.3.3",
|
||||
"globals": "^16.5.0",
|
||||
"happy-dom": "^20.0.11",
|
||||
"husky": "^9.1.7",
|
||||
"jsdom": "^27.3.0",
|
||||
"path": "^0.12.7",
|
||||
"postcss": "^8.5.6",
|
||||
"rollup-plugin-visualizer": "^6.0.5",
|
||||
"sass": "^1.97.1",
|
||||
"sass-loader": "^16.0.6",
|
||||
"tailwindcss": "^4.1.18",
|
||||
"terser": "^5.44.1",
|
||||
"tw-animate-css": "^1.4.0",
|
||||
"typescript": "~5.9.3",
|
||||
"unplugin-auto-import": "^20.3.0",
|
||||
"unplugin-icons": "^22.5.0",
|
||||
"unplugin-vue-components": "^30.0.0",
|
||||
"vite": "^7.3.0",
|
||||
"vite-plugin-compression": "^0.5.1",
|
||||
"vite-plugin-inspect": "^11.3.3",
|
||||
"vite-plugin-svg-icons": "^2.0.1",
|
||||
"vite-plugin-vue-devtools": "^8.0.5",
|
||||
"vitest": "^4.0.16",
|
||||
"vue-tsc": "^3.2.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=22.x"
|
||||
},
|
||||
"packageManager": "pnpm@10.26.1"
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "app"
|
||||
version = "0.5.0"
|
||||
version = "0.5.2"
|
||||
description = "A Tauri App"
|
||||
authors = ["you"]
|
||||
license = ""
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
|
||||
"productName": "log-lottery",
|
||||
"version": "0.5.0",
|
||||
"version": "0.5.2",
|
||||
"identifier": "to2026.xyz",
|
||||
"build": {
|
||||
"frontendDist": "../dist",
|
||||
@@ -34,4 +34,4 @@
|
||||
"icons/icon.ico"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user