Files

27 lines
907 B
TypeScript
Raw Permalink Normal View History

2026-04-10 19:00:21 +02:00
/**
* After Vite builds the dashboard, copy the dist/ output into
* @shade/observer's dist/ directory so the observer endpoint can
* serve it from /dashboard/.
*/
import { existsSync, mkdirSync, cpSync, rmSync } from 'fs';
import { join, dirname } from 'path';
import { fileURLToPath } from 'url';
const here = dirname(fileURLToPath(import.meta.url));
const dashboardDist = join(here, '..', 'dist');
const observerDist = join(here, '..', '..', 'shade-observer', 'dist');
if (!existsSync(dashboardDist)) {
console.error(`Dashboard dist not found at ${dashboardDist}. Run \`vite build\` first.`);
process.exit(1);
}
// Clean and recreate observer dist
if (existsSync(observerDist)) {
rmSync(observerDist, { recursive: true });
}
mkdirSync(observerDist, { recursive: true });
cpSync(dashboardDist, observerDist, { recursive: true });
console.log(`✓ Copied dashboard build to ${observerDist}`);