diff --git a/.githooks/post-receive b/.githooks/post-receive index 83ec4045..74a9071b 100755 --- a/.githooks/post-receive +++ b/.githooks/post-receive @@ -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 决定是否继续) # ============================================================ run_build() { 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=$? echo "=== build EXIT_CODE=$BUILD_EXIT @ $(date +%Y-%m-%dT%H:%M:%S%z) ===" >> "$LOG_FILE" echo "" >> "$LOG_FILE" @@ -156,4 +156,4 @@ main() { main "$@" -exit 0 \ No newline at end of file +exit 0 diff --git a/package.json b/package.json index 4f1ff118..8423ebff 100644 --- a/package.json +++ b/package.json @@ -5,8 +5,9 @@ "scripts": { "dev": "next dev", "build": "next build", + "build:deploy": "pnpm install && pnpm run build", "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:fix": "eslint --fix", "test": "vitest run",