PMSwitch

A zero-config CLI tool that detects a project's package manager and proxies commands to the correct one. Say goodbye to manually switching between package managers!

$ npm install -g pmswitch
PMSwitch Logo
Supports npm, yarn, pnpm, bun

Powerful Features

PMSwitch comes packed with everything you need to streamline your package manager workflow.

Automatic Detection
Detects package managers based on lockfiles (pnpm-lock.yaml, yarn.lock, package-lock.json, bun.lockb).
Command Proxying
Forwards commands to the correct package manager automatically, no manual switching required.
Multiple Lockfile Handling
Interactive prompts for ambiguous scenarios when multiple lockfiles are detected.
Configuration Options
Global and project-specific settings to customize behavior according to your needs.
Auto-Installation
Can install missing package managers when needed, ensuring smooth operation.

Easy Installation

Get up and running with PMSwitch in seconds

Global Installation

# Install globally with npm

npm install -g pmswitch

Simple Usage

Use PMSwitch as a universal command for all your package manager needs

Basic Commands

$ pms install
🔍 Detected package manager: pnpm 📦 Running: pnpm install Lockfile is up to date, resolution step is skipped Already up to date
$ pms add react
🔍 Detected package manager: pnpm 📦 Running: pnpm add react Packages: +2 Progress: resolved 2, reused 2, downloaded 0, added 2, done
$ pms run start
🔍 Detected package manager: pnpm 📦 Running: pnpm run start > my-app@1.0.0 start > react-scripts start Starting the development server...

Advanced Usage

Force a specific package manager

pms install --force-pnpm
pms add react --force-yarn
pms run build --force-npm

Configuration Options

pms --default pnpm
pms install --no-interactive
pms add lodash --debug

Multiple Lockfile Handling

When multiple lockfiles are detected:

🔍 Multiple lockfiles detected:
  - package-lock.json (npm)
  - yarn.lock (yarn)

? Which package manager would you like to use? › 
❯ yarn 
  npm 
  Use default (pnpm)

Detailed Documentation

Configure PMSwitch to match your workflow perfectly

Global Configuration

Create a .pmswitchrc file in your home directory to set global preferences:

JSON
{
  "defaultPackageManager": "pnpm",
  "priority": ["pnpm", "bun", "yarn", "npm"],
  "interactive": true,
  "autoInstall": false
}

Configuration Options

  • defaultPackageManagerThe fallback package manager to use when no lockfile is detected
  • priorityThe order of preference when multiple lockfiles are detected
  • interactiveWhether to show interactive prompts for ambiguous scenarios
  • autoInstallWhether to automatically install missing package managers

Ready to Simplify Your Workflow?

Say goodbye to manually switching between package managers. Try PMSwitch today and experience seamless package management across all your projects.

$ npm install -g pmswitch