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",
|
"name": "log-lottery",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.5.0",
|
"version": "0.5.2",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite --host 0.0.0.0",
|
"dev": "vite --host 0.0.0.0",
|
||||||
"build": "vue-tsc --noEmit && vite build",
|
"build": "vue-tsc --noEmit && vite build",
|
||||||
"build:pre": "vue-tsc --noEmit && vite build --mode prebuild",
|
"build:pre": "vue-tsc --noEmit && vite build --mode prebuild",
|
||||||
"build:file": "vue-tsc --noEmit && vite build --mode file",
|
"build:file": "vue-tsc --noEmit && vite build --mode file",
|
||||||
"tauri": "node ./build/syncVersion.js && tauri",
|
"tauri": "node ./build/syncVersion.js && tauri",
|
||||||
"test": "vitest",
|
"update-version": "node ./build/updateVersion.js",
|
||||||
"test:ui": "vitest --ui",
|
"test": "vitest",
|
||||||
"preview": "vite preview",
|
"test:ui": "vitest --ui",
|
||||||
"lint": "eslint ./src",
|
"preview": "vite preview",
|
||||||
"lint:fix": "eslint ./src --fix",
|
"lint": "eslint ./src",
|
||||||
"prepare": "husky"
|
"lint:fix": "eslint ./src --fix",
|
||||||
},
|
"prepare": "husky"
|
||||||
"dependencies": {
|
},
|
||||||
"@tweenjs/tween.js": "23.1.2",
|
"dependencies": {
|
||||||
"@vueuse/core": "^14.1.0",
|
"@tweenjs/tween.js": "23.1.2",
|
||||||
"axios": "^1.13.2",
|
"@vueuse/core": "^14.1.0",
|
||||||
"canvas-confetti": "^1.9.4",
|
"axios": "^1.13.2",
|
||||||
"class-variance-authority": "^0.7.1",
|
"canvas-confetti": "^1.9.4",
|
||||||
"clsx": "^2.1.1",
|
"class-variance-authority": "^0.7.1",
|
||||||
"dayjs": "^1.11.19",
|
"clsx": "^2.1.1",
|
||||||
"dexie": "^4.2.1",
|
"dayjs": "^1.11.19",
|
||||||
"github-markdown-css": "^5.8.1",
|
"dexie": "^4.2.1",
|
||||||
"gsap": "^3.14.2",
|
"github-markdown-css": "^5.8.1",
|
||||||
"localforage": "^1.10.0",
|
"gsap": "^3.14.2",
|
||||||
"lodash-es": "^4.17.22",
|
"localforage": "^1.10.0",
|
||||||
"lucide-vue-next": "^0.562.0",
|
"lodash-es": "^4.17.22",
|
||||||
"markdown-it": "^14.1.0",
|
"lucide-vue-next": "^0.562.0",
|
||||||
"masonry-layout": "^4.2.2",
|
"markdown-it": "^14.1.0",
|
||||||
"pinia": "^3.0.4",
|
"masonry-layout": "^4.2.2",
|
||||||
"pinia-plugin-persist": "^1.0.0",
|
"pinia": "^3.0.4",
|
||||||
"reka-ui": "^2.7.0",
|
"pinia-plugin-persist": "^1.0.0",
|
||||||
"sparticles": "^1.3.1",
|
"reka-ui": "^2.7.0",
|
||||||
"tailwind-merge": "^3.4.0",
|
"sparticles": "^1.3.1",
|
||||||
"three": "0.166.0",
|
"tailwind-merge": "^3.4.0",
|
||||||
"three-css3d": "1.0.6",
|
"three": "0.166.0",
|
||||||
"uuid": "^13.0.0",
|
"three-css3d": "1.0.6",
|
||||||
"vue": "^3.5.26",
|
"uuid": "^13.0.0",
|
||||||
"vue-dompurify-html": "^5.3.0",
|
"vue": "^3.5.26",
|
||||||
"vue-draggable-plus": "^0.6.0",
|
"vue-dompurify-html": "^5.3.0",
|
||||||
"vue-i18n": "^11.2.7",
|
"vue-draggable-plus": "^0.6.0",
|
||||||
"vue-router": "^4.6.4",
|
"vue-i18n": "^11.2.7",
|
||||||
"vue-sonner": "^2.0.9",
|
"vue-router": "^4.6.4",
|
||||||
"vue-toast-notification": "^3",
|
"vue-sonner": "^2.0.9",
|
||||||
"vue3-colorpicker": "^2.3.0",
|
"vue-toast-notification": "^3",
|
||||||
"xlsx": "^0.18.5",
|
"vue3-colorpicker": "^2.3.0",
|
||||||
"zod": "^4.2.1"
|
"xlsx": "^0.18.5",
|
||||||
},
|
"zod": "^4.2.1"
|
||||||
"devDependencies": {
|
},
|
||||||
"@antfu/eslint-config": "^6.7.3",
|
"devDependencies": {
|
||||||
"@eslint/eslintrc": "^3.3.3",
|
"@antfu/eslint-config": "^6.7.3",
|
||||||
"@eslint/js": "^9.39.2",
|
"@eslint/eslintrc": "^3.3.3",
|
||||||
"@iconify-json/ep": "^1.2.3",
|
"@eslint/js": "^9.39.2",
|
||||||
"@iconify-json/fluent": "^1.2.36",
|
"@iconify-json/ep": "^1.2.3",
|
||||||
"@tailwindcss/typography": "^0.5.19",
|
"@iconify-json/fluent": "^1.2.36",
|
||||||
"@tailwindcss/vite": "^4.1.18",
|
"@tailwindcss/typography": "^0.5.19",
|
||||||
"@tauri-apps/cli": "^2.9.6",
|
"@tailwindcss/vite": "^4.1.18",
|
||||||
"@testing-library/vue": "^8.1.0",
|
"@tauri-apps/cli": "^2.9.6",
|
||||||
"@types/canvas-confetti": "^1.9.0",
|
"@testing-library/vue": "^8.1.0",
|
||||||
"@types/lodash-es": "^4.17.12",
|
"@types/canvas-confetti": "^1.9.0",
|
||||||
"@types/markdown-it": "^14.1.2",
|
"@types/lodash-es": "^4.17.12",
|
||||||
"@types/masonry-layout": "^4.2.8",
|
"@types/markdown-it": "^14.1.2",
|
||||||
"@types/node": "^25.0.3",
|
"@types/masonry-layout": "^4.2.8",
|
||||||
"@types/three": "0.166.0",
|
"@types/node": "^25.0.3",
|
||||||
"@typescript-eslint/eslint-plugin": "^8.50.1",
|
"@types/three": "0.166.0",
|
||||||
"@typescript-eslint/parser": "^8.50.1",
|
"@typescript-eslint/eslint-plugin": "^8.50.1",
|
||||||
"@vitejs/plugin-legacy": "^7.2.1",
|
"@typescript-eslint/parser": "^8.50.1",
|
||||||
"@vitejs/plugin-vue": "^6.0.3",
|
"@vitejs/plugin-legacy": "^7.2.1",
|
||||||
"@vitest/ui": "^4.0.16",
|
"@vitejs/plugin-vue": "^6.0.3",
|
||||||
"@vue/test-utils": "^2.4.6",
|
"@vitest/ui": "^4.0.16",
|
||||||
"@vue/tsconfig": "^0.8.1",
|
"@vue/test-utils": "^2.4.6",
|
||||||
"autoprefixer": "^10.4.23",
|
"@vue/tsconfig": "^0.8.1",
|
||||||
"baseline-browser-mapping": "^2.9.11",
|
"autoprefixer": "^10.4.23",
|
||||||
"child_process": "^1.0.2",
|
"baseline-browser-mapping": "^2.9.11",
|
||||||
"daisyui": "^5.5.14",
|
"child_process": "^1.0.2",
|
||||||
"eslint": "^9.39.2",
|
"daisyui": "^5.5.14",
|
||||||
"eslint-plugin-vue": "^10.6.2",
|
"eslint": "^9.39.2",
|
||||||
"fast-glob": "^3.3.3",
|
"eslint-plugin-vue": "^10.6.2",
|
||||||
"globals": "^16.5.0",
|
"fast-glob": "^3.3.3",
|
||||||
"happy-dom": "^20.0.11",
|
"globals": "^16.5.0",
|
||||||
"husky": "^9.1.7",
|
"happy-dom": "^20.0.11",
|
||||||
"jsdom": "^27.3.0",
|
"husky": "^9.1.7",
|
||||||
"path": "^0.12.7",
|
"jsdom": "^27.3.0",
|
||||||
"postcss": "^8.5.6",
|
"path": "^0.12.7",
|
||||||
"rollup-plugin-visualizer": "^6.0.5",
|
"postcss": "^8.5.6",
|
||||||
"sass": "^1.97.1",
|
"rollup-plugin-visualizer": "^6.0.5",
|
||||||
"sass-loader": "^16.0.6",
|
"sass": "^1.97.1",
|
||||||
"tailwindcss": "^4.1.18",
|
"sass-loader": "^16.0.6",
|
||||||
"terser": "^5.44.1",
|
"tailwindcss": "^4.1.18",
|
||||||
"tw-animate-css": "^1.4.0",
|
"terser": "^5.44.1",
|
||||||
"typescript": "~5.9.3",
|
"tw-animate-css": "^1.4.0",
|
||||||
"unplugin-auto-import": "^20.3.0",
|
"typescript": "~5.9.3",
|
||||||
"unplugin-icons": "^22.5.0",
|
"unplugin-auto-import": "^20.3.0",
|
||||||
"unplugin-vue-components": "^30.0.0",
|
"unplugin-icons": "^22.5.0",
|
||||||
"vite": "^7.3.0",
|
"unplugin-vue-components": "^30.0.0",
|
||||||
"vite-plugin-compression": "^0.5.1",
|
"vite": "^7.3.0",
|
||||||
"vite-plugin-inspect": "^11.3.3",
|
"vite-plugin-compression": "^0.5.1",
|
||||||
"vite-plugin-svg-icons": "^2.0.1",
|
"vite-plugin-inspect": "^11.3.3",
|
||||||
"vite-plugin-vue-devtools": "^8.0.5",
|
"vite-plugin-svg-icons": "^2.0.1",
|
||||||
"vitest": "^4.0.16",
|
"vite-plugin-vue-devtools": "^8.0.5",
|
||||||
"vue-tsc": "^3.2.1"
|
"vitest": "^4.0.16",
|
||||||
},
|
"vue-tsc": "^3.2.1"
|
||||||
"engines": {
|
},
|
||||||
"node": ">=22.x"
|
"engines": {
|
||||||
},
|
"node": ">=22.x"
|
||||||
"packageManager": "pnpm@10.26.1"
|
},
|
||||||
|
"packageManager": "pnpm@10.26.1"
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "app"
|
name = "app"
|
||||||
version = "0.5.0"
|
version = "0.5.2"
|
||||||
description = "A Tauri App"
|
description = "A Tauri App"
|
||||||
authors = ["you"]
|
authors = ["you"]
|
||||||
license = ""
|
license = ""
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
|
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
|
||||||
"productName": "log-lottery",
|
"productName": "log-lottery",
|
||||||
"version": "0.5.0",
|
"version": "0.5.2",
|
||||||
"identifier": "to2026.xyz",
|
"identifier": "to2026.xyz",
|
||||||
"build": {
|
"build": {
|
||||||
"frontendDist": "../dist",
|
"frontendDist": "../dist",
|
||||||
@@ -34,4 +34,4 @@
|
|||||||
"icons/icon.ico"
|
"icons/icon.ico"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user