import { SpawnOptions, ExecFileOptions } from "child_process"; import { RequestInit, Response } from "node-fetch"; export interface NPMCommandOptions { buffer?: boolean; npmBinPath?: string; } export interface NPMSpawnOptions extends NPMCommandOptions, SpawnOptions {} export interface NPMExecOptions extends NPMCommandOptions, ExecFileOptions { buffer: true; } export function npmCommand(args: string | string[], options: NPMExecOptions): Promise<[string, string]>; export function npmCommand(options: NPMExecOptions): Promise<[string, string]>; export function npmCommand(args: string | string[], options?: NPMSpawnOptions): Promise; export function npmCommand(options?: NPMSpawnOptions): Promise; export function npmInstall(packages: string | string[], options: NPMExecOptions): Promise<[string, string]>; export function npmInstall(options: NPMExecOptions): Promise<[string, string]>; export function npmInstall(packages: string | string[], options?: NPMSpawnOptions): Promise; export function npmInstall(options?: NPMSpawnOptions): Promise; export function npxInstall(args: string | string[], options: NPMExecOptions): Promise<[string, string]>; export function npxInstall(options: NPMExecOptions): Promise<[string, string]>; export function npxInstall(args: string | string[], options?: NPMSpawnOptions): Promise; export function npxInstall(options?: NPMSpawnOptions): Promise; export interface PackageRegistry { name?: string; publishConfig?: { registry?: string; }; } export const defaultRegistryUrl: string; /** * Gets a registry URL for a given package. Passing in a string of the package name will look up the registry in NPM * config files. Passing the package.json object in will get the publish registry, which includes the publishConfig. */ export function getRegistry(pkg: string | PackageRegistry, cwd?: string): string | undefined; export interface RegistryRequestOptions extends RequestInit { /** Base registry url that is used when the url argument is missing a host. */ registry?: string; } export function registryRequest(url: string, options?: RegistryRequestOptions): Promise; type StringOrRecordOfStrings = string | Partial>; export interface Package { [key: string]: any; name: string; version: string; description?: string; keywords?: string[]; bugs?: Partial>; license?: StringOrRecordOfStrings<"type" | "url">; homepage?: string; author?: StringOrRecordOfStrings<"name" | "email" | "url">; private?: boolean; main?: string; browser?: string; gitHead?: string; repository?: StringOrRecordOfStrings<"type" | "url" | "directory">; publishConfig?: { [key: string]: any; registry?: string; }; dependencies?: Partial>; devDependencies?: Partial>; peerDependencies?: Partial>; optionalDependencies?: Partial>; files?: string[]; bin?: StringOrRecordOfStrings; man?: string | string[]; directories?: Partial>; scripts?: Partial>; config?: Partial>; engines?: Partial>; os?: string[]; cpu?: string[]; } export interface PackageInfo { name: string; description?: string; "dist-tags": { [tag: string]: string; }; versions: { [version: string]: Package; }; time: { [version: string]: string; }; readme?: string; readmeFilename?: string; keywords?: string[]; license?: string; } export function fetchPackageInfo(registry: string | undefined, name: string): Promise; export function getVersion(info: PackageInfo, tags?: string | string[]): string | undefined; export function getRelease(info: PackageInfo, tags?: string | string[]): Package | undefined; export function fetchRelease( registry: string | undefined, name: string, tags?: string | string[] ): Promise;