Skip to content
/ nypm Public

🌈 Unified Package Manager for Node.js (npm, pnpm, yarn), Bun and Deno

License

Notifications You must be signed in to change notification settings

unjs/nypm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

dfb09ef Β· Feb 25, 2025
Feb 20, 2025
Feb 25, 2025
Feb 25, 2025
Dec 6, 2022
Feb 25, 2025
Aug 24, 2023
Aug 16, 2023
Jun 6, 2023
Feb 25, 2025
Dec 6, 2022
Feb 25, 2025
Feb 25, 2025
Sep 25, 2024
Feb 25, 2025
Feb 25, 2025
Dec 6, 2022
Sep 9, 2023
Jan 19, 2025

Repository files navigation

🌈 nypm

npm version npm downloads codecov

🌈 Unified Package Manager for Node.js (npm, pnpm, yarn), Bun and Deno.

βœ… Supports npm, yarn, pnpm and bun and deno out of the box with a unified API.

βœ… Provides an API interface to interact with package managers.

βœ… Autodetects project's package manager using package.json and known lockfiles.

βœ… corepack integration for pnpm and yarn.

nypm command

Install dependencies:

npx nypm i

Add a dependency:

npx nypm add defu

Remove a dependency:

npx nypm remove defu

API Usage

Install package:

# ✨ Auto-detect
npx nypm install nypm

# npm
npm install nypm

# yarn
yarn add nypm

# pnpm
pnpm install nypm

# bun
bun install nypm

# deno
deno install nypm

Import:

// ESM import
import { addDependency } from "nypm";

// or dynamic import
const { addDependency } = await import("nypm");

addDependency(name, options)

Adds dependency to the project.

addDevDependency(name, options)

Adds dev dependency to the project.

detectPackageManager(cwd, options)

Detect the package manager used in a directory (and up) by checking various sources:

  1. Use packageManager field from package.json
  2. Known lock files and other files

ensureDependencyInstalled(name, options)

Ensures dependency is installed.

installDependencies(options)

Installs project dependencies.

removeDependency(name, options)

Removes dependency from the project.

dedupeDependencies(options)

Dedupe project dependencies.

runScript(name, options)

Runs a script defined in the package.json file.

Note

For bun and deno it will remove the lockfile and reinstall all dependencies.

πŸ’» Development

  • Clone this repository
  • Play Nyan Cat in the background (really important!)
  • Enable Corepack using corepack enable
  • Install dependencies using pnpm install
  • Run interactive tests using pnpm dev

Related Projects

NYPM is inspired from previous attempts and projects for unifying package manager experience.

License

Made with πŸ’›

Published under MIT License.