()
| 24 | } |
| 25 | |
| 26 | async function main() { |
| 27 | const scratch = await mkdtemp(path.join(tmpdir(), 'sim-realtime-prune-')) |
| 28 | try { |
| 29 | console.log(`Pruning @sim/realtime into ${scratch}`) |
| 30 | await $`bunx turbo prune @sim/realtime --docker --out-dir=${scratch}`.quiet() |
| 31 | |
| 32 | const apps = await listPackages(path.join(scratch, 'json', 'apps')) |
| 33 | const packages = await listPackages(path.join(scratch, 'json', 'packages')) |
| 34 | const total = apps.length + packages.length |
| 35 | |
| 36 | console.log(`Pruned apps (${apps.length}): ${apps.join(', ') || '(none)'}`) |
| 37 | console.log(`Pruned packages (${packages.length}): ${packages.join(', ') || '(none)'}`) |
| 38 | console.log(`Total pruned workspaces: ${total}`) |
| 39 | |
| 40 | if (total > MAX_PRUNED_PACKAGE_COUNT) { |
| 41 | console.error( |
| 42 | `\n❌ Pruned realtime dep graph has ${total} workspaces (limit: ${MAX_PRUNED_PACKAGE_COUNT}).` |
| 43 | ) |
| 44 | console.error( |
| 45 | 'A new package was pulled into @sim/realtime. Ensure only pure, single-purpose packages are in its dep graph.' |
| 46 | ) |
| 47 | process.exit(1) |
| 48 | } |
| 49 | |
| 50 | const unexpectedApps = apps.filter((name) => name !== 'realtime') |
| 51 | if (unexpectedApps.length > 0) { |
| 52 | console.error( |
| 53 | `\n❌ Pruned realtime tree pulled in unexpected apps/: ${unexpectedApps.join(', ')}` |
| 54 | ) |
| 55 | process.exit(1) |
| 56 | } |
| 57 | |
| 58 | console.log('\n✅ Realtime prune size within expected bounds') |
| 59 | } finally { |
| 60 | await rm(scratch, { recursive: true, force: true }) |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | void main().catch((error) => { |
| 65 | console.error('Realtime prune check failed:', error) |
no test coverage detected