Skip to content
Better PM
Esc
↑↓navigate↵open⌘Jpreview

Quickstart

Get started with Better PM in minutes

This guide walks you through the most common Better PM workflows. After completing it, you’ll understand how to install dependencies, add packages, and navigate your monorepo efficiently.

Your First Commands

Let’s start with the basics in any project with a lockfile.

Install Dependencies

Better PM automatically detects your package manager and runs the appropriate install command.

pm i

This is equivalent to:

  • pnpm install if you have pnpm-lock.yaml
  • bun install if you have bun.lockb
  • npm install if you have package-lock.json

Add a Dependency

Add a package to your project:

pm add lodash

Add a dev dependency with the -D flag:

pm add -D typescript

Remove a Dependency

Remove a package:

pm remove lodash

Monorepo Workflows

Better PM shines in monorepo environments. Let’s explore the key features.

List Workspace Packages

View all packages in your monorepo as a tree:

pm pls

Example output:

packages/
│   ├── core "@myapp/core"
│   └── utils "@myapp/utils"
apps/
    └── web "@myapp/web"

Jump to any workspace package:

pm cd @myapp/web

Return to the monorepo root:

pm cd

Scoped Installs

When you’re inside a workspace package, pm i automatically installs only that package:

cd apps/web
pm i              # Installs only @myapp/web and its dependencies

Behind the scenes, Better PM runs:

  • pnpm install --filter "@myapp/web..." (pnpm)
  • bun install --filter "@myapp/web" (bun)
  • npm install --workspace @myapp/web (npm)

To install a specific package from anywhere:

pm i -F @myapp/web

Install multiple packages:

pm i -F @myapp/web -F @myapp/api

Root Install Safety

At the monorepo root, pm i shows a warning before installing everything:

cd /path/to/monorepo
pm i

Output:

[WARNING] You are at the monorepo root. This will install ALL packages.

Workspace packages:
packages/
│   ├── core "@myapp/core"
│   └── utils "@myapp/utils"
apps/
    └── web "@myapp/web"

Proceed with installing all packages? (y/N)

To skip the prompt (useful in CI):

pm i --sure    # or -y

Additional Commands

Better PM includes several proxy commands that pass through to your package manager.

Run Scripts

Run a package.json script:

pm run dev
pm run build
pm run test

Execute Packages

Run a package with npx/pnpx/bunx:

pm x prettier --check .    # Uses pnpx, bunx, or npx

Update Dependencies

Update packages interactively:

pm up -i              # Interactive update
pm up --latest        # Update to latest versions

Check Dependency Usage

See why a package is installed (pnpm/bun only):

pm why react

Other Proxy Commands

These commands work exactly like their package manager equivalents:

  • pm ls — List installed dependencies (not workspace packages)
  • pm link — Link a package
  • pm unlink — Unlink a package

Example Workflow

Here’s a complete workflow for working on a feature in a monorepo:

Navigate to your workspace

pm cd @myapp/web

Add a new dependency

pm add react-query

Install updated dependencies

pm i

This installs only @myapp/web and its dependencies.

Run the dev server

pm dev

Automatically runs the dev script from package.json.

Add a dev tool

pm add -D vitest

Go back to the root

pm cd

Common Patterns

Install All Packages in CI

pm i -y    # Skips the confirmation prompt

Add the Same Dependency to Multiple Packages

cd packages/core
pm add zod

cd ../utils
pm add zod

Or from the root with filters:

pm i -F @myapp/core -F @myapp/utils

Clean Install a Specific Package

rm -rf node_modules
pm i -F @myapp/web

Next Steps

You now know the core Better PM commands! Here are some resources to explore:

Getting Help

View help for any command:

pm --help
pm i --help
pm add --help

For more assistance, open an issue on GitHub.

Was this page helpful?