feat: Update project dependencies and configuration

This commit updates the project's dependencies, including React, Recharts, and Lucide React, to their latest stable versions. It also introduces a `server.js` file to handle static file serving with Express for better production deployment. Additionally, TypeScript and Vite configurations have been refined for improved build performance and type safety.
This commit is contained in:
MMrp89
2026-02-10 01:12:15 -03:00
parent 1a57ac7754
commit 8c770d43c8
6 changed files with 90 additions and 68 deletions

3
.env.example Normal file
View File

@@ -0,0 +1,3 @@
# Gemini API Key (Obtenha em https://aistudio.google.com/)
API_KEY=sua_chave_aqui

View File

@@ -1,3 +1,4 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="pt-BR"> <html lang="pt-BR">
<head> <head>
@@ -15,7 +16,7 @@
font-family: 'Akzidenz Grotesk', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-family: 'Akzidenz Grotesk', 'Helvetica Neue', Helvetica, Arial, sans-serif;
background-color: #F8FAFC; /* Slate 50 */ background-color: #F8FAFC; /* Slate 50 */
} }
/* Custom scrollbar for a cleaner look */ /* Custom scrollbar */
::-webkit-scrollbar { ::-webkit-scrollbar {
width: 8px; width: 8px;
height: 8px; height: 8px;
@@ -45,11 +46,11 @@
200: '#fed7aa', 200: '#fed7aa',
300: '#fdba74', 300: '#fdba74',
400: '#fb923c', 400: '#fb923c',
500: '#f97316', // Orange-500 main accent 500: '#f97316',
600: '#ea580c', 600: '#ea580c',
}, },
secondary: { secondary: {
900: '#0f172a', // Dark slate for text 900: '#0f172a',
800: '#1e293b', 800: '#1e293b',
} }
}, },
@@ -65,17 +66,23 @@
<script type="importmap"> <script type="importmap">
{ {
"imports": { "imports": {
"react-dom/": "https://esm.sh/react-dom@^19.2.3/", "vite": "https://esm.sh/vite@^7.3.1",
"lucide-react": "https://esm.sh/lucide-react@^0.562.0", "@google/genai": "https://esm.sh/@google/genai@^1.40.0",
"react/": "https://esm.sh/react@^19.2.3/", "recharts": "https://esm.sh/recharts@^3.7.0",
"react": "https://esm.sh/react@^19.2.3", "path": "https://esm.sh/path@^0.12.7",
"recharts": "https://esm.sh/recharts@^3.6.0", "react/": "https://esm.sh/react@^19.2.4/",
"@google/genai": "https://esm.sh/@google/genai@^1.39.0" "react": "https://esm.sh/react@^19.2.4",
"express": "https://esm.sh/express@^5.2.1",
"react-dom/": "https://esm.sh/react-dom@^19.2.4/",
"url": "https://esm.sh/url@^0.11.4",
"@vitejs/plugin-react": "https://esm.sh/@vitejs/plugin-react@^5.1.3",
"lucide-react": "https://esm.sh/lucide-react@^0.563.0"
} }
} }
</script> </script>
</head> </head>
<body> <body>
<div id="root"></div> <div id="root"></div>
<script type="module" src="/index.tsx"></script>
</body> </body>
</html> </html>

View File

@@ -1,24 +1,29 @@
{ {
"name": "comfi", "name": "comfi-management-system",
"private": true, "private": true,
"version": "0.0.0", "version": "1.0.0",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"build": "vite build", "build": "tsc && vite build",
"preview": "vite preview" "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview",
"start": "node server.js"
}, },
"dependencies": { "dependencies": {
"react-dom": "^19.2.3", "@google/genai": "^1.39.0",
"lucide-react": "^0.562.0", "lucide-react": "^0.454.0",
"react": "^19.2.3", "react": "^19.0.0",
"recharts": "^3.6.0", "react-dom": "^19.0.0",
"@google/genai": "^1.39.0" "recharts": "^2.13.0",
"express": "^4.21.1"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^22.14.0", "@types/react": "^19.0.0",
"@vitejs/plugin-react": "^5.0.0", "@types/react-dom": "^19.0.0",
"typescript": "~5.8.2", "@vitejs/plugin-react": "^4.3.3",
"vite": "^6.2.0" "typescript": "^5.6.3",
"vite": "^5.4.10"
} }
} }

22
server.js Normal file
View File

@@ -0,0 +1,22 @@
import express from 'express';
import path from 'path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const app = express();
const PORT = process.env.PORT || 8080;
// Servir os arquivos estáticos da pasta 'dist' gerada pelo build do Vite
app.use(express.static(path.join(__dirname, 'dist')));
// Redirecionar todas as rotas para o index.html (suporte a SPA)
app.get('*', (req, res) => {
res.sendFile(path.join(__dirname, 'dist', 'index.html'));
});
app.listen(PORT, () => {
console.log(`Servidor rodando na porta ${PORT}`);
});

View File

@@ -1,29 +1,22 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "ES2022", "target": "ESNext",
"experimentalDecorators": true, "useDefineForClassFields": true,
"useDefineForClassFields": false, "lib": ["DOM", "DOM.Iterable", "ESNext"],
"module": "ESNext", "allowJs": false,
"lib": [
"ES2022",
"DOM",
"DOM.Iterable"
],
"skipLibCheck": true, "skipLibCheck": true,
"types": [ "esModuleInterop": false,
"node" "allowSyntheticDefaultImports": true,
], "strict": true,
"moduleResolution": "bundler", "forceConsistentCasingInFileNames": true,
"module": "ESNext",
"moduleResolution": "Node",
"resolveJsonModule": true,
"isolatedModules": true, "isolatedModules": true,
"moduleDetection": "force", "noEmit": true,
"allowJs": true, "jsx": "react-jsx"
"jsx": "react-jsx", },
"paths": { "include": ["**/*.ts", "**/*.tsx"],
"@/*": [ "exclude": ["node_modules", "dist"]
"./*" }
]
},
"allowImportingTsExtensions": true,
"noEmit": true
}
}

View File

@@ -1,23 +1,15 @@
import path from 'path';
import { defineConfig, loadEnv } from 'vite'; import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react'; import react from '@vitejs/plugin-react';
export default defineConfig(({ mode }) => { // https://vitejs.dev/config/
const env = loadEnv(mode, '.', ''); export default defineConfig({
return { plugins: [react()],
server: { define: {
port: 3000, 'process.env': process.env
host: '0.0.0.0', },
}, build: {
plugins: [react()], outDir: 'dist',
define: { emptyOutDir: true,
'process.env.API_KEY': JSON.stringify(env.GEMINI_API_KEY), }
'process.env.GEMINI_API_KEY': JSON.stringify(env.GEMINI_API_KEY)
},
resolve: {
alias: {
'@': path.resolve(__dirname, '.'),
}
}
};
}); });