// Keep these public controls identical to Coline, apart from local import paths. import { existsSync, readFileSync, writeFileSync } from 'node:fs'; const platform = new URL('../../../apps/web/src/components/ui/', import.meta.url); // The standalone repository (upstream.codes/coline/ui) has no Coline to compare with. if (!existsSync(platform)) { console.log('Outside the Coline monorepo; skipping the parity check.'); process.exit(0); } const files = ['dropdown-menu.tsx', 'menu-highlight.tsx', 'liquid-menu-surface.ts', 'menu-item-styles.ts']; for (const file of files) { const source = readFileSync(new URL(file, platform), 'utf8') .replaceAll('@/components/ui/', './').replaceAll('@/lib/utils', '../lib/utils'); const target = new URL(`../src/components/${file}`, import.meta.url); if (process.argv.includes('--write')) writeFileSync(target, source); else if (readFileSync(target, 'utf8') !== source) throw new Error(`${file} differs from Coline; run pnpm --filter @colineapp/ui sync:platform`); } console.log('Dropdown menu, highlight and surface match Coline.');