chore: 修改git hook
- 将git hook的调用工具调整为npx
This commit is contained in:
@ -56,26 +56,11 @@ print_debug "Shell: $SHELL"
|
|||||||
print_debug "PATH: $PATH"
|
print_debug "PATH: $PATH"
|
||||||
print_debug "当前进程ID: $"
|
print_debug "当前进程ID: $"
|
||||||
|
|
||||||
# 检查 bunx 是否可用
|
|
||||||
print_section "检查工具可用性..."
|
|
||||||
print_info "尝试导入用户环境变量..."
|
|
||||||
export PATH="$HOME/.bun/bin:$PATH"
|
|
||||||
if command -v bunx >/dev/null 2>&1; then
|
|
||||||
BUNX_PATH=$(command -v bunx)
|
|
||||||
print_success "bunx 可用: $BUNX_PATH"
|
|
||||||
print_debug "bunx 版本信息:"
|
|
||||||
print_debug "$(bunx --version 2>&1 || echo 'bunx --version 失败')"
|
|
||||||
else
|
|
||||||
print_error "bunx 不可用"
|
|
||||||
print_info "PATH 内容: $PATH"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# 检查 commitlint 是否可用
|
# 检查 commitlint 是否可用
|
||||||
print_section "检查 commitlint..."
|
print_section "检查 commitlint..."
|
||||||
if bunx commitlint --version >/dev/null 2>&1; then
|
if npx commitlint --version >/dev/null 2>&1; then
|
||||||
COMMITLINT_VERSION=$(bunx commitlint --version)
|
COMMITLINT_VERSION=$(npx commitlint --version)
|
||||||
print_success "commitlint 可用: $COMMITLINT_VERSION"
|
print_success "commitlint 可用: $COMMITLINT_VERSION"
|
||||||
else
|
else
|
||||||
print_error "commitlint 不可用或配置有误"
|
print_error "commitlint 不可用或配置有误"
|
||||||
@ -132,15 +117,15 @@ fi
|
|||||||
# 运行 commitlint
|
# 运行 commitlint
|
||||||
echo
|
echo
|
||||||
print_section "执行 commitlint 检查..."
|
print_section "执行 commitlint 检查..."
|
||||||
print_command "执行命令: bunx commitlint --edit \"$1\""
|
print_command "执行命令: npx commitlint --edit \"$1\""
|
||||||
|
|
||||||
# 显示详细的执行过程
|
# 显示详细的执行过程
|
||||||
if [ "$DEBUG" = "true" ]; then
|
if [ "$DEBUG" = "true" ]; then
|
||||||
print_debug "详细执行过程:"
|
print_debug "详细执行过程:"
|
||||||
bunx commitlint --edit "$1" --verbose
|
npx commitlint --edit "$1" --verbose
|
||||||
RESULT=$?
|
RESULT=$?
|
||||||
else
|
else
|
||||||
bunx commitlint --edit "$1"
|
npx commitlint --edit "$1"
|
||||||
RESULT=$?
|
RESULT=$?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -156,7 +141,7 @@ else
|
|||||||
echo "1. 检查提交消息是否符合约定式提交格式"
|
echo "1. 检查提交消息是否符合约定式提交格式"
|
||||||
echo "2. 确认 commitlint 配置是否正确"
|
echo "2. 确认 commitlint 配置是否正确"
|
||||||
echo "3. 运行 'DEBUG=true git commit' 查看详细调试信息"
|
echo "3. 运行 'DEBUG=true git commit' 查看详细调试信息"
|
||||||
echo "4. 手动测试: bunx commitlint --edit .git/COMMIT_EDITMSG"
|
echo "4. 手动测试: npx commitlint --edit .git/COMMIT_EDITMSG"
|
||||||
echo
|
echo
|
||||||
print_debug "Hook 执行失败,退出代码: $RESULT"
|
print_debug "Hook 执行失败,退出代码: $RESULT"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
pnpm dlx lint-staged
|
npx lint-staged
|
||||||
Reference in New Issue
Block a user