@echo off
cd /d %~dp0

echo [INFO] Actualizando repositorio...
git checkout .
git pull

set NODE_VERSION=16.20.2

if "%NVM_HOME%"=="" set NVM_HOME=%APPDATA%\nvm
set NODE_PATH=%NVM_HOME%\v%NODE_VERSION%

echo [INFO] Activando Node %NODE_VERSION%...
call nvm use %NODE_VERSION%

echo [INFO] Node version:
"%NODE_PATH%\node.exe" -v

echo [INFO] NPM version:
call "%NODE_PATH%\npm.cmd" -v

echo [INFO] Instalando dependencias...
call "%NODE_PATH%\npm.cmd" install

echo [INFO] Ejecutando aplicacion...
"%NODE_PATH%\node.exe" index.js

pause