npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@brlt/n

v0.1.1

Published

Use the right package manager

Downloads

10

Readme

@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