#!/usr/bin/env node /** * Build script for React UI apps */ import { execSync } from 'child_process'; import { readdirSync, statSync } from 'fs'; import { join } from 'path'; import { fileURLToPath } from 'url'; import { dirname } from 'path'; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); const reactAppDir = join(__dirname, '..', 'src', 'ui', 'react-app'); try { const apps = readdirSync(reactAppDir).filter(file => { const fullPath = join(reactAppDir, file); return statSync(fullPath).isDirectory(); }); console.log(`Found ${apps.length} React apps to build`); for (const app of apps) { const appPath = join(reactAppDir, app); console.log(`Building ${app}...`); try { execSync('npx vite build', { cwd: appPath, stdio: 'inherit', }); console.log(`✓ ${app} built successfully`); } catch (error) { console.error(`✗ Failed to build ${app}`); } } console.log('UI build complete'); } catch (error) { console.error('Build failed:', error.message); process.exit(1); }