generated from sripwoud/ts-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.setup
executable file
·41 lines (34 loc) · 1.1 KB
/
.setup
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
#!/bin/bash
set -eou pipefail
BROWN=$'\033[0;33m'
RED=$'\033[0;31m'
NC=$'\033[0m'
print() { printf "%s\n" "$1"; }
is_bun_installed() {
if ! command -v bun &>/dev/null; then
print "${BROWN}bun$NC ${RED}is not installed$NC"
print "Check instructions at ${BROWN}https://bun.sh$NC"
exit 1
fi
}
is_docker_installed() {
if ! command -v docker &>/dev/null; then
print "${BROWN}docker$NC ${RED}is not installed$NC"
print "Check instructions at ${BROWN}https://docs.docker.com/get-started/get-docker/$NC"
exit 1
fi
}
env_setup() {
cp -n .envrc{.example,}
print "Edit ${BROWN}.envrc$NC file to set the required environment variables. Then source it with ${BROWN}source .envrc$NC"
}
main() {
is_bun_installed
is_docker_installed
bun i
bun run db-reset
env_setup
print "Run ${BROWN}bun dev$NC to start the server and client in development mode."
print "To enjoy realtime updates upon question creation and feedback submission, you need to enable publications for the ${BROWN}questions$NC table at ${BROWN}http://localhost:54323/project/default/database/publications$NC"
}
main