import fs from 'node:fs';
import path from 'path';
import { spawnSync } from 'node:child_process';

if (fs.existsSync(path.join('dist', 'index.html'))) {
  process.exit(0);
}

const result = spawnSync(process.execPath, [path.join('node_modules', 'vite', 'bin', 'vite.js'), 'build'], { stdio: 'inherit' });

process.exit(result.status ?? 1);
