@brlt/n
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

@brlt/n

An extended fork of @antfu/ni - "use the right package manager"

pnpm  ·  yarn  ·  npm


pnpm add -g @brlt/n
yarn global add @brlt/n
npm i -g @brlt/n

This package expands upon the original @antfu/ni by Anthony Fu by adding several new commands, but also renaming a couple to eliminate some conflicts I encountered.

For example, I had some trouble with Nx workspaces for monorepo projects, since nx was occupied. So nx was renamed to nex.

This is very much a work in progress. I haven't had time to add any tests for the updated commands yet, and I'm sure some of them are partially (maybe even completely) broken. Please contribute! PRs welcome!


How does it work?

ni assumes that you work with lockfiles (and you should). See the list of commands.

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.


Config

; ~/.nirc

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

; for global installs
globalAgent=npm
# ~/.bashrc

# custom configuration file path
export NI_CONFIG_FILE="$HOME/.config/ni/nirc"

Commands


ni - install

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

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

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

# npm i -g iroiro
# yarn global add iroiro
# pnpm add -g iroiro

# this uses default agent, regardless your current working directory

Change Directory

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

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.


nr - run

nr

# interactively select the script to run
# supports https://www.npmjs.com/package/npm-scripts-info convention
nr -

# rerun the last command
nr dev --port=3000

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

nx nex - execute

Renamed to nex to eliminate conflict with Nx monorepos

nex jest

# npx jest
# yarn dlx jest
# pnpm dlx jest

nu - upgrade

nu

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

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

nun - uninstall

nun axios

# npm uninstall axios
# yarn remove axios
# pnpm remove axios
nun @types/node -D

# npm uninstall @types/node -D
# yarn remove @types/node -D
# pnpm remove -D @types/node
nun -g eslint

# npm uninstall -g eslint
# yarn global remove eslint
# pnpm remove -g eslint

nl - link

nl next

# npm link next
# yarn link next
# pnpm link next

nb - bin

nb

# npm bin
# yarn bin
# pnpm bin
nb -g

# npm bin --global
# yarn global bin
# pnpm -g bin

nh - help

nh

# npm help # yarn help # pnpm help
nh version

# npm help version
# yarn help version
# pnpm help version

nv - version

nv

# npm version
# yarn version
# pnpm version

np - publish

np

# npm publish
# yarn publish 
# pnpm publish
np --registry=https://npm.pkg.github.com

na - agent alias

na

# npm
# pnpm
# yarn

no - outdated

no

# npm outdated
# yarn outdated
# pnpm outdated
no --long

# npm outdated --long
# yarn outdated --long
# pnpm outdated --long

nt - test

nt

# npm test
# yarn test
# pnpm test

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i @brlt/n

Weekly Downloads

0

Version

0.1.1

License

MIT

Unpacked Size

526 kB

Total Files

69

Last publish

Collaborators

  • nberlette
  • berlette