Brought to you by Allons-y Studio

Function: inspectPackageManager()

function inspectPackageManager(
   cwd, 
   hostPkg?, 
   env?
): PackageManagerInfo;

Defined in: pkg-manager.ts:82

Work out the host project's package manager, and how sure that is.

An explicit packageManager field wins over lockfiles, and a single lockfile wins over how opx was launched. If both name different managers, or several lockfiles are present, the answer is marked uncertain so callers can show a command instead of running it.

Order: packageManager field, then lockfiles, then the launching manager (npm_config_user_agent), then npm. The launcher ranks last because npx reports npm whatever the project uses.

Parameters

Parameter Type Default value Description
cwd string undefined The project directory.
hostPkg PackageJson {} The project's package.json.
env Environment process.env The environment to read the launcher from.

Returns

PackageManagerInfo