Socket
Socket
Sign inDemoInstall

@capgo/find-package-manager

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@capgo/find-package-manager

Find the package manager of a project


Version published
Weekly downloads
948
decreased by-4.44%
Maintainers
1
Weekly downloads
 
Created
Source

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'

Keywords

FAQs

Package last updated on 13 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc