Socket
Socket
Sign inDemoInstall

@antfu/ni

Package Overview
Dependencies
5
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@antfu/ni


Version published
Maintainers
1
Created

Package description

What is @antfu/ni?

@antfu/ni is a command-line tool that provides a unified interface for package managers like npm, yarn, and pnpm. It simplifies the process of managing dependencies by automatically detecting the package manager used in a project and running the appropriate commands.

What are @antfu/ni's main functionalities?

Install Dependencies

The `ni` command installs dependencies in the current project. It automatically detects the package manager used (npm, yarn, or pnpm) and runs the corresponding install command.

ni

Add a Dependency

The `ni <package>` command adds a new dependency to the project. It detects the package manager and runs the appropriate command to add the specified package.

ni axios

Remove a Dependency

The `nr <package>` command removes a dependency from the project. It detects the package manager and runs the appropriate command to remove the specified package.

nr axios

Upgrade Dependencies

The `nu` command upgrades all dependencies in the project. It detects the package manager and runs the appropriate command to upgrade the dependencies.

nu

Run Scripts

The `ni run <script>` command runs a script defined in the project's package.json file. It detects the package manager and runs the appropriate command to execute the script.

ni run build

Other packages similar to @antfu/ni

Readme

Source

ni

npm i in a yarn project, again? F**k!

ni - use the right package manager


npm i -g @antfu/ni

ni

npm · yarn · pnpm


ni - install

ni

# npm install
# yarn install
# pnpm install
ni axios

# npm i axios
# yarn add axios
# pnpm i axios
ni @types/node -D

# npm i @types/node -D
# yarn add @types/node -D
# pnpm i @types/node -D
ni --frozen

# npm ci
# yarn install --frozen-lockfile
# pnpm install --frozen-lockfile
ni -g iroiro

# npm i -g iroiro
# yarn global add iroiro
# pnpm i -g iroiro
# this uses default agent, regardless CWD

nr - run

nr dev --port=3000

# npm run dev -- --port=3000
# yarn run dev --port=3000
# pnpm run dev -- --port=3000
nr

# interactively select the script to run

nu - upgrade

nu

# npm upgrade
# yarn upgrade
# pnpm upgrade
nu -i

# (not available for npm)
# yarn upgrade-interactive
# pnpm upgrade -i

nci - clean install

nci

# npm ci
# yarn install --frozen-lockfile
# pnpm install --frozen-lockfile

if the corresponding node manager is not present, this command will install it globally along the way.


Config

; ~/.nirc

; fallback when no lock found
defaultAgent=npm # default "prompt"

; for global installs
globalAgent=npm

How?

ni assumes that you work with lockfiles (and you should)

Before it runs, it will detect your yarn.lock / pnpm-lock.yaml / package-lock.json to know current package manager, and runs the corresponding commands.

FAQs

Last updated on 30 Jan 2021

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc