From 290eb17e3d42303a4d30333f2b80278c97723ea1 Mon Sep 17 00:00:00 2001 From: Xin Wang Date: Thu, 21 Aug 2025 13:02:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- compile.sh | 69 +++++++++++++++++++++ src/components/entity/EntityConfigPanel.vue | 3 + src/components/entity/WeaponStatsPanel.vue | 3 + 3 files changed, 75 insertions(+) create mode 100755 compile.sh diff --git a/compile.sh b/compile.sh new file mode 100755 index 0000000..677ec49 --- /dev/null +++ b/compile.sh @@ -0,0 +1,69 @@ +#!/bin/bash + +BRANCH_NAME="dev" + +# 修改项目名称 +PROJECT_NAME="war-frontend" + +# 设置日志文件路径 +LOGFILE="build_and_copy.log" + +# 记录开始时间 +echo "Build process started at $(date)" | tee $LOGFILE + +# 获取当前分支名 +current_branch=$(git rev-parse --abbrev-ref HEAD) + +# 打包之前,需要检查是否在 pre 分支,工作区是否干净,是否和远程分支一致 +if [ "$(git branch --show-current)" != "$BRANCH_NAME" ]; then + echo "当前分支不是 dev 分支" + exit 1 +fi + +# 检查工作区是否干净 +if [ -n "$(git status --porcelain)" ]; then + echo "工作区不干净" + exit 1 +fi + +# 检查远程分支是否和本地分支一致 +if [ "$(git rev-parse HEAD)" != "$(git rev-parse origin/$BRANCH_NAME)" ]; then + echo "本地分支和远程分支不一致" + exit 1 +fi + + +# 检查当前分支并运行相应的 npm 命令 +if [ "$current_branch" = "$BRANCH_NAME" ]; then + echo "On dev branch, building project..." | tee -a $LOGFILE + PROFILE_ENV=$BRANCH_NAME + + # 安装依赖并构建 + yarn install + yarn build + + # 准备dist目录 + mkdir -p dist + cp -r .next dist/ + cp -r public dist/ + cp package.json dist/ + cp package-lock.json dist/ + +else + echo "On non-dev branch ($current_branch), exiting" + exit 1 +fi + +# 创建tar包 +tar -czvf $PROJECT_NAME-$PROFILE_ENV.tar.gz dist + +# 记录结束时间 +echo "Build process completed at $(date)" | tee -a $LOGFILE + +# 上传到 nexus +echo "upload to nexus at $(date)" | tee -a $LOGFILE +curl -u 'admin':'YZ9Gq6=8\*G|?:,' --upload-file $PROJECT_NAME-$PROFILE_ENV.tar.gz https://repo.qikongjian.com/repository/frontend-tar-files/ + +# 清理构建文件 +rm -rf dist +rm $PROJECT_NAME-$PROFILE_ENV.tar.gz diff --git a/src/components/entity/EntityConfigPanel.vue b/src/components/entity/EntityConfigPanel.vue index 4e3d263..a82423b 100644 --- a/src/components/entity/EntityConfigPanel.vue +++ b/src/components/entity/EntityConfigPanel.vue @@ -116,3 +116,6 @@ function saveConfig() { } } + + + diff --git a/src/components/entity/WeaponStatsPanel.vue b/src/components/entity/WeaponStatsPanel.vue index 6e45787..14c66fe 100644 --- a/src/components/entity/WeaponStatsPanel.vue +++ b/src/components/entity/WeaponStatsPanel.vue @@ -139,3 +139,6 @@ const statusText = computed(() => { } } + + +