force rewrited code

This commit is contained in:
Krzysztof Cieślik
2026-04-15 17:38:49 +02:00
parent 6bbb24e633
commit 9a7cf8518d
16 changed files with 3167 additions and 109 deletions

85
justfile Normal file
View File

@@ -0,0 +1,85 @@
# Configuration
set shell := ["bash", "-c"]
export VIRTUAL_ENV := ""
backend_dir := "backend/app"
frontend_dir := "frontend"
venv_bin := backend_dir + "/.venv/bin"
# ============================================================================
# Default: Show help
# ============================================================================
[doc("Show available recipes")]
default:
@just --list
# ============================================================================
# Setup: Initialize dependencies
# ============================================================================
[doc("Install all dependencies")]
install: install-backend install-frontend
[doc("Install backend dependencies with uv")]
install-backend:
cd {{backend_dir}} && uv sync
[doc("Install portable Node.js and frontend dependencies")]
install-frontend: install-backend
@echo "Ensuring Node.js is available..."
@if ! command -v npm >/dev/null 2>&1 && [ ! -f "{{venv_bin}}/npm" ]; then \
echo "Installing portable Node.js inside Python venv..."; \
cd {{backend_dir}} && uv pip install nodeenv && uv run nodeenv -p; \
fi
@echo "Installing frontend dependencies..."
export PATH="$PWD/{{venv_bin}}:$PATH" && cd {{frontend_dir}} && npm install
# ============================================================================
# Development: Run services
# ============================================================================
[doc("Run backend server")]
run-backend: install-backend
cd {{backend_dir}} && uv run python3 main.py
[doc("Run frontend development server")]
run-frontend: install-frontend
export PATH="$PWD/{{venv_bin}}:$PATH" && cd {{frontend_dir}} && npm start
[doc("Run both services (Backend + GUI)")]
dev: install
@echo "Starting backend and frontend..."
export PATH="$PWD/{{venv_bin}}:$PATH"; \
(cd {{backend_dir}} && uv run python3 main.py) & \
BACKEND_PID=$$!; \
sleep 2; \
(cd {{frontend_dir}} && npm start) & \
FRONTEND_PID=$$!; \
trap "kill $$BACKEND_PID $$FRONTEND_PID 2>/dev/null" EXIT INT TERM; \
wait
# ============================================================================
# Build & Clean
# ============================================================================
[doc("Build frontend")]
build-frontend: install-frontend
export PATH="$PWD/{{venv_bin}}:$PATH" && cd {{frontend_dir}} && npm run build
[doc("Clean build artifacts and all dependencies")]
clean-all:
rm -rf {{backend_dir}}/.pytest_cache
rm -rf {{backend_dir}}/__pycache__
rm -rf {{backend_dir}}/src/__pycache__
rm -rf {{frontend_dir}}/build
rm -rf {{backend_dir}}/.venv
rm -rf {{frontend_dir}}/node_modules
find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
[doc("Check if tools are available")]
check:
@echo "Checking prerequisites..."
@command -v uv >/dev/null 2>&1 && echo "[OK] uv" || echo "[MISSING] uv"
@if command -v node >/dev/null 2>&1 || [ -f "{{venv_bin}}/node" ]; then echo "[OK] Node.js"; else echo "[MISSING] Node.js"; fi
@if command -v npm >/dev/null 2>&1 || [ -f "{{venv_bin}}/npm" ]; then echo "[OK] npm"; else echo "[MISSING] npm"; fi
@command -v python3 >/dev/null 2>&1 && echo "[OK] python3" || echo "[MISSING] python3"