File tree Expand file tree Collapse file tree 2 files changed +117
-3
lines changed
Expand file tree Collapse file tree 2 files changed +117
-3
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # Переходим в корневой каталог репозитория
4+ cd " $( git rev-parse --show-toplevel) " || exit 1
5+
6+ # Проверка на наличие node_modules
7+ echo " [plugin husky:pre-commit]: Checking for node_modules..."
8+ if [ ! -d " node_modules" ]; then
9+ echo " ✗ Error: Missing node_modules. Please run 'npm install' first."
10+ exit 1
11+ fi
12+ echo " ✓ Done."
13+ echo " " # Добавляем пустую строку для лучшей читаемости
14+
15+ # 1. Запуск аудита безопасности
16+ echo " [plugin husky:pre-commit]: Running npm audit..."
17+ npm audit --audit-level=high
18+ if [ $? -ne 0 ]; then
19+ echo " ✗ Error: npm audit failed."
20+ exit 1
21+ fi
22+ echo " ✓ Done."
23+ echo " "
24+
25+ # 2. Проверка типов TypeScript без компиляции
26+ echo " [plugin husky:pre-commit]: Running tsc..."
27+ tsc --noEmit
28+ if [ $? -ne 0 ]; then
29+ echo " ✗ Error: TypeScript check failed."
30+ exit 1
31+ fi
32+ echo " ✓ Done."
33+ echo " "
34+
35+ # 3. Линтинг и форматирование
36+ echo " [plugin husky:pre-commit]: Running lint..."
37+ npm run lint
38+ if [ $? -ne 0 ]; then
39+ echo " ✗ Error: Linting failed."
40+ exit 1
41+ fi
42+ echo " ✓ Done."
43+ echo " "
44+
45+ echo " [plugin husky:pre-commit]: Running format..."
146npm run format
2- npm run lint
47+ if [ $? -ne 0 ]; then
48+ echo " ✗ Error: Formatting failed."
49+ exit 1
50+ fi
51+ echo " ✓ Done."
52+ echo " "
53+
54+ echo " [plugin husky:pre-commit]: All checks passed successfully."
55+ exit 0
Original file line number Diff line number Diff line change 1- npm run format
1+ #! /bin/bash
2+
3+ # Переходим в корневой каталог репозитория
4+ cd " $( git rev-parse --show-toplevel) " || exit 1
5+
6+ # Проверка на наличие node_modules
7+ echo " [plugin husky:pre-push]: Checking for node_modules..."
8+ if [ ! -d " node_modules" ]; then
9+ echo " ✗ Error: Missing node_modules. Please run 'npm install' first."
10+ exit 1
11+ fi
12+ echo " ✓ Done."
13+ echo " " # Добавляем пустую строку для лучшей читаемости
14+
15+ # 1. Запуск аудита безопасности
16+ echo " [plugin husky:pre-push]: Running npm audit..."
17+ npm audit --audit-level=high
18+ if [ $? -ne 0 ]; then
19+ echo " ✗ Error: npm audit failed."
20+ exit 1
21+ fi
22+ echo " ✓ Done."
23+ echo " "
24+
25+ # 2. Проверка типов TypeScript без компиляции
26+ echo " [plugin husky:pre-push]: Running tsc..."
27+ tsc --noEmit
28+ if [ $? -ne 0 ]; then
29+ echo " ✗ Error: TypeScript check failed."
30+ exit 1
31+ fi
32+ echo " ✓ Done."
33+ echo " "
34+
35+ # 3. Линтинг и форматирование
36+ echo " [plugin husky:pre-push]: Running lint..."
237npm run lint
3- npm run test
38+ if [ $? -ne 0 ]; then
39+ echo " ✗ Error: Linting failed."
40+ exit 1
41+ fi
42+ echo " ✓ Done."
43+ echo " "
44+
45+ echo " [plugin husky:pre-push]: Running format..."
46+ npm run format
47+ if [ $? -ne 0 ]; then
48+ echo " ✗ Error: Formatting failed."
49+ exit 1
50+ fi
51+ echo " ✓ Done."
52+ echo " "
53+
54+ echo " [plugin husky:pre-push]: Running test..."
55+ npm run test
56+ if [ $? -ne 0 ]; then
57+ echo " ✗ Error: Test failed."
58+ exit 1
59+ fi
60+ echo " ✓ Done."
61+ echo " "
62+
63+ echo " [plugin husky:pre-push]: All checks passed successfully."
64+ exit 0
You can’t perform that action at this time.
0 commit comments