| 1 |
#!/usr/bin/env bash |
| 2 |
# Setups the repository. |
| 3 |
|
| 4 |
# Stop on errors |
| 5 |
set -e |
| 6 |
|
| 7 |
# Use copy mode for UV to avoid hardlink warnings on different filesystems |
| 8 |
export UV_LINK_MODE=copy |
| 9 |
|
| 10 |
# Find the absolute path of the directory where this script resides |
| 11 |
SETUP_SCRIPT_DIR=$(cd -- "$(dirname -- "$0")" &>/dev/null && pwd) |
| 12 |
|
| 13 |
# Fetch the centralized uv version from the companion script |
| 14 |
UV_VERSION=$("$SETUP_SCRIPT_DIR/get-pyproject-uv.version.sh") |
| 15 |
|
| 16 |
if ! uv --version 2>/dev/null; then |
| 17 |
pipx install "uv==$UV_VERSION" |
| 18 |
elif ! uv --version 2>/dev/null | grep -q "$UV_VERSION"; then |
| 19 |
pipx upgrade "uv==$UV_VERSION" |
| 20 |
fi |
| 21 |
if ! prek --version 2>/dev/null; then |
| 22 |
uv tool install prek |
| 23 |
fi |
| 24 |
uv sync --frozen --all-groups |
| 25 |
prek install --overwrite |
| 26 |
prek install --hook-type commit-msg --overwrite |
| 27 |
|
| 28 |
npm install @commitlint/config-conventional |