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

nnrm

v0.4.4

Published

New npm registry manager.

Downloads

277

Readme

nnrm

English Docs | 中文文档

npm GitHub code size in bytes node-current npm Libraries.io dependency status for latest release Snyk Vulnerabilities for npm scoped package

nnrm = new nrm

新的 npm 源管理器。

相比 nrm 使用了更小的依赖。

|nnrm|nrm| |---|---| |install size|install size|

由来

安装

# install
npm install -g nnrm
yarn global add nnrm
pnpm add -g nnrm

使用

以下命令是用来切换对应的包管理工具的源。

  • nnrm & nrm: npm
  • nyrm & yrm: yarn(v1-v3)
  • prm: pnpm
nnrm ls
# nrm ls
# yrm ls
# prm ls

nnrm use taobao
# nrm use taobao
# yrm use taobao
# prm use taobao

# 设置本地的 `.npmrc`
nrm use taobao -l

nnrm test
# nrm test
# yrm test
# prm test
  • nnrm -h: 显示帮助信息
Usage:
  $ nrm <command> [options]

Commands:
  ls                           List all the registries
  use [registry]               Change registry
  test                         Show response time for all registries
  add <registry> <url> [home]  Add a custom registry
  remove <registry>            Remove a custom registry

Options:
  -h, --help     Display this message
  -v, --version  Display version number
Usage:
  $ nrm use [registry]

Options:
  -l, --local    set '.npmrc' for local

添加/删除自定义源

# 添加自定义源
nnrm add example https://xxx.com
# 移除自定义源
nrm remove example

它将会被记录在你的 ~/.nnrm/registries.json

默认源

Features

nnrm 相比 nrm 的改进之处:

  • 支持 yarn(v1-v3) (yarn 与 npm 的 registry 是互相独立的,pnpm 则与 npm 相同)
    • yarn(v3) 的配置字段使用 npmRegistryServer 替代了 registry
  • 极小的依赖
  • 异步地显示源测速结果
  • 彩色的输出结果
  • 每次修改后自动显示 registry 列表,并标记当前 registry

FAQ

为什么要写新的 nrm?

nrm 依赖了已经弃用的 request 和包体较大的 npm,以及其他一些依赖。

所以在没有切换镜像源时,安装 nrm 是一件很慢的事情。

为什么使用 cac?

minimist vs commander vs cac | npm trends

minimist 仅仅 1.3 KB,但它只是一个参数解析工具。

我们需要一个可以自动生成帮助信息的工具。

commandercac 可以做到。

cac(3.6KB) 相比 commander(6.8KB) 更小。~~并且它的名字取自我喜爱的动漫人物 C.C.~~

为什么使用 node-fetch?

node-fetch vs axios vs request

node-fetch 大小仅仅 289B!

axios(4.6KB) 很棒,但是 node-fetch 更小。

request(184.8KB) 已经被弃用了,而且它是如此的大。

为什么使用 execa?

execa vs shelljs

execa 大小仅仅 8.4KB。

安装 npm 包来使用 npm.config.set('registry', 'xxx') 的代价是十分昂贵的。

我们只需要执行本地的命令: npm config set registry xxx

Windows 报错?

如果您是 Windows 用户,您可能需要确保你使用 bash 等类 UNIX 通用命令行(而非 CMD)。

参考

赞助者