-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathpre-push
executable file
·55 lines (44 loc) · 2.01 KB
/
pre-push
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/sh
check_error="Git hook check error"
# Check if there are any local dependencies in the package.json file
local_deps=$(grep -E "file:.*\..*" package.json)
# If local dependencies are found, exit with an error message
if [ "$local_deps" ]; then
echo "$check_error: Local dependencies found in package.json: \n\n $local_deps \n\n Push blocked to prevent committing local dependencies."
exit 1
fi
# Check if there are any Github dependencies in the package.json file
github_deps=$(grep -E "https://github.com" package.json)
# If github dependencies are found, exit with an error message
if [ "$github_deps" ]; then
echo "$check_error: Github dependencies found in package.json: \n\n $github_deps \n\n Push blocked to prevent committing Github dependencies."
exit 1
fi
if grep -q "'.\{86\}'" "src/App.tsx"; then
echo "$check_error: PUBLISHABLE_KEY is set"
exit 1
fi
if ! grep -q "value=\"Paste_your_publishable_key_here" "android/app/src/main/AndroidManifest.xml"; then
echo "$check_error: PUBLISHABLE_KEY is probably set ('Paste_your_publishable_key_here' not found in AndroidManifest)"
exit 1
fi
if ! grep -q "<string>Paste_your_publishable_key_here" "ios/QuickstartReactNative/Info.plist"; then
echo "$check_error: PUBLISHABLE_KEY is probably set ('Paste_your_publishable_key_here' not found in Info.plist)"
exit 1
fi
xcode_project_config_path="ios/QuickstartReactNative.xcodeproj/project.pbxproj"
# Check if the xcodeproj command line tool is installed
if ! type "xcodeproj" >/dev/null; then
echo "$check_error: The xcodeproj command line tool is not installed. Unable to check if the development team is set up."
else
# Check if the project file exists
if [ ! -f $xcode_project_config_path ]; then
echo "$check_error: The project file '$xcode_project_config_path' does not exist."
exit 1
fi
# Check if the development team is set up
if cat $xcode_project_config_path | grep -q -E 'DEVELOPMENT_TEAM\s*=\s*[A-Z0-9]{10}'; then
echo "$check_error: iOS Development team is set up."
exit 1
fi
fi