feat: 添加husky pre-commit hook配置实现构建验证 (#441)
- 配置husky作为pre-commit钩子 - 添加构建验证脚本,提交前自动执行构建检查 - 防止构建失败的代码被提交到仓库 关联任务: 自动化构建门禁方案第一步
This commit is contained in:
9
.husky/pre-commit
Executable file
9
.husky/pre-commit
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env sh
|
||||
# 前端构建检查
|
||||
cd openhis-ui-vue3
|
||||
# 检查是否安装了lint-staged或eslint
|
||||
if npm list --depth=0 | grep -q "eslint"; then
|
||||
npm run lint -- --max-warnings 0
|
||||
fi
|
||||
# 执行生产构建检查
|
||||
npm run build:prod -- --mode development 2>/dev/null || exit 1
|
||||
Reference in New Issue
Block a user