-
Notifications
You must be signed in to change notification settings - Fork 0
/
justfile
188 lines (151 loc) · 6.57 KB
/
justfile
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
alias a := add-plugin
alias ael := add-expo-plugin-local
alias aep := add-expo-plugin
alias al := add-plugin-local
alias ap := add-plugin
alias cfrn := copy-js-code-from-quickstart-react-native
alias cl := clean
alias cm := compile
alias ev := expo-version
alias ogp := open-github-prs
alias oi := open-ios
alias pa := prebuild-android
alias pi := prebuild-ios
alias ra := run-android
alias rad := run-android-device
alias radc := run-android-device-clean
alias ri := run-ios
alias rid := run-ios-device
alias ridc := run-ios-device-clean
alias s:= setup
alias sm := start-metro
alias urs := update-react-native-sdk
alias v := version
SDK_NAME := "HyperTrack SDK Expo"
SDK_REPOSITORY_NAME := "sdk-expo"
QUICKSTART_REPOSITORY_NAME := "quickstart-expo"
# Source: https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
# \ are escaped
SEMVER_REGEX := "(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?"
ACTIVITY_SERVICE_GOOGLE_PLUGIN_LOCAL_PATH := "../sdk-react-native/plugin_android_activity_service_google"
LOCATION_SERVICES_GOOGLE_PLUGIN_LOCAL_PATH := "../sdk-react-native/plugin_android_location_services_google"
LOCATION_SERVICES_GOOGLE_19_0_1_PLUGIN_LOCAL_PATH := "../sdk-react-native/plugin_android_location_services_google_19_0_1"
PUSH_SERVICE_FIREBASE_PLUGIN_LOCAL_PATH := "../sdk-react-native/plugin_android_push_service_firebase"
QUICKSTART_REACT_NATIVE_LOCAL_PATH := "../quickstart-react-native"
SDK_PLUGIN_LOCAL_PATH := "../sdk-react-native/sdk"
add-expo-plugin version: hooks
#!/usr/bin/env sh
set -euo pipefail
if grep -q '"hypertrack-sdk-expo"' package.json; then
npm uninstall hypertrack-sdk-expo
fi
npm i --save-exact hypertrack-sdk-expo@{{version}}
add-expo-plugin-local: hooks
npm install --save ../sdk-expo
add-plugin version: hooks
#!/usr/bin/env sh
set -euo pipefail
if grep -q '"hypertrack-sdk-react-native"' package.json; then
npm uninstall hypertrack-sdk-react-native
fi
if grep -q '"hypertrack-sdk-react-native-plugin-android-activity-service-google"' package.json; then
npm uninstall hypertrack-sdk-react-native-plugin-android-activity-service-google
fi
if grep -q '"hypertrack-sdk-react-native-plugin-android-location-services-google"' package.json; then
npm uninstall hypertrack-sdk-react-native-plugin-android-location-services-google
fi
if grep -q '"hypertrack-sdk-react-native-plugin-android-push-service-firebase"' package.json; then
npm uninstall hypertrack-sdk-react-native-plugin-android-push-service-firebase
fi
MAJOR_VERSION=$(echo {{version}} | grep -o '^[0-9]\+')
if [ $MAJOR_VERSION -ge 12 ]; then
npm i --save-exact hypertrack-sdk-react-native-plugin-android-activity-service-google@{{version}}
npm i --save-exact hypertrack-sdk-react-native-plugin-android-location-services-google@{{version}}
npm i --save-exact hypertrack-sdk-react-native-plugin-android-push-service-firebase@{{version}}
fi
npm i --save-exact hypertrack-sdk-react-native@{{version}}
add-plugin-local: hooks
#!/usr/bin/env sh
set -euo pipefail
if grep -q '"hypertrack-sdk-react-native"' package.json; then
npm uninstall hypertrack-sdk-react-native
fi
if grep -q '"hypertrack-sdk-react-native-plugin-android-activity-service-google"' package.json; then
npm uninstall hypertrack-sdk-react-native-plugin-android-activity-service-google
fi
if grep -q '"hypertrack-sdk-react-native-plugin-android-location-services-google"' package.json; then
npm uninstall hypertrack-sdk-react-native-plugin-android-location-services-google
fi
if grep -q '"hypertrack-sdk-react-native-plugin-android-push-service-firebase"' package.json; then
npm uninstall hypertrack-sdk-react-native-plugin-android-push-service-firebase
fi
npm i hypertrack-sdk-react-native@file:{{SDK_PLUGIN_LOCAL_PATH}}
npm i hypertrack-sdk-react-native-plugin-android-activity-service-google@file:{{ACTIVITY_SERVICE_GOOGLE_PLUGIN_LOCAL_PATH}}
npm i hypertrack-sdk-react-native-plugin-android-location-services-google@file:{{LOCATION_SERVICES_GOOGLE_PLUGIN_LOCAL_PATH}}
npm i hypertrack-sdk-react-native-plugin-android-push-service-firebase@file:{{PUSH_SERVICE_FIREBASE_PLUGIN_LOCAL_PATH}}
build-android-online:
eas build:run -p android
clean:
rm -rf node_modules
npm cache clean --force
npx pod deintegrate ios/quickstartexpo.xcodeproj
compile:
npx tsc
copy-js-code-from-quickstart-react-native:
cp -f {{QUICKSTART_REACT_NATIVE_LOCAL_PATH}}/src/App.tsx .
create-eas-online-build:
eas build -p android --profile preview
expo-version:
@cat package.json | grep hypertrack-sdk-expo | head -n 1 | grep -o -E '{{SEMVER_REGEX}}'
extract-plugin-nm:
rm -rf {{SDK_PLUGIN_LOCAL_PATH}}/node_modules
mkdir {{SDK_PLUGIN_LOCAL_PATH}}/node_modules
cp -r node_modules/hypertrack-sdk-react-native/node_modules {{SDK_PLUGIN_LOCAL_PATH}}/node_modules
hooks:
chmod +x .githooks/pre-push
git config core.hooksPath .githooks
open-android:
studio android
open-github-prs:
open "https://github.com/hypertrack/{{QUICKSTART_REPOSITORY_NAME}}/pulls"
open-ios:
open ios/quickstartexpo.xcworkspace
[private]
_prebuild flags="":
npx expo prebuild {{flags}}
prebuild: _prebuild
prebuild-clean: (_prebuild "--clean")
prebuild-android: (_prebuild "--platform android")
prebuild-android-clean: (_prebuild "--platform android --clean")
prebuild-ios: (_prebuild "--platform ios")
prebuild-ios-clean: (_prebuild "--platform ios --clean")
[private]
_run target="" flags="":
npx expo run{{target}} {{flags}}
run-android: compile
just _run ":android"
run-android-device device="": compile
just _run ":android" "-d {{device}}"
run-android-device-clean device="": compile
just _run ":android" "-d {{device}} --no-build-cache"
run-ios: compile
just _run ":ios"
run-ios-device device="": compile
just _run ":ios" "-d {{device}}"
run-ios-device-clean device="": compile
just _run ":ios" "-d {{device}} --no-build-cache"
setup: hooks
npm install --global expo-cli
npm install
just prebuild
cd ios && pod install
start-metro flags="": compile
npm start {{flags}}
start-metro-clean: (start-metro "-c")
update-react-native-sdk version: hooks
git checkout -b update-sdk-{{version}}
just add-plugin {{version}}
git commit -am "Update {{SDK_NAME}} to {{version}}"
just open-github-prs
version:
@cat package.json | grep hypertrack-sdk-react-native | head -n 1 | grep -o -E '{{SEMVER_REGEX}}'