diff --git a/deploy.sh b/deploy.sh index 8f099d9..34b24af 100755 --- a/deploy.sh +++ b/deploy.sh @@ -134,6 +134,31 @@ echo "📋 Copying application files..." cp -r dist/. "$WEBROOT/" echo "✅ Application files copied ($(du -sh dist | cut -f1))" +# Copy package.json for runtime dependencies +echo "📦 Setting up runtime dependencies..." +cp package.json "$WEBROOT/" +echo "✅ package.json copied" + +# Install production dependencies in webroot +echo "📦 Installing runtime dependencies..." +cd "$WEBROOT" +if command -v npm &> /dev/null; then + npm install --production + echo "✅ Runtime dependencies installed" +else + sudo -u "$ORIGINAL_USER" bash -c " + cd '$WEBROOT' + export NVM_DIR='$ORIGINAL_HOME/.nvm' + [ -s '\$NVM_DIR/nvm.sh' ] && source '\$NVM_DIR/nvm.sh' + [ -s '$ORIGINAL_HOME/.bashrc' ] && source '$ORIGINAL_HOME/.bashrc' + npm install --production + " + echo "✅ Runtime dependencies installed via nvm" +fi + +# Return to source directory +cd - > /dev/null + # Copy essential data files echo "🗂️ Setting up data files..." if [ -f "src/data/tools.yaml" ]; then