-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·38 lines (27 loc) · 913 Bytes
/
run.sh
File metadata and controls
executable file
·38 lines (27 loc) · 913 Bytes
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
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
API_ENV_EXAMPLE="$ROOT_DIR/apps/api/.env.example"
API_ENV_FILE="$ROOT_DIR/apps/api/.env"
WEB_ENV_EXAMPLE="$ROOT_DIR/apps/web/.env.example"
WEB_ENV_FILE="$ROOT_DIR/apps/web/.env"
ensure_env() {
local example_file="$1"
local target_file="$2"
if [ -f "$target_file" ]; then
return
fi
cp "$example_file" "$target_file"
echo "Criado $(realpath --relative-to="$ROOT_DIR" "$target_file") a partir do exemplo."
}
cd "$ROOT_DIR"
echo "Instalando dependências..."
npm install
ensure_env "$API_ENV_EXAMPLE" "$API_ENV_FILE"
ensure_env "$WEB_ENV_EXAMPLE" "$WEB_ENV_FILE"
echo "Aplicando migrações..."
npm run migrate --workspace @noctification/api
echo "Garantindo admin fixo..."
npm run bootstrap-admin --workspace @noctification/api
echo "Subindo API e frontend..."
exec npm run dev