Skip to main content

detect

Function detect 

Source
pub fn detect(
    project: &dyn Project,
    setting: Option<&str>,
    tb: &dyn Toolbox,
) -> Result<Detection, DetectError>
Expand description

Choose the package manager, first match wins:

  1. an explicit setting, BYNK_PACKAGE_MANAGER over bynk.toml’s [build] package_manager (setting);
  2. the packageManager field of the project root’s package.json;
  3. a lockfile at the project root;
  4. npm_config_user_agent;
  5. the first of npm, pnpm and bun on PATH.

A packageManager or user agent naming a tool bynk does not install with is skipped, since neither is a setting bynk owns; an explicit setting naming one is an error.