// Copies the canonical frontend (../index.html and ../vendor/) into ./dist // before each Tauri dev/build run, so the Tauri shell always packages the // exact same UI as the Electron version — no manual sync, no drift. const fs = require('fs'); const path = require('path'); const ROOT = path.join(__dirname, '..'); const DIST = path.join(__dirname, 'dist'); function copyRecursive(src, dest) { const stat = fs.statSync(src); if (stat.isDirectory()) { fs.mkdirSync(dest, { recursive: true }); for (const entry of fs.readdirSync(src)) { copyRecursive(path.join(src, entry), path.join(dest, entry)); } } else { fs.copyFileSync(src, dest); } } fs.rmSync(DIST, { recursive: true, force: true }); fs.mkdirSync(DIST, { recursive: true }); copyRecursive(path.join(ROOT, 'index.html'), path.join(DIST, 'index.html')); copyRecursive(path.join(ROOT, 'vendor'), path.join(DIST, 'vendor')); console.log(`Synced frontend (index.html + vendor/) from ${ROOT} -> ${DIST}`);