Multi-Domain-Asset-Infrastruktur: geteilte Vite-Konfiguration und DomainAssetContext
- vite.shared.js als gemeinsame Quelle fuer Ports, Hot-Files, HMR-Hosts und CORS-Origins der beiden Vite-Builds (Portal/Web) - App\Support\DomainAssetContext kapselt die Vite-Build-Directory- Konfiguration pro Domain (ThemeServiceProvider + Auth-Layout nutzen ihn) - Tailwind-Portal-Content-Globs auf die tatsaechliche View-Struktur gezogen - Dev-Beispiel-Routen + Tests (DomainAssetContextTest, DevExampleRoutesTest) - Aufraeumen: versehentliche Leerdatei dev:web entfernt Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
4bb9094207
commit
0efabaf446
15 changed files with 485 additions and 109 deletions
126
vite.shared.js
Normal file
126
vite.shared.js
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
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/**",
|
||||
];
|
||||
Loading…
Add table
Add a link
Reference in a new issue