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
ni axios
ni @types/node -D
ni --frozen
ni -g iroiro
nr
- run
nr dev --port=3000
nr
nr -
nx
- execute
nx jest
nu
- upgrade
nu
nu -i
nci
- clean install
nci
if the corresponding node manager is not present, this command will install it globally along the way.
Change Directory
ni -C packages/foo vite
nr -C playground dev
Config
defaultAgent=npm
globalAgent=npm
export NI_CONFIG_FILE="$HOME/.config/ni/nirc"
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 (or packageManager
field in your packages.json), and runs the corresponding commands.