-
Notifications
You must be signed in to change notification settings - Fork 6
/
justfile
132 lines (109 loc) · 4.99 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
alias a := add-plugin
alias al := add-plugin-local
alias ap := add-plugin
alias c := compile
alias cn := clear-nm
alias epn := extract-plugin-nm
alias ogp := open-github-prs
alias oi := open-ios
alias pi := pod-install
alias ra := run-android
alias sm := start-metro
alias us := update-sdk
alias v := version
alias va := version-android
REPOSITORY_NAME := "quickstart-react-native"
SDK_NAME := "HyperTrack SDK React Native"
# 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"
SDK_PLUGIN_LOCAL_PATH := "../sdk-react-native/sdk"
add-plugin version: hooks
#!/usr/bin/env sh
set -euo pipefail
if grep -q '"hypertrack-sdk-react-native"' package.json; then
yarn remove hypertrack-sdk-react-native
fi
if grep -q '"hypertrack-sdk-react-native-plugin-android-activity-service-google"' package.json; then
yarn remove 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
yarn remove 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
yarn remove hypertrack-sdk-react-native-plugin-android-push-service-firebase
fi
MAJOR_VERSION=$(echo {{version}} | grep -o '^[0-9]\+')
if [ $MAJOR_VERSION -ge 12 ]; then
yarn add hypertrack-sdk-react-native-plugin-android-activity-service-google@{{version}}
yarn add hypertrack-sdk-react-native-plugin-android-location-services-google@{{version}}
yarn add hypertrack-sdk-react-native-plugin-android-push-service-firebase@{{version}}
fi
yarn add hypertrack-sdk-react-native@{{version}}
just pod-install
add-plugin-local: hooks
#!/usr/bin/env sh
set -euo pipefail
yarn add hypertrack-sdk-react-native
just extract-plugin-nm
if grep -q '"hypertrack-sdk-react-native"' package.json; then
yarn remove hypertrack-sdk-react-native
fi
if grep -q '"hypertrack-sdk-react-native-plugin-android-activity-service-google"' package.json; then
yarn remove 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
yarn remove 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
yarn remove hypertrack-sdk-react-native-plugin-android-push-service-firebase
fi
yarn add hypertrack-sdk-react-native@file:{{SDK_PLUGIN_LOCAL_PATH}}
yarn add hypertrack-sdk-react-native-plugin-android-activity-service-google@file:{{ACTIVITY_SERVICE_GOOGLE_PLUGIN_LOCAL_PATH}}
yarn add hypertrack-sdk-react-native-plugin-android-location-services-google@file:{{LOCATION_SERVICES_GOOGLE_PLUGIN_LOCAL_PATH}}
yarn add hypertrack-sdk-react-native-plugin-android-push-service-firebase@file:{{PUSH_SERVICE_FIREBASE_PLUGIN_LOCAL_PATH}}
just pod-install
clear-nm: hooks
rm -rf node_modules
rm yarn.lock
compile: hooks
npx tsc
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-github-prs:
open "https://github.com/hypertrack/{{REPOSITORY_NAME}}/pulls"
open-ios:
open ios/QuickstartReactNative.xcworkspace
pod-install:
#!/usr/bin/env sh
cd ios
rm -f Podfile.lock
pwd
NO_FLIPPER=1 pod install --repo-update
cd ..
run-android: hooks compile
npx react-native run-android
start-metro: hooks compile
npx react-native start
update-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}}'
version-android:
#!/usr/bin/env sh
set -euo pipefail
cd android
./gradlew app:dependencies | grep "com.hypertrack:sdk-android" | head -n 1 | grep -o -E '{{SEMVER_REGEX}}'
cd ..