create-vue3-enterprise 1.0.37 → 1.0.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-vue3-enterprise",
3
- "version": "1.0.37",
3
+ "version": "1.0.38",
4
4
  "description": "Vue3 + TypeScript + Vite 企业级项目脚手架",
5
5
  "type": "module",
6
6
  "bin": {
@@ -5,19 +5,32 @@
5
5
  # ============================================
6
6
 
7
7
  echo ""
8
- echo "📝 Validating commit message..."
8
+ echo "📝 验证提交消息中..."
9
9
  echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
10
10
 
11
- # Run commitlint
12
- if ! npx commitlint --edit ${1}; then
11
+ # 检查提交消息文件参数是否存在
12
+ if [ -z "${1}" ]; then
13
13
  echo ""
14
- echo "❌ Commit message validation FAILED"
14
+ echo "❌ 错误:未传入提交消息文件路径!"
15
+ exit 1
16
+ fi
17
+
18
+ # 执行 commitlint 并捕获输出和退出码
19
+ COMMITLINT_OUTPUT=$(npx commitlint --edit "${1}" 2>&1)
20
+ COMMITLINT_EXIT_CODE=$?
21
+
22
+ # 判断验证结果
23
+ if [ ${COMMITLINT_EXIT_CODE} -ne 0 ]; then
24
+ echo ""
25
+ echo "❌ 提交消息验证失败!"
15
26
  echo ""
16
- echo "Please refer to the commit specification guide in .husky/pre-commit.md for modifications."
27
+ echo "🔍 具体错误信息:"
28
+ echo "${COMMITLINT_OUTPUT}" | sed 's/^/ /' # 格式化错误信息,增加缩进
17
29
  echo ""
30
+ echo "📖 请参考 .husky/pre-commit.md 中的提交规范指南进行修改。"
18
31
  exit 1
19
32
  fi
20
33
 
21
34
  echo ""
22
- echo "✅ Commit message validated!"
35
+ echo "✅ 提交消息验证通过!"
23
36
  echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
@@ -2,18 +2,32 @@
2
2
  # Pre-commit checks - concise output
3
3
 
4
4
  # Run lint-staged and capture output
5
+ # 执行 lint-staged 并捕获输出和退出码
5
6
  OUTPUT=$(npx lint-staged 2>&1)
6
7
  EXIT_CODE=$?
7
8
 
8
9
  if [ $EXIT_CODE -eq 0 ]; then
9
- echo "✅ Code validation passed!"
10
+ echo "✅ 代码检查通过!"
10
11
  exit 0
11
12
  else
12
- echo "❌ Code validation failed!"
13
+ echo "❌ 代码检查失败!"
13
14
  echo ""
14
- # Extract file paths and line numbers from eslint output
15
- echo "$OUTPUT" | grep -E ':\d+:\d+' | sed 's/^/ /'
15
+
16
+ # 提取错误行(增强版:兼容更多 eslint 输出格式)
17
+ echo "🔍 错误详情:"
18
+ ERROR_CONTENT=$(echo "$OUTPUT" | grep -E ':\d+:\d+|error|Error|ERROR')
19
+
20
+ if [ -n "$ERROR_CONTENT" ]; then
21
+ # 有具体错误行时格式化展示
22
+ echo "$ERROR_CONTENT" | sed 's/^/ /'
23
+ else
24
+ # 无匹配错误行时展示完整输出,避免信息丢失
25
+ echo " 未匹配到具体行号错误,完整输出如下:"
26
+ echo "$OUTPUT" | sed 's/^/ /'
27
+ fi
28
+
16
29
  echo ""
17
- echo "fixed: npm run lint -- --fix"
30
+ echo "💡 修复建议:npm run lint -- --fix"
31
+ echo "💡 若自动修复无效,请手动修改上述错误后重新提交"
18
32
  exit 1
19
33
  fi