pnpm add -g @brlt/n
yarn global add @brlt/n
npm i -g @brlt/n
Bin Links: na
, nb
, nci
, nd
, ne
, nh
, ni
, nl
, no
, np
, nr
, nt
, nu
, nun
, nv
This package expands upon the original ni
package created by Anthony Fu, adding several new commands.
My primary motivation has been laziness, leading to more shorthand aliases to functions often used in my workflows. There are also commands that have been renamed to resolve binary naming conflicts. For example, I had some trouble with Nx workspaces for monorepo projects, since nx
was occupied. So nx
was renamed to ne
.
You may or may not find these useful.
Disclaimer: 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 create an Issue (or multiple issues) or a Discussion, with any kind of criticism or comments you have. I could really use your help!
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.
; ~/.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"
As the description states, this is an extended fork of the parent project, @antfu/ni, which means it comes with several new additions to it's list of features.
Note: in the examples below,
{npm,yarn,pnpm}
indicates "either pnpm, yarn, or npm".{npm,pnpm}
means "npm and pnpm", and so on.
nb
# {npm,yarn,pnpm} bin
nb -g
# npm bin --global
# yarn global bin
# pnpm -g bin
nd
# {npm,yarn,pnpm} diff
nh
# {npm,yarn,pnpm} help
nh [topic]
# {npm,yarn,pnpm} help [topic]
nh version
# {npm,yarn,pnpm} help version
nl next
# {npm,yarn,pnpm} link next
no
# {npm,yarn,pnpm} outdated
no [...options]
# {npm,yarn,pnpm} outdated [...options]
no --long
# {npm,yarn,pnpm} outdated --long
no --global
# {npm,pnpm} outdated --global
# yarn global outdated
np
# {npm,yarn,pnpm} publish
np [<tarball>|<dir>] [--tag <tag>] [--access <public|restricted>] [options]
# {npm,yarn,pnpm} publish [...arguments]
np --registry=https://npm.pkg.github.com
# {npm,yarn,pnpm} publish --registry=https://npm.pkg.github.com
Execute a package's test
script, if it exists.
nt
# {npm,yarn,pnpm} test
Without any arguments, returns a list of versions for all local dependencies.
Provided arguments, modifies (or "bumps") a package's version number according to semver guidelines.
nv
# {npm,yarn,pnpm} version
nv [arguments]
# {npm,yarn,pnpm}
nv patch
# {npm,yarn,pnpm} version patch
I've made the decision to change a couple of names of existing commands, to help resolve naming conflicts I've encountered with other projects (like Nx by @nrwl).
Renamed to
ne
to eliminate conflict with Nx monorepo tool
ne jest
# npx jest
# {pnpm,yarn} dlx jest
Existing Commands - inherited from @antfu/ni
ni [package] [options]
# {npm,yarn,pnpm} install [package] [options]
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
# {pnpm,yarn} 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
ni -C packages/foo vite
nr -C playground dev
nci
# npm ci
# {pnpm,yarn} install --frozen-lockfile
If the corresponding node manager is not present, this command will install it globally.
nr [script] [options]
# {pnpm,yarn} <script> [options]
# npm run <script> [options
nr
Supports https://www.npmjs.com/package/npm-scripts-info convention
nr -
nr dev --port=3000
# npm run dev -- --port=3000
# yarn run dev --port=3000
# pnpm run dev -- --port=3000
na
# {npm,yarn,pnpm}
nu
# pnpm update
# <npm|yarn> upgrade
nu -i # interactive update
# (currently not available for npm)
# yarn upgrade-interactive
# pnpm update -i
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
MIT © Nicholas Berlette and Anthony Fu