#!/bin/bash
echo "============================================"
echo "Installing dependencies for custom nodes"
echo "============================================"

VENV_PYTHON="./.venv/bin/python"

if [ ! -d "custom_nodes" ]; then
    echo "[ERROR] Folder 'custom_nodes' not found in this directory."
    exit 1
fi

for dir in custom_nodes/*/ ; do
    if [ -f "$dir/requirements.txt" ]; then
        echo "Installing requirements for $(basename "$dir")..."
        "$VENV_PYTHON" -m pip install -r "$dir/requirements.txt"
    fi
done

echo "Installing core ML dependencies..."
"$VENV_PYTHON" -m pip install diffusers transformers accelerate huggingface_hub

echo "Done installing all dependencies!"
