@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
22 lines (21 loc) • 1.11 kB
TypeScript
import { PackageJson } from './package-json';
export interface NpmPackageInfo {
'dist-tags': {
latest: string;
[tag: string]: string;
};
versions: Record<string, PackageJson>;
}
/**
* Asynchronously retrieves information about a specified npm package.
*
* This function fetches package information from the npm registry. If caching is enabled and the package
* information is already cached, it returns the cached data to reduce network calls. If the package information
* is not cached or caching is skipped, it makes an HTTP request to the npm registry.
*
* @param packageName The name of the npm package for which information is required.
* @param skipCache Optional. If true, the function will bypass the cache and fetch data directly from the npm registry.
* @returns A Promise that resolves to an `NpmPackageInfo` object containing the package information, or null if an error occurs
* during the fetch operation or if the package does not exist.
*/
export declare function GetPackageInfo(packageName: string, skipCache?: boolean): Promise<NpmPackageInfo | null>;