-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun
executable file
·59 lines (50 loc) · 1.19 KB
/
run
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
#!/bin/sh
set -e
run_install()
{
# check for node and yarn
NODE_VERSION="v18"
if ! node -v | grep -q "$NODE_VERSION"; then
echo Please install node $NODE_VERSION before running this project
exit 1
fi
if ! command -v yarn >/dev/null; then
echo Please install yarn before running this project
exit 1
fi
# install node packages
(cd backend && yarn)
(cd frontend && yarn)
# download compose script
curl -O https://raw.githubusercontent.com/bdeak4/bin/master/compose
chmod +x compose
# copy sample .env file
if [ ! -f .env ]; then
cp .env.example .env
echo Please insert variables in .env
fi
}
run_dev()
{
echo "Environment variables from .env files loaded"
if [ -f .env ]; then
export $(grep -v '^#' .env | xargs)
fi
./compose \
--frontend "yarn --cwd frontend dev" \
--backend "yarn --cwd backend dev"
}
show_help()
{
echo "error: unknown parameter passed \"$1\""
echo "usage: $0 [-i] [-d]"
echo
echo " -i, --install Install project dependencies"
echo " -d, --dev Run project in development mode"
echo
}
case "$1" in
-i|--install) run_install ;;
-d|--dev) run_dev ;;
*) show_help ;;
esac