-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathgen.sh
executable file
·44 lines (36 loc) · 930 Bytes
/
gen.sh
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
#!/usr/bin/env bash
set -e
# Paths
RPC_PATH="rpc"
MODELS_PATH="pkg/stores/models"
UI_GEN_PATH="liwords-ui/src/gen"
USER_GROUP="unprivileged:unprivileged"
# Functions
buf_generate() {
echo "Starting buf generate"
(
cd api || exit
buf generate
)
chown -R "$USER_GROUP" "$RPC_PATH"
chown -R "$USER_GROUP" "$UI_GEN_PATH"
}
sqlc_generate() {
echo "Starting sqlc generate"
sqlc generate
chown -R "$USER_GROUP" "$MODELS_PATH"
}
set_permissions() {
echo "Setting permissions"
chmod -R o+w "$UI_GEN_PATH"
chmod -R o+w "$RPC_PATH"
chmod -R o+w "$MODELS_PATH"
}
# Check if necessary commands exist
command -v buf >/dev/null 2>&1 || { echo "buf command not found. Please install buf."; exit 1; }
command -v sqlc >/dev/null 2>&1 || { echo "sqlc command not found. Please install sqlc."; exit 1; }
# Main script
buf_generate
sqlc_generate
# set_permissions
echo "Done. Thank you for using our generator."