From cb8c224a54c20153c2c39a72636316e55638a007 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sedat=20=C3=96zt=C3=BCrk?= Date: Tue, 12 Aug 2025 01:08:28 +0300 Subject: [PATCH] Deneme --- ui/tsconfig.node.json | 6 +- ui/vite.config.ts | 129 ++++++++++++++++++++++-------------------- 2 files changed, 73 insertions(+), 62 deletions(-) diff --git a/ui/tsconfig.node.json b/ui/tsconfig.node.json index 7065ca9a..e1cdb33f 100644 --- a/ui/tsconfig.node.json +++ b/ui/tsconfig.node.json @@ -6,5 +6,9 @@ "moduleResolution": "Node", "allowSyntheticDefaultImports": true }, - "include": ["vite.config.ts"] + "include": [ + "vite.config.ts", + "src/**/*.ts", + "src/**/*.tsx" + ] } diff --git a/ui/vite.config.ts b/ui/vite.config.ts index fa31d3dd..02689e5a 100644 --- a/ui/vite.config.ts +++ b/ui/vite.config.ts @@ -4,66 +4,73 @@ import path from 'path' import dynamicImport from 'vite-plugin-dynamic-import' import { VitePWA } from 'vite-plugin-pwa' -// https://vitejs.dev/config/ -export default defineConfig({ - plugins: [ - react({ - babel: { - plugins: ['babel-plugin-macros', '@babel/plugin-syntax-dynamic-import'], - }, - }), - dynamicImport(), - VitePWA({ - registerType: 'autoUpdate', - devOptions: { - enabled: true, - }, - workbox: { - maximumFileSizeToCacheInBytes: 10 * 1024 * 1024, // 10 MB sınır - }, - manifest: { - name: 'Platform', - theme_color: '#FF99C8', - background_color: '#f0e7db', - display: 'standalone', - // scope: '/', - // start_url: '/', - // orientation: 'portrait', - icons: [ - { - src: '/img/logo/logo-400.png', - sizes: '400x400', - type: 'image/png', - purpose: 'any', - }, - ], - }, - }), - // visualizer({ open: true, filename: 'bundle-visualization.html' }), - ], - server: { - open: true, - port: 3000, - }, - assetsInclude: ['**/*.md'], - resolve: { - alias: { - '@': path.join(__dirname, 'src'), - inferno: 'inferno/dist/index.esm.js', - 'devextreme/ui': 'devextreme/esm/ui', +import { getTenants } from './src/proxy/admin/tenant/tenant.service' + +export default defineConfig(async () => { + const baseDomains = ['sozsoft.com', 'dev.sozsoft.com'] + + const res = await getTenants(0, 1000) + const tenantNames = (res?.items ?? []) + .filter(t => t?.name) + .map(t => t.name.trim().toLowerCase()) + + const tenantHosts = tenantNames.flatMap(t => baseDomains.map(d => `${t}.${d}`)) + const allowedHosts = Array.from(new Set(['localhost', ...baseDomains, ...tenantHosts])) + console.log('Allowed Hosts:', allowedHosts) + return { + plugins: [ + react({ + babel: { + plugins: ['babel-plugin-macros', '@babel/plugin-syntax-dynamic-import'], + }, + }), + dynamicImport(), + VitePWA({ + registerType: 'autoUpdate', + devOptions: { enabled: true }, + workbox: { + maximumFileSizeToCacheInBytes: 10 * 1024 * 1024, + }, + manifest: { + name: 'Platform', + theme_color: '#FF99C8', + background_color: '#f0e7db', + display: 'standalone', + icons: [ + { + src: '/img/logo/logo-400.png', + sizes: '400x400', + type: 'image/png', + purpose: 'any', + }, + ], + }, + }), + ], + server: { + open: true, + port: 3000, }, - }, - build: { - outDir: 'dist', - sourcemap: false, - }, - preview: { - host: '0.0.0.0', - port: 80, - open: false, - allowedHosts: ['localhost', 'sozsoft.com', 'dev.sozsoft.com', 'demo.sozsoft.com'], - }, - define: { - 'process.env': {}, - }, + assetsInclude: ['**/*.md'], + resolve: { + alias: { + '@': path.join(__dirname, 'src'), + inferno: 'inferno/dist/index.esm.js', + 'devextreme/ui': 'devextreme/esm/ui', + }, + }, + build: { + outDir: 'dist', + sourcemap: false, + }, + preview: { + host: '0.0.0.0', + port: 80, + open: false, + allowedHosts, + }, + define: { + 'process.env': {}, + }, + } })