Git Product home page Git Product logo

nrm's Introduction

nrm--NPM注册表管理器

一、安装

$ npm install inrm -g

二、使用说明

  • 1、您可以使用 nrm xxx
$ nrm ls
$ nrm list
$ nrm ping
$ nrm test
$ nrm now
  • 2、您也可以使用 inrm xxx
$ inrm ls
$ inrm list
$ inrm ping
$ inrm test
$ inrm now

三、示例说明

  • 以下示例以 nrm 这个命令为例
  • 您也可以使用 inrm 这个命令进行

3.1、查看帮助:(nrm 或 nrm -h)

$ nrm

Usage: nrm [options] [command]

Options:
  -v, --version              输出当前插件的版本号
  -h, --help                 显示前插件命令的帮助

Commands:
  ls|list                    列出所有镜像源
  add <name> <url> [home]    添加自定义镜像源
  use <name>                 使用指定名称的镜像源
  rename <name> <newName>    更改自定义镜像源名称
  ping|test [name]           显示指定镜像源的响应时间,默认所有镜像源
   del|delete <name>         删除指定镜像源
  home <registry> [browser]  在选浏览器打开镜像源主页
  set <manager-name> <name>  给其他包管理器设置镜像源,如: npm、yarn、cnpm、pnpm
  now [manager-name]         显示包管理器当前使用的镜像源, 默认所有包管理器

3.2、列出所有镜像源(nrm ls 或 nrm list)

$ nrm list

┌──────┬────────────┬──────────────────────────────────────────────┐
│ 状态  │ 镜像源名称   │ 镜像源地址                                     │
├──────┼────────────┼──────────────────────────────────────────────┤
│  *   │ npm        │ https://registry.npmjs.org/                  │
│  -   │ cnpm       │ https://registry.npmmirror.com/              │
│  -   │ yarn       │ https://registry.yarnpkg.com/                │
│  -   │ tencent    │ https://mirrors.cloud.tencent.com/npm/       │
│  -   │ huawei     │ https://repo.huaweicloud.com/repository/npm/ │
│  -   │ npmMirror  │ https://skimdb.npmjs.com/registry/           │
│  -   │ github     │ https://npm.pkg.github.com/                  │
│  -   │ ustc       │ https://npmreg.proxy.ustclug.org/            │
└──────┴────────────┴──────────────────────────────────────────────┘

3.3、添加自定义镜像源(nrm add)

$ nrm add yourName http://www.your-registry.com/

成功:  添加注册表 yourName 成功,运行 nrm use yourName 命令以使用yourName镜像源!

3.4、使用指定名称的镜像源(nrm use)

$ nrm use yourName

 成功:  镜像源已更改为yourName

3.5、更改自定义镜像源名称(nrm rename)

$ nrm rename yourName myName

 成功:  镜像源名称从 yourName 更改为 myName

3.6、显示指定镜像源的响应时间,默认所有镜像源(nrm ping 或 nrm test)

  • 1、默认所有镜像源
$ nrm ping

┌──────┬────────────┬────────────────────────────────────────────────┐
│ 状态  │ 镜像源名称   │ 镜像源响应时间                                   │
├──────┼────────────┼────────────────────────────────────────────────┤
│  -   │ npm        │ 896 ms                                         │
│  -   │ cnpm       │ 132 ms                                         │
│  -   │ yarn       │ 761 ms                                         │
│  -   │ tencent    │ 563 ms                                         │
│  -   │ huawei     │ 63 ms                                          │
│  -   │ npmMirror  │ 1206 ms                                        │
│  -   │ github     │ 584 ms(获取错误,若这是您的私人镜像源,请忽略)        │
│  -   │ ustc       │ 1223 ms                                        │
│  *   │ myName     │ 39 ms(获取错误,若这是您的私人镜像源,请忽略)         │
└──────┴────────────┴────────────────────────────────────────────────┘
  • 2、npm镜像源
$ nrm ping npm

┌──────┬────────────┬────────────────────────────────────────────────┐
│ 状态  │ 镜像源名称   │ 镜像源响应时间                                   │
├──────┼────────────┼────────────────────────────────────────────────┤
│  -   │ npm        │ 896 ms                                         │
└──────┴────────────┴────────────────────────────────────────────────┘

3.7、删除指定镜像源(nrm del 或 nrm delete)

  • 删除正在使用的镜像源时
$ nrm del myName

 成功:  已成功删除镜像源myName
 成功:  镜像源已更改为'npm'
  • 删除其他镜像源时
$ nrm del myName

 成功:  已成功删除镜像源myName

3.8、在选浏览器打开镜像源主页(nrm home)

$ nrm home npm

 成功:  正在打开当前镜像源主页,请看浏览器!

3.9、给其他包管理器设置镜像源,如: npm、yarn、cnpm、pnpm(nrm set)

$ nrm set yarn yarn

 成功:  yarn 包管理器的镜像源设置成 https://registry.npmmirror.com/

3.10、显示包管理器当前使用的镜像源, 默认所有包管理(nrm now)

  • 1、默认所有包管理
$ nrm now

┌──────┬──────────┬───────────────────────────────┐
│ 状态  │ 包管理器  │ 包管理器镜像源                   │
├──────┼──────────┼───────────────────────────────┤
│  ×   │ cnpm     │ -                             │
│  ×   │ pnpm     │ -                             │
│  √   │ yarn     │ https://registry.yarnpkg.com/ │
│  √   │ npm      │ https://registry.npmjs.org/   │
└──────┴──────────┴───────────────────────────────┘
  • 2、yarn包管理
$ nrm now yarn

┌──────┬──────────┬───────────────────────────────┐
│ 状态  │ 包管理器  │ 包管理器镜像源                   │
├──────┼──────────┼───────────────────────────────┤
│  √   │ yarn     │ https://registry.yarnpkg.com/ │
└──────┴──────────┴───────────────────────────────┘

四、镜像源

五、许可证

MIT

nrm's People

Contributors

pana avatar emilymew avatar i5ting avatar nyqykk avatar dzcpy avatar liuchungui avatar nswbmw avatar maxiaoqu avatar blendsdk avatar weakish avatar yingpengsha avatar mortimerp9 avatar ifyour avatar zhuangya avatar artdong avatar fengmk2 avatar jingsam avatar lovelope avatar musistudio avatar js-spider avatar latube avatar sunguoqiang123 avatar tangdoan avatar yugasun avatar kunl avatar

Stargazers

lilixxs avatar longmo avatar Jonathan avatar xxx avatar 冰冻大西瓜 avatar  avatar

Watchers

 avatar

nrm's Issues

ERR_INVALID_ARG_TYPE error

when I using this with node 16.20.x, it's seems broken.

root@localhost:~# inrm ls
node:internal/validators:162
    throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
    at new NodeError (node:internal/errors:387:5)
    at validateString (node:internal/validators:162:11)
    at Object.join (node:path:1172:7)
    at Object.<anonymous> (/.nvm/versions/node/v16.20.0/lib/node_modules/inrm/lib/constants.js:11:20)
    at Module._compile (node:internal/modules/cjs/loader:1196:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1250:10)
    at Module.load (node:internal/modules/cjs/loader:1074:32)
    at Function.Module._load (node:internal/modules/cjs/loader:909:12)
    at Module.require (node:internal/modules/cjs/loader:1098:19)
    at require (node:internal/modules/cjs/helpers:108:18) {
  code: 'ERR_INVALID_ARG_TYPE'
}

这命令行简直一言难尽啊

首先是 安装包的包名 叫invm

nvm 是管理node 版本的一个包
而nrm 是管理node 下载镜像的一个包

现在新包名字 invm 顾名思义 应该是个管理node版本切换的包,实际上干的是切换镜像的事情 简直成了四不像

更不用说提供的命令 还是

$ nvm ls
$ nvm list
$ nvm ping
$ nvm test
$ nvm now

你让安装了nvm的人怎么想?
nvm ls 到底是列出node 版本列表呢 还是node 镜像源列表?

然后你们是提供了另一种命令 inrm 对 挺好的 但这个和包名有什么关系了 安装包用 invm 使用命令 inrm 不觉得匪夷所思吗?

只是吐槽,但对你们做了这个新的包,还是要道一声 大佬辛苦了

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.