UNPKG

@skarab/detect-package-manager

Version:

Detects which package manager (bun, pnpm, yarn, npm) is used based on the current working directory.

23 lines (22 loc) 751 B
export declare const validVersionPattern: RegExp; /** * Returns the version number for a given command name. * * @example * ``` * const pnpmVersion = await getCommandVersion('pnpm'); * // -> '7.6.0' * ``` * * @param commandName command name such as 'pnpm'. * @throws {Error} if the version is not valid or the command does not exist. */ export declare function getCommandVersion(commandName: string): Promise<string>; /** * Returns the version number for a given command name or undefined if the version is not valid or the command does not exist. * * @see {@link getCommandVersion} * * @param commandName command name such as 'pnpm'. */ export declare function tryGetCommandVersion(commandName: string): Promise<string | undefined>;