-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjustfile
128 lines (102 loc) · 3.24 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
alias a := add-plugin
alias ag := add-plugin-from-github
alias al := add-plugin-local
alias ap := add-plugin
alias oi := open-ios
alias os := open-src
alias r := refresh-plugin-in-node_modules
alias ra := run-android
alias s := sync
alias sa := sync-android
alias si := sync-ios
alias us := update-sdk
alias v := version
alias va := version-android
REPOSITORY_NAME := "quickstart-ionic-capacitor"
SDK_NAME := "HyperTrack SDK Ionic Capacitor"
# 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-]+)*))?"
LOCAL_PLUGIN_PATH := "../sdk-ionic-capacitor"
add-plugin version: hooks _delete-angular-cache
npm i --save-exact hypertrack-sdk-ionic-capacitor@{{version}} --save
just pod-install
just sync
add-plugin-local: hooks _delete-angular-cache
rm -rf node_modules/hypertrack-sdk-ionic-capacitor
npm i {{LOCAL_PLUGIN_PATH}} --save
just build-local
just pod-install
just sync
add-plugin-from-github branch: hooks
@echo "Adding plugin from github does not work for Ionic Capacitor. Use 'just al' to use local dependency"
@exit 1
build-local:
#!/usr/bin/env sh
if cat package.json | grep -q {{LOCAL_PLUGIN_PATH}}; then \
cd {{LOCAL_PLUGIN_PATH}}; \
npm run build; \
else \
echo "No local dependency"; \
fi
check-outdated:
npm outdated
compile: hooks
npx tsc
hooks:
chmod +x .githooks/pre-push
git config core.hooksPath .githooks
open-github-prs:
open "https://github.com/hypertrack/{{REPOSITORY_NAME}}/pulls"
open-ios: hooks
open ios/App/App.xcworkspace
open-src: hooks
code src/app/home/home.page.ts
pod-install:
#!/usr/bin/env sh
set -euo pipefail
cd ios/App
rm -f Podfile.lock
pod install --repo-update
cd ../..
refresh-deps: hooks
rm -r node_modules
rm package-lock.json
npm i
refresh-plugin-in-node_modules:
rm -r node_modules/hypertrack-sdk-ionic-capacitor
npm i
run-android target="": sync-android hooks
#!/usr/bin/env sh
set -euo pipefail
if [ -z "{{target}}" ]; then \
ionic capacitor run android; \
else \
ionic capacitor run android --target {{target}}; \
fi
sync: hooks _delete-www build-local
ionic capacitor sync
sync-ios: hooks _delete-www build-local
ionic capacitor sync ios
sync-android: hooks _delete-www build-local
ionic capacitor sync android
update-deps: hooks
npx npm-check-updates -u
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-ionic-capacitor | 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 ..
_delete-www:
rm -rf www
# fixes issues with packing outdated code to the app
_delete-angular-cache:
rm -rf .angular