MCPcopy Index your code
hub / github.com/npmx-dev/npmx.dev / generatePackumentFixture

Function generatePackumentFixture

scripts/generate-fixtures.ts:239–255  ·  view source on GitHub ↗
(packageName: string)

Source from the content-addressed store, hash-verified

237// ============================================================================
238
239async function generatePackumentFixture(packageName: string): Promise<void> {
240 console.log(` Fetching packument: ${packageName}`)
241
242 const encoded = encodePackageName(packageName)
243 const url = `${NPM_REGISTRY}/${encoded}`
244
245 try {
246 const data = await fetchJson<Record<string, unknown>>(url)
247 const slimmed = slimPackument(data)
248 const filename = packageToFilename(packageName)
249 const path = join(FIXTURES_DIR, 'npm-registry', 'packuments', filename)
250 writeFixture(path, slimmed)
251 } catch (error) {
252 console.error(` Failed to fetch ${packageName}:`, error)
253 throw error
254 }
255}
256
257async function generateDownloadsFixture(packageName: string): Promise<void> {
258 console.log(` Fetching downloads: ${packageName}`)

Callers 1

mainFunction · 0.85

Calls 4

slimPackumentFunction · 0.85
packageToFilenameFunction · 0.85
writeFixtureFunction · 0.85
encodePackageNameFunction · 0.70

Tested by

no test coverage detected