(data: RegistryData)
| 239 | * entrypoint. It now rewrites the registry directory to match the provided set. |
| 240 | */ |
| 241 | export function writeRegistry(data: RegistryData): void { |
| 242 | ensureRegistryReady(); |
| 243 | |
| 244 | const nextPaths = new Set<string>(); |
| 245 | for (const pack of data.packs) { |
| 246 | const normalized: RegistryEntry = { |
| 247 | ...pack, |
| 248 | dir: canonicalizeDir(pack.dir), |
| 249 | updatedAt: pack.updatedAt ?? new Date().toISOString(), |
| 250 | }; |
| 251 | const entryPath = getEntryPathForCanonicalDir(normalized.dir); |
| 252 | nextPaths.add(entryPath); |
| 253 | writeEntryFile(normalized); |
| 254 | } |
| 255 | |
| 256 | for (const existingPath of listEntryFiles()) { |
| 257 | if (!nextPaths.has(existingPath)) { |
| 258 | fs.unlinkSync(existingPath); |
| 259 | } |
| 260 | } |
| 261 | } |
| 262 | |
| 263 | // --------------------------------------------------------------------------- |
| 264 | // Public API |
nothing calls this directly
no test coverage detected