#!/bin/sh
set -e

echo "==> Checking node_modules..."

# If node_modules is empty/missing, copy from cache
if [ ! -d "node_modules/react" ]; then
    echo "==> Initializing node_modules from cache..."
    cp -r /node_modules_cache/* node_modules/ 2>/dev/null || cp -r /node_modules_cache/. node_modules/
    echo "==> Done"
else
    echo "==> node_modules already initialized"
fi

echo "==> Starting Feeld Web..."
exec "$@"
