#!/bin/bash

# 🚀 Script de Configuração Ubuntu/Debian - PraFrota FE

set -e

echo "Iniciando instalação para Ubuntu/Debian..."

# Atualizar e instalar bases
sudo apt update
sudo apt install -y git curl build-essential

# NVM e Node
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"

nvm install 20.12.0
nvm use 20.12.0

# Projeto
npm install --legacy-peer-deps
npm run build libs

echo "✅ Pronto!"
