( seedDir: string, )
| 434 | } |
| 435 | |
| 436 | async function readSeedKnownMarketplaces( |
| 437 | seedDir: string, |
| 438 | ): Promise<KnownMarketplacesConfig | null> { |
| 439 | const seedJsonPath = join(seedDir, 'known_marketplaces.json') |
| 440 | try { |
| 441 | const content = await getFsImplementation().readFile(seedJsonPath, { |
| 442 | encoding: 'utf-8', |
| 443 | }) |
| 444 | const parsed = KnownMarketplacesFileSchema().safeParse(jsonParse(content)) |
| 445 | if (!parsed.success) { |
| 446 | logForDebugging( |
| 447 | `Seed known_marketplaces.json invalid at ${seedDir}: ${parsed.error.message}`, |
| 448 | { level: 'warn' }, |
| 449 | ) |
| 450 | return null |
| 451 | } |
| 452 | return parsed.data |
| 453 | } catch (e) { |
| 454 | if (!isENOENT(e)) { |
| 455 | logForDebugging( |
| 456 | `Failed to read seed known_marketplaces.json at ${seedDir}: ${e}`, |
| 457 | { level: 'warn' }, |
| 458 | ) |
| 459 | } |
| 460 | return null |
| 461 | } |
| 462 | } |
| 463 | |
| 464 | /** |
| 465 | * Locate a marketplace in the seed directory by name. |
no test coverage detected