(packageName: string)
| 370 | } |
| 371 | |
| 372 | export 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 | |
| 385 | export function convertToMarkdownTable(arr: Array<Record<string, unknown>>) { |
| 386 | if (!arr || arr.length === 0) { |
no test coverage detected