This repository has been archived by the owner on Jun 30, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
run.sh
40 lines (39 loc) · 1.38 KB
/
run.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
#!/bin/sh
if [ "$1" = "dev" ]; then
if [ "$2" = "audit" ]; then
(cd ./backend/ && npm audit)
cd ./frontend/ && npm audit
return
elif [ "$2" = "outdated" ]; then
(cd ./backend/ && npm outdated)
cd ./frontend/ && npm outdated
return
elif [ "$2" = "build" ]; then
(cd ./backend/ && npm install)
(cd ./backend/ && python -m venv ./virtual_environment/ && . ./virtual_environment/bin/activate && for line in $(cat ./requirements.txt); do python -m pip install "$line"; done && deactivate)
cd ./frontend/ && npm install && npm run build
return
elif [ "$2" = "up" ]; then
concurrently --names "backend,frontend" --prefix "{name}:" --prefix-colors "#f2caff,#61f2f2" "cd ./backend/ && npm run dev" "wait-for-it 0.0.0.0:1201 -t 0 && cd ./frontend/ && npm run dev"
return
fi
elif [ "$1" = "prod" ]; then
if [ "$2" = "build" ]; then
(cd ./backend/ && npm ci)
(cd ./backend/ && python -m venv ./virtual_environment/ && . ./virtual_environment/bin/activate && for line in $(cat ./requirements.txt); do python -m pip install "$line"; done && deactivate)
cd ./frontend/ && npm ci && npm run build
return
elif [ "$2" = "up" ]; then
cd ./backend/ && npm run prod_start
return
elif [ "$2" = "down" ]; then
cd ./backend/ && npm run prod_stop
return
elif [ "$2" = "update" ]; then
sh ./run.sh prod down
git pull
sh ./run.sh prod build
sh ./run.sh prod up
return
fi
fi