const { execSync } = require('child_process');
const { platform } = require('os');

const isWindows = platform() === 'win32';

if (isWindows) {
  execSync('del /s /q api\\build', { stdio: 'inherit' });
  execSync('del /s /q dist', { stdio: 'inherit' });
} else {
  execSync('rm -rf api/build', { stdio: 'inherit' });
  execSync('rm -rf dist', { stdio: 'inherit' });
}

execSync('vite build --out-dir api/build', { stdio: 'inherit' });
