chore(deploy): install dependencies before build

This commit is contained in:
2026-06-17 17:40:01 +08:00
parent 5d66cef85c
commit 7f8e327582
2 changed files with 5 additions and 4 deletions
+3 -3
View File
@@ -86,12 +86,12 @@ copy_env_by_branch() {
} }
# ============================================================ # ============================================================
# 4. run_build —— 跑 `pnpm run build`,输出丢,捕获退出码写日志 # 4. run_build —— 跑 `pnpm install` + `pnpm run build`,输出丢,捕获退出码写日志
# 返回:build 退出码(main 用 if ! run_build 决定是否继续) # 返回:build 退出码(main 用 if ! run_build 决定是否继续)
# ============================================================ # ============================================================
run_build() { run_build() {
echo "=== build START @ $(date +%Y-%m-%dT%H:%M:%S%z) ===" >> "$LOG_FILE" echo "=== build START @ $(date +%Y-%m-%dT%H:%M:%S%z) ===" >> "$LOG_FILE"
pnpm run build > /dev/null 2>&1 pnpm run build:deploy > /dev/null 2>&1
BUILD_EXIT=$? BUILD_EXIT=$?
echo "=== build EXIT_CODE=$BUILD_EXIT @ $(date +%Y-%m-%dT%H:%M:%S%z) ===" >> "$LOG_FILE" echo "=== build EXIT_CODE=$BUILD_EXIT @ $(date +%Y-%m-%dT%H:%M:%S%z) ===" >> "$LOG_FILE"
echo "" >> "$LOG_FILE" echo "" >> "$LOG_FILE"
@@ -156,4 +156,4 @@ main() {
main "$@" main "$@"
exit 0 exit 0
+2 -1
View File
@@ -5,8 +5,9 @@
"scripts": { "scripts": {
"dev": "next dev", "dev": "next dev",
"build": "next build", "build": "next build",
"build:deploy": "pnpm install && pnpm run build",
"start": "next start -p 9135", "start": "next start -p 9135",
"build:start": "npm run build && npm run start", "build:start": "pnpm install && pnpm run build && pnpm run start",
"lint": "eslint", "lint": "eslint",
"lint:fix": "eslint --fix", "lint:fix": "eslint --fix",
"test": "vitest run", "test": "vitest run",