UNPKG

@rxap/node-utilities

Version:

Provides a set of utility functions for Node.js development, including file system operations, git integration, and package.json manipulation. It offers functionalities like copying folders, reading JSON files with retry logic, retrieving the current git

20 lines (19 loc) 1.54 kB
/** * Asynchronously retrieves the latest version of a specified package, optionally bypassing the cache. * * This function first checks if the package version is available in a local cache (`LATEST_PACKAGE_VERSIONS`) unless * explicitly instructed to skip this cache. If the package version is not cached or cache is skipped, it attempts to * fetch the version from a predefined package group (`nx-migrations` in `rxapPackageJson`). If the package is not found * in the predefined group, it then fetches the package information from a remote source using `GetPackageInfo`. * * If the remote fetch is successful and the package information includes distribution tags, it updates the cache with * the latest version and returns it. If the fetched package information is invalid (i.e., lacks distribution tags), * the function logs the detailed package information and throws an error. * * @param {string} packageName - The name of the package for which the latest version is to be retrieved. * @param {boolean} [skipCache=false] - Optional flag to bypass the local cache check and force a fetch from remote sources. * @returns {Promise<string | null>} A promise that resolves to the latest version string of the package, or null if the * package cannot be found or if the package information is invalid. * @throws {Error} Throws an error if the package information fetched from the remote source is invalid. */ export declare function GetLatestPackageVersion(packageName: string, skipCache?: boolean): Promise<string | null>;