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

View File

@@ -1,24 +1,29 @@
{
"name": "comfi",
"name": "comfi-management-system",
"private": true,
"version": "0.0.0",
"version": "1.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview",
"start": "node server.js"
},
"dependencies": {
"react-dom": "^19.2.3",
"lucide-react": "^0.562.0",
"react": "^19.2.3",
"recharts": "^3.6.0",
"@google/genai": "^1.39.0"
"@google/genai": "^1.39.0",
"lucide-react": "^0.454.0",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"recharts": "^2.13.0",
"express": "^4.21.1"
},
"devDependencies": {
"@types/node": "^22.14.0",
"@vitejs/plugin-react": "^5.0.0",
"typescript": "~5.8.2",
"vite": "^6.2.0"
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0",
"@vitejs/plugin-react": "^4.3.3",
"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": {
"target": "ES2022",
"experimentalDecorators": true,
"useDefineForClassFields": false,
"module": "ESNext",
"lib": [
"ES2022",
"DOM",
"DOM.Iterable"
],
"target": "ESNext",
"useDefineForClassFields": true,
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"allowJs": false,
"skipLibCheck": true,
"types": [
"node"
],
"moduleResolution": "bundler",
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "ESNext",
"moduleResolution": "Node",
"resolveJsonModule": true,
"isolatedModules": true,
"moduleDetection": "force",
"allowJs": true,
"jsx": "react-jsx",
"paths": {
"@/*": [
"./*"
]
},
"allowImportingTsExtensions": true,
"noEmit": true
}
"noEmit": true,
"jsx": "react-jsx"
},
"include": ["**/*.ts", "**/*.tsx"],
"exclude": ["node_modules", "dist"]
}

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';
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, '.', '');
return {
server: {
port: 3000,
host: '0.0.0.0',
},
plugins: [react()],
define: {
'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, '.'),
}
}
};
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
define: {
'process.env': process.env
},
build: {
outDir: 'dist',
emptyOutDir: true,
}
});