import { readFileSync, writeFileSync } from 'node:fs';
import { resolve, dirname } from 'node:path';
import { fileURLToPath } from 'node:url';

const root = resolve(dirname(fileURLToPath(import.meta.url)), '..');
const logoPath = resolve(root, 'packages/shared/public/logo.png');
const outPath = resolve(root, 'packages/shared/public/favicon.svg');
const b64 = readFileSync(logoPath).toString('base64');

writeFileSync(
  outPath,
  `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><image href="data:image/png;base64,${b64}" width="512" height="512"/></svg>`,
  'utf8',
);

console.log('Wrote', outPath);
