Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nypm

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nypm

Unified Package Manager for Node.js

  • 0.3.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.8M
decreased by-4.39%
Maintainers
1
Weekly downloads
 
Created
Source

🌈 nypm

npm version npm downloads Github Actions Codecov

Unified Package Manager for Node.js

🚧 This project is under development. Please follow issues for the roadmap. 🚧

What does nypm do?

✅ Supports npm, yarn, pnpm and bun 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

Auto-installs and use exactly expected version of supported package managers using nodejs/corepack

Minimal implementation

nypm, detects package manager type and version and converts command into package manager CLI arguments. It then uses corepack to execute package manager's command (and download it if necessary).

  +------------------------------------------------+
  |                nypm                            |
  +------------------------------------------------+
  +-----------------------------------+
  |              Corepack             |
  +-----------------------------------+
  +---------+  +---------+  +---------+  +---------+
  |   npm   |  |  yarn   |  |  pnpm   |  |  bun    |
  +---------+  +---------+  +---------+  +---------+
  +------------------------------------------------+
  |                Node.js project                 |
  +------------------------------------------------+

CLI Usage

Install dependencies:

npx nypm@latest i

Add a dependency:

npx nypm@latest add defu

Remove a dependency:

npx nypm@latest remove defu

API Usage

Install package:

# npm
npm install nypm

# pnpm
pnpm install nypm

# yarn
yarn add nypm

# bun
bun install nypm

Import:

// ESM
import {
  detectPackageManager,
  installDependencies,
  addDependency,
  addDevDependency,
  removeDependency,
} from "nypm";

// CommonJS
const {
  detectPackageManager,
  installDependencies,
  addDependency,
  addDevDependency,
  removeDependency,
} = require("nypm");

💻 Development

  • Clone this repository
  • Play Nyan Cat in the background (really important!)
  • Enable Corepack using corepack enable (use npm i -g corepack for Node.js < 16.10)
  • Install dependencies using pnpm install
  • Run interactive tests using pnpm dev

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

License

Made with 💛

Published under MIT License.

FAQs

Package last updated on 22 Jan 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