74 lines
2.4 KiB
TypeScript
74 lines
2.4 KiB
TypeScript
import { defineConfig } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
import tailwindcss from '@tailwindcss/vite'
|
|
import { VitePWA } from 'vite-plugin-pwa'
|
|
import path from 'path'
|
|
import fs from 'fs'
|
|
|
|
try {
|
|
const svgPath = path.resolve(__dirname, '../logotipo_brainwind color original3.svg')
|
|
if (fs.existsSync(svgPath)) {
|
|
let text = fs.readFileSync(svgPath, 'utf8')
|
|
text = text.replace(/([0-9]+\.[0-9]+)/g, (m) => parseFloat(m).toFixed(1).replace(/\.0$/, ''))
|
|
text = text.replace(/\s+/g, ' ')
|
|
fs.mkdirSync(path.resolve(__dirname, 'public'), { recursive: true })
|
|
fs.writeFileSync(path.resolve(__dirname, 'public/logo_brainwind.svg'), text)
|
|
fs.writeFileSync(path.resolve(__dirname, 'public/logo_brainwind_dark.svg'), text.replace(/#06315A/gi, '#E2E8F0'))
|
|
}
|
|
|
|
const pngPath = path.resolve(__dirname, '../logotipo_brainwind color original.png')
|
|
if (fs.existsSync(pngPath)) {
|
|
fs.mkdirSync(path.resolve(__dirname, 'public'), { recursive: true })
|
|
fs.copyFileSync(pngPath, path.resolve(__dirname, 'public/logo_brainwind.png'))
|
|
}
|
|
} catch(e) {}
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
plugins: [
|
|
react(),
|
|
tailwindcss(),
|
|
VitePWA({
|
|
registerType: 'autoUpdate',
|
|
includeAssets: ['favicon.ico', 'apple-touch-icon.png', 'logo_brainwind.svg'],
|
|
manifest: {
|
|
name: 'VentoApp - BrainWind',
|
|
short_name: 'VentoApp',
|
|
description: 'Cálculo de ação do vento NBR 6123:2023',
|
|
theme_color: '#020617', // slate-950
|
|
background_color: '#ffffff',
|
|
display: 'standalone',
|
|
icons: [
|
|
{
|
|
src: 'logo_brainwind.png',
|
|
sizes: '192x192',
|
|
type: 'image/png'
|
|
},
|
|
{
|
|
src: 'logo_brainwind.png',
|
|
sizes: '512x512',
|
|
type: 'image/png',
|
|
purpose: 'any maskable'
|
|
}
|
|
]
|
|
},
|
|
workbox: {
|
|
globPatterns: ['**/*.{js,css,html,ico,png,svg,json}'],
|
|
maximumFileSizeToCacheInBytes: 5000000 // 5MB limit for 3D assets
|
|
}
|
|
})
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
"@": path.resolve(__dirname, "./src"),
|
|
},
|
|
},
|
|
server: {
|
|
// Permite acesso via hostnames customizados em dev (Traefik/Coolify)
|
|
allowedHosts: true,
|
|
},
|
|
preview: {
|
|
// Permite acesso via hostnames customizados em preview (produção via Coolify)
|
|
allowedHosts: true,
|
|
},
|
|
}) |