(username: string)
| 304 | } |
| 305 | |
| 306 | async function generateUserFixture(username: string): Promise<void> { |
| 307 | console.log(` Fetching user packages: ${username}`) |
| 308 | |
| 309 | // npm doesn't have a direct API for user packages, but we can search |
| 310 | // with the maintainer filter |
| 311 | const params = new URLSearchParams({ |
| 312 | text: `maintainer:${username}`, |
| 313 | size: '100', |
| 314 | }) |
| 315 | const url = `${NPM_REGISTRY}/-/v1/search?${params}` |
| 316 | |
| 317 | try { |
| 318 | const data = await fetchJson(url) |
| 319 | const path = join(FIXTURES_DIR, 'users', `${username}.json`) |
| 320 | writeFixture(path, data) |
| 321 | } catch (error) { |
| 322 | console.error(` Failed to fetch user ${username}:`, error) |
| 323 | throw error |
| 324 | } |
| 325 | } |
| 326 | |
| 327 | async function generateEsmTypesFixture(packageName: string, version: string): Promise<void> { |
| 328 | console.log(` Fetching esm.sh types: ${packageName}@${version}`) |
no test coverage detected