[build]
command = """
# ===== CONFIGURAÇÃO DE CACHE =====
export CARGO_HOME=/opt/build/cache/cargo
export RUSTUP_HOME=/opt/build/cache/rustup
export PATH="$CARGO_HOME/bin:$PATH"
# ===== INSTALA RUST (SE NECESSÁRIO) =====
if [ ! -f "$CARGO_HOME/bin/cargo" ]; then
echo "📦 Instalando Rust..."
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path
export PATH="$HOME/.cargo/bin:$PATH"
source "$HOME/.cargo/env"
else
echo "✅ Rust já está em cache"
fi
# ===== ADICIONA TARGET WASM =====
echo "🎯 Adicionando target wasm32-unknown-unknown..."
rustup target add wasm32-unknown-unknown
# ===== INSTALA TRUNK (SE NECESSÁRIO) =====
if ! command -v trunk &> /dev/null; then
echo "🔧 Instalando trunk..."
cargo install trunk --locked
else
echo "✅ trunk já está instalado"
fi
# ===== BUILD =====
echo "🚀 Buildando com trunk..."
trunk build --release
echo "✅ Build concluído!"
"""
publish = "dist"
[[headers]]
for = "/*"
[headers.values]
Cross-Origin-Opener-Policy = "same-origin"
Cross-Origin-Embedder-Policy = "require-corp"
Cache-Control = "public, max-age=0, must-revalidate"
[[headers]]
for = "*.wasm"
[headers.values]
Content-Type = "application/wasm"
Cache-Control = "public, max-age=31536000, immutable"
[template]
name = "sqlite-wasm"
[[redirects]]
from = "/static/*"
to = "/static/:splat"
status = 200
force = true