JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2527
  • Score
    100M100P100Q132954F
  • License MIT

Find the package manager of a project

Package Exports

  • @capgo/find-package-manager
  • @capgo/find-package-manager/main.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@capgo/find-package-manager) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Find Package Manager Type

Capgo - Instant updates for capacitor

Find what package manager is used in the provided path.

import { findPackageManagerType } from '@capgo/find-package-manager'

console.log(findPackageManagerType()) // npm | yarn | pnpm | bun | unknown
// Provide a path
console.log(findPackageManagerType('../.')) // npm | yarn | pnpm | bun | unknown
// Provide a default manager
console.log(findPackageManagerType('.', 'npm')) // npm | yarn | pnpm | bun

Find the install command for the package manager.

import {  findInstallCommand } from '@capgo/find-package-manager'

console.log(findInstallCommand()) // install | add | unknown
// Provide the manager instead of read it with default folder '.'
console.log(findInstallCommand(findPackageManagerType())) // install | add | unknown
// Provide the manager and ask to return it prefixed
console.log(findInstallCommand(findPackageManagerType(), true)) // npm install | yarn add | pnpm add | bun add | unknown unknown

Find the package runner command.

import { findPackageManagerRunner } from '@capgo/find-package-manager'

console.log(findPackageManagerRunner()) // 'yarn dlx' | 'npx' | 'bunx' | 'pnpm exec'
// Provide the path to search for
console.log(findPackageManagerRunner('../.')) // 'yarn dlx' | 'npx' | 'bunx' | 'pnpm exec'
// Provide a default manager
console.log(findPackageManagerRunner('.', 'yarn')) // 'yarn dlx' | 'npx' | 'bunx' | 'pnpm exec'