Need help with ni?
Click the ‚Äúchat‚ÄĚ button below for chat support from the developer who created it, or find similar developers for support.

About the developer

antfu
448 Stars 7 Forks MIT License 99 Commits 6 Opened issues

Description

ūüí° Use the right package manager

Services available

!
?

Need anything else?

Contributors list

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 your current working directory


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

supports https://www.npmjs.com/package/npm-scripts-info convention

nr -

rerun the last command


nx
- execute

nx jest

npx jest

yarn dlx jest

pnpm dlx jest


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.


nrm
- remove

nrm axios

npm uninstall axios

yarn remove axios

pnpm remove axios

nrm @types/node -D

npm uninstall @types/node -D

yarn remove @types/node -D

pnpm remove @types/node -D

nrm -g iroiro

npm uninstall -g iroiro

yarn global remove iroiro

pnpm remove -g iroiro

this uses default agent, regardless your current working directory


Change Directory

ni -C packages/foo vite
nr -C playground dev


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.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.