Integrate shared JWT authentication into data-entry-app: - Add Oracle pool initialization for auth service - Add AuthenticationMiddleware to protect API routes - Update all receipt endpoints to use CurrentUser from JWT - Add shared auth router (/api/auth/login, /api/auth/refresh) Add nomenclature synchronization feature: - Create SQLite models for synced suppliers, local suppliers, and cash registers - Add nomenclature router with sync triggers and CRUD endpoints - Add sync service for Oracle → SQLite nomenclature data - Update nomenclature_service to use synced SQLite data with fallbacks Create shared frontend components: - Add shared/frontend/ with LoginView.vue, auth store factory, login.css - Integrate shared login and auth into data-entry-app frontend - Add axios-based API service with token refresh interceptor 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
79 lines
2.5 KiB
JavaScript
79 lines
2.5 KiB
JavaScript
import { defineConfig } from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
import { fileURLToPath, URL } from 'node:url'
|
|
|
|
// Plugin pentru a înlocui BUILD_TIMESTAMP în index.html la build
|
|
function htmlTimestampPlugin() {
|
|
return {
|
|
name: 'html-timestamp',
|
|
transformIndexHtml(html) {
|
|
return html.replace('BUILD_TIMESTAMP', new Date().toISOString())
|
|
}
|
|
}
|
|
}
|
|
|
|
export default defineConfig({
|
|
plugins: [vue(), htmlTimestampPlugin()],
|
|
// Base path for production deployment in IIS subdirectory
|
|
base: process.env.NODE_ENV === 'production' ? '/roa2web/' : '/',
|
|
resolve: {
|
|
alias: {
|
|
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
|
'@shared': fileURLToPath(new URL('../../shared', import.meta.url))
|
|
}
|
|
},
|
|
server: {
|
|
port: 3000,
|
|
host: true,
|
|
// WSL2 file watching fix - use polling for /mnt/ paths
|
|
watch: {
|
|
usePolling: true, // Required for WSL2 when files are on Windows mount
|
|
interval: 1000 // Check for changes every second
|
|
},
|
|
// HMR configuration for better hot reload
|
|
hmr: {
|
|
overlay: true, // Show errors in browser overlay
|
|
protocol: 'ws', // WebSocket protocol
|
|
host: 'localhost' // Explicit host for WSL2
|
|
},
|
|
proxy: {
|
|
'/api': {
|
|
target: 'http://localhost:8001',
|
|
changeOrigin: true,
|
|
secure: false,
|
|
configure: (proxy, options) => {
|
|
proxy.on('proxyReq', (proxyReq, req, res) => {
|
|
// Preserve authorization header during redirects
|
|
if (req.headers.authorization) {
|
|
proxyReq.setHeader('Authorization', req.headers.authorization);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|
|
},
|
|
build: {
|
|
outDir: 'dist',
|
|
sourcemap: true,
|
|
// Cache busting - generează hash-uri noi la fiecare build
|
|
assetsInlineLimit: 0, // Nu inline asset-uri mici, folosește fișiere separate cu hash
|
|
rollupOptions: {
|
|
output: {
|
|
// Forțează hash-uri unice pentru toate fișierele
|
|
entryFileNames: `assets/[name].[hash].js`,
|
|
chunkFileNames: `assets/[name].[hash].js`,
|
|
assetFileNames: `assets/[name].[hash].[ext]`,
|
|
manualChunks: {
|
|
vendor: ['vue', 'vue-router', 'pinia'],
|
|
primevue: ['primevue/button', 'primevue/datatable', 'primevue/inputtext'],
|
|
utils: ['axios', 'date-fns']
|
|
}
|
|
}
|
|
}
|
|
},
|
|
// Adaugă timestamp la build pentru versioning
|
|
define: {
|
|
__APP_VERSION__: JSON.stringify(new Date().toISOString()),
|
|
__BUILD_TIMESTAMP__: JSON.stringify(Date.now())
|
|
}
|
|
}) |