- Rebranding: BRAND_NAME env var (default AcadeDoc) replaces hardcoded "DocAdenice" in index.html title/meta, PWA manifest, app-header logo text, email footer/body - lib/config.ts: getAppName() reads BRAND_NAME; new getBrandLogoUrl/PrimaryColor/AccentColor helpers - vite.config.ts: BRAND_* vars exposed via define block to client - brand-theme.ts: getBrandTheme() generates 10-shade MantineColorsTuple from hex (no @mantine/colors-generator dep); merged into MantineProvider at boot - theme/__tests__/brand-theme.test.ts: 11 vitest tests (generateColorTuple + getBrandTheme) - Workspace branding: migration adds primary_color/accent_color to workspaces table WorkspaceBrandingService + WorkspaceBrandingController (POST /workspace/branding, POST /workspace/branding/update — admin only) + DTO hex validation - Settings: /settings/branding page (WorkspaceBranding) + sidebar entry (admin-only) - workspace-branding.spec.ts: 13 vitest tests (service + controller + DTO validation) - SMTP Brevo: .env.example preset block + transactional/README.md ops guide (key gen, port 587 STARTTLS, 300/day free limit, swaks/curl test) - environment.service.ts: getMailFromName() falls back to BRAND_NAME if MAIL_FROM_NAME unset - vitest.config.ts server: include pattern extended to src/core/workspace/spec/** - i18n: 11 branding keys added to en-US and fr-FR translations - 0 TypeScript errors client + server, 11 client + 13 server new tests all green Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
84 lines
1.9 KiB
TypeScript
84 lines
1.9 KiB
TypeScript
import { defineConfig, loadEnv } from "vite";
|
|
import react from "@vitejs/plugin-react";
|
|
import * as path from "path";
|
|
|
|
const envPath = path.resolve(process.cwd(), "..", "..");
|
|
|
|
export default defineConfig(({ mode }) => {
|
|
const {
|
|
APP_URL,
|
|
FILE_UPLOAD_SIZE_LIMIT,
|
|
FILE_IMPORT_SIZE_LIMIT,
|
|
DRAWIO_URL,
|
|
CLOUD,
|
|
SUBDOMAIN_HOST,
|
|
COLLAB_URL,
|
|
BILLING_TRIAL_DAYS,
|
|
POSTHOG_HOST,
|
|
POSTHOG_KEY,
|
|
BRAND_NAME,
|
|
BRAND_LOGO_URL,
|
|
BRAND_PRIMARY_COLOR,
|
|
BRAND_ACCENT_COLOR,
|
|
} = loadEnv(mode, envPath, "");
|
|
|
|
return {
|
|
define: {
|
|
"process.env": {
|
|
APP_URL,
|
|
FILE_UPLOAD_SIZE_LIMIT,
|
|
FILE_IMPORT_SIZE_LIMIT,
|
|
DRAWIO_URL,
|
|
CLOUD,
|
|
SUBDOMAIN_HOST,
|
|
COLLAB_URL,
|
|
BILLING_TRIAL_DAYS,
|
|
POSTHOG_HOST,
|
|
POSTHOG_KEY,
|
|
BRAND_NAME: BRAND_NAME || "AcadeDoc",
|
|
BRAND_LOGO_URL: BRAND_LOGO_URL || "",
|
|
BRAND_PRIMARY_COLOR: BRAND_PRIMARY_COLOR || "#2563eb",
|
|
BRAND_ACCENT_COLOR: BRAND_ACCENT_COLOR || "#7c3aed",
|
|
},
|
|
APP_VERSION: JSON.stringify(process.env.npm_package_version),
|
|
},
|
|
plugins: [react()],
|
|
build: {
|
|
rolldownOptions: {
|
|
output: {
|
|
codeSplitting: {
|
|
groups: [
|
|
{ name: "vendor-mantine", test: /@mantine/ },
|
|
{ name: "vendor-mermaid", test: /mermaid|cytoscape|elkjs/ },
|
|
{ name: "vendor-excalidraw", test: /excalidraw/ },
|
|
{ name: "vendor-katex", test: /katex/ },
|
|
],
|
|
},
|
|
},
|
|
},
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
"@": "/src",
|
|
},
|
|
},
|
|
server: {
|
|
proxy: {
|
|
"/api": {
|
|
target: APP_URL,
|
|
changeOrigin: false,
|
|
},
|
|
"/socket.io": {
|
|
target: APP_URL,
|
|
ws: true,
|
|
rewriteWsOrigin: true,
|
|
},
|
|
"/collab": {
|
|
target: APP_URL,
|
|
ws: true,
|
|
rewriteWsOrigin: true,
|
|
},
|
|
},
|
|
},
|
|
};
|
|
});
|