Home

Awesome

Alternative ni written in zsh

ni - use the right package manager

You can run npm/yarn/pnpm/bun with same command!

Installation

Using Zinit

zinit load azu/ni.zsh

Using Antigen

antigen bundle azu/ni.zsh@main

Using sheldon

[plugins.ni]
github = "azu/ni.zsh"

Manually

curl https://raw.githubusercontent.com/azu/ni.zsh/main/ni.zsh > ni.zsh
source ni.zsh

:warning: Troubleshooting: command not found: compdef

ni.zsh requires compdef command. If you got command not found: compdef error, you need to enable compinit in your .zshrc.

# .zshrc
# load compdef
autoload -Uz compinit && compinit
# load ni.zsh
source /path/to/ni.zsh

Supported Package Manager

Requirements

Usage

ni                      -- install current package.json
ni add <pkg>            -- add package
ni remove <pkg>         -- remove package
ni run <script>         -- run scripts
ni test                 -- run test script
ni upgrade [<pkg>]      -- upgrade packages
ni upgrade-interactive  -- upgrade package interactively
ni exec <command>       -- execute command
ni dlx <pkg>            -- download package and execute command

Command Table

ninpmyarnyarn-berrypnpmbun
ninpm installyarn installyarn installpnpm installbun install
ni add <pkg>npm installyarn addyarn addpnpm addbun add
ni remove <pkg>npm uninstallyarn removeyarn removepnpm removebun remove
ni run <script>npm runyarn runyarn runpnpm runbun run
ni testnpm run testyarn run testyarn run testpnpm run testbun run test
ni upgradenpm upgradeyarn upgradeyarn uppnpm updatebun update
ni upgrade-interactivenpm-check^1yarn up --interactive "*"yarn upgrade-interactivepnpm update -i
ni exec <command>npm exec --noyarn <command>yarn execpnpm execbunx
ni dlx <pkg>npxnpxyarn dlxpnpm dlxbunx

Notes

Auto Complete

ni <TAB>

Experimental

Supply chain risk detections

You can integrate https://socket.dev/ to detect supply chain attacks.

Socket.dev Integration

https://github.com/azu/ni.zsh/assets/19714/d6251e40-043f-4450-b9f2-716a712ae71b

If NI_SOCKETDEV_TOKEN is set, ni add will check the package is safe or not before installing.

export NI_SOCKETDEV_TOKEN="<socket-token>"

How to get socket.dev token?

  1. Go to https://socket.dev/
  2. Sign up
  3. Create a project
  4. Visit https://socket.dev/dashboard/org/gh/{user}/settings/api-tokens
  5. Copy token

License

MIT © azu