修改user端的项目文件到mini-user
CI / verify (pull_request) Has been cancelled

This commit is contained in:
2026-07-14 15:52:27 +08:00
parent e0f5977dd9
commit 9403d22544
8 changed files with 42 additions and 11 deletions
+5 -1
View File
@@ -63,7 +63,11 @@ export default defineConfig(async () => ({
},
},
h5: {
publicPath: '/',
publicPath: process.env.TARO_H5_PUBLIC_PATH || '/',
router: {
mode: 'browser',
basename: process.env.TARO_H5_ROUTER_BASENAME || '/',
},
staticDirectory: 'static',
devServer: {
port: 5177,
+1
View File
@@ -2,6 +2,7 @@
# 服务器路径: /opt/dukang-haoke/deploy/auto-release.env
APP_ROOT=/opt/dukang-haoke
GIT_REPO_URL=git@git.yqidian.com:jacy/dukang.git
GIT_REMOTE=origin
GIT_BRANCH=dev
DEPLOY_GIT_REF=refs/heads/dev
+9
View File
@@ -45,6 +45,15 @@ if [[ ! -d .git ]]; then
exit 1
fi
# 统一远程仓库为 SSH 地址
GIT_REPO_URL="${GIT_REPO_URL:-git@git.yqidian.com:jacy/dukang.git}"
CURRENT_URL="$(git remote get-url "$GIT_REMOTE" 2>/dev/null || true)"
if [[ "$CURRENT_URL" != "$GIT_REPO_URL" ]]; then
log "SET remote $GIT_REMOTE -> $GIT_REPO_URL (was: ${CURRENT_URL:-none})"
git remote set-url "$GIT_REMOTE" "$GIT_REPO_URL" 2>/dev/null \
|| git remote add "$GIT_REMOTE" "$GIT_REPO_URL"
fi
git fetch "$GIT_REMOTE"
git checkout "$GIT_BRANCH"
+2
View File
@@ -5,5 +5,7 @@ DEPLOY_PORT=22
# DEPLOY_SSH_KEY=~/.ssh/id_rsa
APP_ROOT=/opt/dukang-haoke
# 生产仓库(SSH
GIT_REPO_URL=git@git.yqidian.com:jacy/dukang.git
GIT_REMOTE=origin
GIT_BRANCH=dev
+2 -1
View File
@@ -15,8 +15,9 @@ module.exports = {
},
},
{
// C 端改为 mini-user H5 产物(端口仍 8091,进程名保持兼容旧脚本)
name: 'dukang-h5-user',
cwd: `${APP_ROOT}/apps/h5-user`,
cwd: `${APP_ROOT}/apps/mini-user`,
script: 'npx',
args: 'serve -s dist -l 8091',
interpreter: 'none',
+1 -1
View File
@@ -42,7 +42,7 @@ server {
client_max_body_size 20m;
location ~ ^/MP_verify_.*\.txt$ {
root /opt/dukang-haoke/apps/h5-user/dist;
root /opt/dukang-haoke/apps/mini-user/dist;
default_type text/plain;
access_log off;
}
+1 -1
View File
@@ -17,7 +17,7 @@ server {
}
location ~ ^/MP_verify_.*\.txt$ {
root /opt/dukang-haoke/apps/h5-user/dist;
root /opt/dukang-haoke/apps/mini-user/dist;
default_type text/plain;
access_log off;
}
+21 -7
View File
@@ -41,7 +41,11 @@ corepack enable 2>/dev/null || true
corepack prepare pnpm@11.2.2 --activate 2>/dev/null || true
echo "==> 2. 安装依赖"
export NODE_OPTIONS="${NODE_OPTIONS:---max-old-space-size=2048}"
# mini-user H5Taro)构建峰值内存较高
export NODE_OPTIONS="${NODE_OPTIONS:---max-old-space-size=8192}"
# 生产部署 pathnginx 入口为 /user/
export TARO_H5_PUBLIC_PATH="${TARO_H5_PUBLIC_PATH:-/user/}"
export TARO_H5_ROUTER_BASENAME="${TARO_H5_ROUTER_BASENAME:-/user}"
pnpm approve-builds --all 2>/dev/null || true
pnpm install --frozen-lockfile 2>/dev/null || pnpm install
@@ -68,16 +72,26 @@ else
fi
if [[ "$SKIP_BUILD" == false ]]; then
echo "==> 4. 构建"
pnpm build
echo "==> 4. 构建C 端使用 mini-user H5,跳过 h5-user"
pnpm --filter @dukang/shared-types \
--filter @dukang/domain \
--filter @dukang/api \
--filter @dukang/mini-user \
--filter @dukang/h5-shop \
--filter @dukang/h5-partner \
--filter @dukang/admin-web \
build
else
echo "==> 4. 跳过构建"
fi
echo "==> 5. 重启 PM2"
if pm2 describe dukang-api &>/dev/null; then
pm2 restart dukang-api dukang-h5-user dukang-h5-shop dukang-h5-partner dukang-admin-web 2>/dev/null \
|| pm2 restart dukang-api dukang-h5-user dukang-h5-shop dukang-h5-partner
# delete+start 以确保 cwd 从 h5-user 切到 mini-user
pm2 delete dukang-h5-user 2>/dev/null || true
pm2 start "$DEPLOY_DIR/ecosystem.config.cjs" --only dukang-h5-user
pm2 restart dukang-api dukang-h5-shop dukang-h5-partner dukang-admin-web 2>/dev/null \
|| pm2 restart dukang-api dukang-h5-shop dukang-h5-partner
else
pm2 start "$DEPLOY_DIR/ecosystem.config.cjs"
fi
@@ -86,8 +100,8 @@ pm2 save
echo "==> 6. 健康检查"
sleep 2
pm2 list
ss -tlnp | grep -E '809[0-3]' || true
curl -sf -o /dev/null -w "h5-user: %{http_code}\n" http://127.0.0.1:8091/ || echo "h5-user: FAIL"
ss -tlnp | grep -E '809[0-4]' || true
curl -sf -o /dev/null -w "mini-user(h5): %{http_code}\n" http://127.0.0.1:8091/ || echo "mini-user(h5): FAIL"
curl -sf -o /dev/null -w "api: %{http_code}\n" http://127.0.0.1:8090/api/v1/health 2>/dev/null \
|| curl -sf -o /dev/null -w "api: %{http_code}\n" http://127.0.0.1:8090/ \
|| echo "api: FAIL"