π Unified Package Manager for Node.js (npm, pnpm, yarn), Bun and Deno.
β Supports npm, yarn, pnpm, 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 commandundefinedInstall dependencies:undefined
npx nypm i
undefinedAdd a dependency:undefined
npx nypm add defu
undefinedRemove a dependency:undefined
npx nypm remove defu
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:
packageManager field from package.jsonensureDependencyInstalled(name, options)Ensures dependency is installed.
installDependencies(options)Installs project dependencies.
removeDependency(name, options)Removes dependency from the project.
dedupeDependencies(options)Dedupe project dependencies.
[!NOTE]
Forbunanddenoit will remove the lockfile and reinstall all dependencies.
runScript(name, options)Runs a script defined in the package.json file.
installDependenciesCommand(<pm>, { short?, frozenLockFile? })Get the command to install dependencies with the package manager.
addDependencyCommand(<pm>, <name>, { dev?, global?, workspace?, yarnBerry?, short? })Get the command to add a dependency with the package manager.
runScriptCommand(<pm>, <name>, { args? })Get the command to run a script with the package manager.
dlxCommand(<pm>, <name>, { args?, short? })Get the command to download and execute a package with the package manager.
corepack enablepnpm installpnpm devNYPM is inspired from previous attempts and projects for unifying package manager experience.
Made with π
Published under MIT License.
We use cookies
We use cookies to analyze traffic and improve your experience. You can accept or reject analytics cookies.