-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
239 lines (192 loc) · 7.6 KB
/
justfile
File metadata and controls
239 lines (192 loc) · 7.6 KB
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
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 apa := add-plugin-archive
alias cfrn := copy-js-code-from-quickstart-react-native
alias cl := clean
alias c := compile
alias d := doctor
alias ev := expo-version
alias ogp := open-github-prs
alias oi := open-ios
alias pi := pod-install
alias pr := prebuild
alias prc := prebuild-clean
alias pra := prebuild-android
alias prac := prebuild-android-clean
alias pri := prebuild-ios
alias pric := prebuild-ios-clean
alias ra := run-android
alias rad := run-android-device
alias radc := run-android-device-clean
alias re := reset-env
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}}
just pod-install
add-plugin-archive version:
npm i --save ../sdk-react-native/hypertrack-sdk-react-native-{{version}}.tgz
just pod-install
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}}
just pod-install
build-android-online:
eas build:run -p android
clean remove-lock="false" clean-npm-cache="false" clean-cocoapods-cache="false":
#!/usr/bin/env sh
set -euo pipefail
rm -rf node_modules
if {{remove-lock}}; then
rm -f package-lock.json
fi
if {{clean-npm-cache}}; then
npm cache clean --force
fi
if {{clean-cocoapods-cache}}; then
rm -rf ~/.cocoapods/repos/
npx pod deintegrate ios/quickstartexpo.xcodeproj
fi
compile:
npx tsc --noEmit
doctor:
npx expo-doctor
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
[working-directory: 'ios']
pod-install repo_update="false":
#!/usr/bin/env sh
set -euo pipefail
rm -f Podfile.lock
if [ "{{repo_update}}" = "true" ]; then
pod install --repo-update
else
pod install
fi
[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")
reset-env:
# remove-lock=true
just clean true
npm install
just prebuild-clean
just pod-install
[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 HyperTrack SDK React Native to {{version}}"
just open-github-prs
version:
@cat package.json | grep hypertrack-sdk-react-native | head -n 1 | grep -o -E '{{SEMVER_REGEX}}'