From 5ee8123fc5e68261c863897fa190c3a4f2ccb4c2 Mon Sep 17 00:00:00 2001 From: guoapeng Date: Sat, 12 Jul 2025 16:16:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E6=8C=87=E4=BB=A4;test=E7=8E=AF=E5=A2=83=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E8=B7=B3=E8=BF=87=E8=87=AA=E6=A3=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.prod | 2 +- .env.test | 2 +- increment-version.js | 20 ++++++++++++++++++++ src/app.vue | 17 +++++++++++++++++ src/env.d.ts | 2 ++ src/views/main/index.vue | 3 ++- vite.config.ts | 2 +- 7 files changed, 44 insertions(+), 4 deletions(-) diff --git a/.env.prod b/.env.prod index 4c0f215..cb7d259 100644 --- a/.env.prod +++ b/.env.prod @@ -3,4 +3,4 @@ FT_NODE_ENV=prod FT_WS_URL=ws://192.168.100.168:8080/ws -FT_PROXY=http://192.168.1.168 \ No newline at end of file +FT_PROXY=http://127.0.0.1:8080 \ No newline at end of file diff --git a/.env.test b/.env.test index e45cade..37ec341 100644 --- a/.env.test +++ b/.env.test @@ -2,5 +2,5 @@ FT_NODE_ENV=test -FT_WS_URL=ws://192.168.1.200:8080/ws +FT_WS_URL=ws://192.168.100.168:8080/ws FT_PROXY=http://192.168.1.200:8080 \ No newline at end of file diff --git a/increment-version.js b/increment-version.js index 3239813..a1db336 100644 --- a/increment-version.js +++ b/increment-version.js @@ -1,3 +1,4 @@ +import { execSync } from 'node:child_process' import fs from 'node:fs' import path, { dirname } from 'node:path' import { fileURLToPath } from 'node:url' @@ -10,6 +11,7 @@ const packagePath = path.resolve(__dirname, 'package.json') const packageJson = JSON.parse(fs.readFileSync(packagePath, 'utf-8')) // 读取命令行参数(默认使用 'patch') +// eslint-disable-next-line node/prefer-global/process const versionType = process.argv[2] || 'patch' // 递增版本 @@ -21,3 +23,21 @@ if (!newVersion) { packageJson.version = newVersion fs.writeFileSync(packagePath, JSON.stringify(packageJson, null, 2)) console.log(`Version updated to: ${newVersion}`) + +// 新增:自动提交 package.json 到远程仓库 +try { + // 将 package.json 添加到暂存区 + execSync('git add package.json') + console.log('Added package.json to staging area.') + + // 提交更改 + execSync(`git commit -m "fix: Update version to V${newVersion}"`) + console.log(`Committed changes with message: Update version to ${newVersion}`) + + // 推送到远程仓库 + execSync('git push') + console.log('Pushed changes to remote repository.') +} +catch (error) { + console.error('Failed to commit and push changes:', error.message) +} diff --git a/src/app.vue b/src/app.vue index b10a753..4edf297 100644 --- a/src/app.vue +++ b/src/app.vue @@ -1,5 +1,22 @@