MCPcopy Create free account
hub / github.com/cloudflare/templates / getLatestPackageVersion

Function getLatestPackageVersion

cli/src/util.ts:372–383  ·  view source on GitHub ↗
(packageName: string)

Source from the content-addressed store, hash-verified

370}
371
372export async function getLatestPackageVersion(packageName: string) {
373 const response = await fetchWithRetries(
374 `https://registry.npmjs.org/${packageName}/latest`,
375 );
376 if (!response.ok) {
377 throw new Error(
378 `Error response from ${response.url} (${response.status}): ${await response.text()}`,
379 );
380 }
381 const { version } = (await response.json()) as { version: string };
382 return version;
383}
384
385export function convertToMarkdownTable(arr: Array<Record<string, unknown>>) {
386 if (!arr || arr.length === 0) {

Callers 1

depsUpdateFunction · 0.90

Calls 3

fetchWithRetriesFunction · 0.85
textMethod · 0.65
jsonMethod · 0.65

Tested by

no test coverage detected