跳转到内容

utils/getLatestVersion

此内容尚不支持你的语言。

function getLatestVersion(
packageName: string,
logger: AstroIntegrationLogger,
cacheJsonFile: undefined | URL,
isDevMode: boolean): Promise<null | string>

Defined in: studiocms/packages/studiocms/src/utils/getLatestVersion.ts:15^

Fetches the latest version of a given npm package from the npm registry.

string

The name of the npm package to fetch the latest version for.

AstroIntegrationLogger

An instance of AstroIntegrationLogger used to log errors if the fetch fails.

undefined | URL

boolean

Promise<null | string>

A promise that resolves to the latest version of the package as a string, or null if an error occurs during the fetch process.

Will throw an error if the HTTP response from the npm registry is not successful.