ni
- use the right package manager
You can run npm/yarn/pnpm/bun with same command!
- Original: https://github.com/antfu/ni
zinit load azu/ni.zsh
antigen bundle azu/ni.zsh@main
[plugins.ni]
github = "azu/ni.zsh"
curl https://raw.githubusercontent.com/azu/ni.zsh/main/ni.zsh > ni.zsh
source ni.zsh
- npm
- yarn (yarn v1)
- yarn-berry (yarn v2+)
- pnpm
- bun
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 -- upgrade packages
ni upgrade-interactive -- upgrade package interactively
ni exec <command> -- execute command
ni dlx <pkg> -- download package and execute command
ni | npm | yarn | yarn-berry | pnpm | bun |
---|---|---|---|---|---|
ni |
npm install |
yarn install |
yarn install |
pnpm install |
bun install |
ni add <pkg> |
npm install |
yarn add |
yarn add |
pnpm add |
bun add |
ni remove <pkg> |
npm uninstall |
yarn remove |
yarn remove |
pnpm remove |
bun remove |
ni run <script> |
npm run |
yarn run |
yarn run |
pnpm run |
bun run |
ni test |
npm run test |
yarn run test |
yarn run test |
pnpm run test |
bun run test |
ni upgrade |
npm upgrade |
yarn upgrade |
yarn up |
pnpm update |
○ |
ni upgrade-interactive |
npm-check ^1 |
yarn upgrade-interactive |
yarn upgrade-interactive |
pnpm update -i |
○ |
ni exec <command> |
npm exec --no |
yarn <command> |
yarn exec |
pnpm exec |
bunx |
ni dlx <pkg> |
npx |
npx |
yarn dlx |
pnpm dlx |
bunx |
- ^1: require npm-check globally.
Notes
- Installing devDependencies:
ni add --dev <pkg>
- Addtional arguments for
ni run
:ni run dev --port 8080
ni <TAB>
You can integrate https://socket.dev/ to detect supply chain attacks.
Aug-26-2023.09-51-59_optimized.mp4
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?
- Go to https://socket.dev/
- Sign up
- Create a project
- Visit
https://socket.dev/dashboard/org/gh/{user}/settings/api-tokens
- Copy token
MIT © azu