JS Utils Kit
    Preparing search index...

    Function buildPmCommand

    • Builds a package manager command string.

      Parameters

      • pm: "pnpm" | "npm" | "yarn" | "bun"

        The package manager

        PackageManager - Available PackageManager

      • command: PmCommands

        The command type

      • Optionalargs: string | string[]

        Package names or arguments

      • variant: PmCommandVariant = 'default'

        The command variant.

        "default"
        

      Returns string | undefined

      The full command string, or undefined if not supported.

      Automatically resolves the correct command syntax for the provided package manager and command variant.

      Useful for generating commands dynamically across different package managers (PackageManager).

      buildPmCommand(
      'npm',
      'install',
      'typescript',
      );
      // "npm install typescript"
      buildPmCommand(
      'pnpm',
      'install',
      ['react', 'react-dom'],
      );
      // "pnpm add react react-dom"
      buildPmCommand(
      'npm',
      'install',
      'vitest',
      'dev',
      );
      // "npm install -D vitest"
      PM_COMMANDS.npm.install.default;
      // "npm install"

      PM_COMMANDS.npm.install.dev;
      // "npm install -D"