Files
chat-one-web/.husky/pre-commit
alboped c206eb8132 chore: 更新 pre-commit 针对 Node 环境的检查和 lint-staged 执行
- 增加 Node 环境检查,确保在提交前 Node 可用
- 更新 lint-staged 执行方式以适应新的环境设置
- 清理 index.tsx 文件中的多余空行
2026-04-03 21:13:29 +08:00

24 lines
644 B
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env sh
set -e
cd "$(dirname "$0")/.." || exit 1
# SourceTree 等 GUI 的 PATH 通常没有 node先补常见安装位置
export PATH="/usr/local/bin:/opt/homebrew/bin:$HOME/.local/bin:$PATH"
if [ -s "$HOME/.nvm/nvm.sh" ]; then
export NVM_DIR="${NVM_DIR:-$HOME/.nvm}"
# shellcheck source=/dev/null
. "$HOME/.nvm/nvm.sh"
fi
if command -v fnm >/dev/null 2>&1; then
eval "$(fnm env)"
fi
if ! command -v node >/dev/null 2>&1; then
echo "pre-commit: 找不到 node请安装 Node 或在 ~/.husky/pre-commit 里为 PATH 增加 node 所在目录。" >&2
exit 1
fi
exec node ./node_modules/lint-staged/bin/lint-staged.js