import path from "path"; import { fileURLToPath } from "url"; const projectRoot = path.dirname(fileURLToPath(import.meta.url)); export const PORTAL_PORT = 5177; export const WEB_PORT = 5178; export const PORTAL_HOT_FILE = "public/hot-portal"; export const WEB_HOT_FILE = "public/hot-web"; export const PORTAL_HMR_HOST = "assets.pressekonto.test"; export const WEB_HMR_HOSTS = [ "assets.presseecho.test", "assets.businessportal24.test", ]; export const WEB_CORS_ORIGINS = [ "https://pressekonto.test", "https://assets.pressekonto.test", "https://presseecho.test", "https://assets.presseecho.test", "https://businessportal24.test", "https://assets.businessportal24.test", ]; export const WEB_ALLOWED_HOSTS = [ "pressekonto.test", "assets.pressekonto.test", "presseecho.test", "assets.presseecho.test", "businessportal24.test", "assets.businessportal24.test", "localhost", "0.0.0.0", ]; /** * Whitelist-basiertes Watch-Filtering für Vite/Chokidar. * * @param {string[]} allowedDirs Pfade relativ zum Projektroot */ export function createWatchIgnored(allowedDirs) { const allowedPrefixes = allowedDirs.map((dir) => path.join(projectRoot, dir), ); return (filePath) => { const normalized = path.normalize(filePath); if (normalized.includes(`${path.sep}node_modules${path.sep}`)) { return true; } if (normalized === projectRoot) { return false; } const isAllowed = allowedPrefixes.some( (prefix) => normalized === prefix || normalized.startsWith(prefix + path.sep), ); if (isAllowed) { return false; } const isAncestorOfAllowed = allowedPrefixes.some((prefix) => prefix.startsWith(normalized + path.sep), ); return !isAncestorOfAllowed; }; } /** Backend/Admin: FluxUI, Livewire-Panel, Customer-Bereich */ export const portalWatchDirs = [ "resources/js", "resources/css", "resources/views/livewire/admin", "resources/views/livewire/customer", "resources/views/livewire/components", "resources/views/livewire/settings", "resources/views/livewire/auth", "resources/views/layouts", "resources/views/components/layouts", "resources/views/components/portal", "resources/views/components/settings", "resources/views/partials", "resources/views/admin", "app/Livewire", "vendor/livewire/flux/dist", "vendor/livewire/flux/stubs", "vendor/livewire/flux-pro/stubs", "vendor/laravel/framework/src/Illuminate/Pagination/resources/views", ]; /** Öffentliche Frontends: pressekonto Hub, presseecho, businessportal24 */ export const webWatchDirs = [ "resources/js", "resources/css", "resources/views/web", "resources/views/livewire/web", "resources/views/components/web", ]; export const portalRefreshPaths = [ "resources/views/livewire/admin/**", "resources/views/livewire/customer/**", "resources/views/livewire/components/**", "resources/views/livewire/settings/**", "resources/views/livewire/auth/**", "resources/views/layouts/**", "resources/views/components/layouts/**", "resources/views/components/portal/**", "resources/views/partials/**", "resources/views/admin/**", "app/Livewire/**", ]; export const webRefreshPaths = [ "resources/views/web/**", "resources/views/livewire/web/**", "resources/views/components/web/**", ];