-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·34 lines (27 loc) · 956 Bytes
/
setup.sh
File metadata and controls
executable file
·34 lines (27 loc) · 956 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
#!/usr/bin/env bash
set -euo pipefail
REPO_ROOT="$(git rev-parse --show-toplevel)"
cd "$REPO_ROOT"
# Create/update venv if needed
if [[ ! -f venv/bin/activate ]] || [[ requirements.txt -nt venv/bin/activate ]]; then
python3 -m venv venv
venv/bin/pip install -q -r requirements.txt
touch venv/bin/activate
fi
# Install Playwright Firefox browser if needed
if ! venv/bin/python -c "from playwright.sync_api import sync_playwright" 2>/dev/null; then
echo "Installing Playwright Firefox browser..."
venv/bin/playwright install firefox
fi
# Create ~/bin symlink
mkdir -p ~/bin
ln -sf "$REPO_ROOT/scripts/visual-diff" ~/bin/visual-diff
if [[ ":$PATH:" != *":$HOME/bin:"* ]]; then
echo "WARNING: ~/bin is not in PATH. Add to your shell profile:" >&2
echo " export PATH=\"\$HOME/bin:\$PATH\"" >&2
fi
# Check .env
if [[ ! -f .env ]]; then
echo "WARNING: .env not found. Copy .env.example to .env and fill in values." >&2
fi
echo "Setup OK."