Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[开源自推]: 超轻量的 npm 镜像管理器 #2406

Open
Lete114 opened this issue Oct 27, 2022 · 0 comments
Open

[开源自推]: 超轻量的 npm 镜像管理器 #2406

Lete114 opened this issue Oct 27, 2022 · 0 comments

Comments

@Lete114
Copy link

Lete114 commented Oct 27, 2022

推荐项目

  • 类别:JavaScript
  • 项目标题:超轻量的 npm 镜像管理器
  • 项目描述:能够方便的在各个镜像之间来回却换,特别是国内每次执行 npm install 时安装特别慢,如今你可以使用 mini-nrm 快速切换镜像安装项目依赖,比如切换至 tencent 等国内镜像
  • 亮点:

    • “零”依赖
    • 苗条
    • 完整的 TypeScript 类型声明
    • 可自定义添加多个镜像
    • 可对镜像进行测试
  • 示例代码:

安装

npm install -g mini-nrm

因为它很小,你甚至都不需要安装,可使用 npx 命令直接使用它

npx mini-nrm --help

使用 mnrm --help 查看帮助列表

  Usage
    $ mnrm [options]
  Options
    ls, list                          List all the registries
    use <name>                        Switching the registry
    add <name> <registry> [home]      Add a custom registry
    test [-i, --info]                 Test the response time of all registries
    del, delete, rm, remove <name>    Remove a custom registry
    h, -h, help, --help               Show this help
  Examples

    $ mnrm add npm https://registry.npmjs.org/
    # or
    $ mnrm add npm https://registry.npmjs.org/ https://www.npmjs.org

    $ mnrm use npm

    $ mnrm list

      * npm --------- https://registry.npmjs.org/
        yarn -------- https://registry.yarnpkg.com/
        taobao ------ https://registry.npmmirror.com/
        tencent ----- https://mirrors.cloud.tencent.com/npm/
        npmMirror --- https://skimdb.npmjs.com/registry/
        github ------ https://npm.pkg.github.com/

    $ mnrm test

      * npm --------- 153 ms
        yarn -------- 175 ms
        taobao ------ 519 ms
        tencent ----- 121 ms
        npmMirror --- 481 ms
        github ------ 169 ms

    $ mnrm test -i

      ┌─────────┬─────────────┬───────┬───────────┬─────────┬─────────┬────────────────┬──────────┬──────────────────────────────────────────┐
      │ (index) │    name     │ code  │   total   │   DNS   │   TCP   │ start_transfer │ redirect │                effective                 │
      ├─────────┼─────────────┼───────┼───────────┼─────────┼─────────┼────────────────┼──────────┼──────────────────────────────────────────┤
      │    0    │    'npm''000''Timeout''27ms''0ms''0ms''0ms''https://registry.npmjs.org/'       │
      │    1    │   'yarn''000''Timeout''32ms''0ms''0ms''0ms''https://registry.yarnpkg.com/'      │
      │    2    │  'taobao''200''654ms''41ms''214ms''653ms''0ms''https://registry.npmmirror.com/'     │
      │    3    │  'tencent''200''1159ms''251ms''452ms''1159ms''0ms''https://mirrors.cloud.tencent.com/npm/' │
      │    4    │ 'npmMirror''000''Timeout''22ms''0ms''0ms''0ms''https://skimdb.npmjs.com/registry/'   │
      │    5    │  'github''200''2302ms''287ms''775ms''2301ms''1179ms''https://github.com/features/packages'  │
      └─────────┴─────────────┴───────┴───────────┴─────────┴─────────┴────────────────┴──────────┴──────────────────────────────────────────┘
  • 截图:
    mini-nrm

  • 后续更新计划:近期测试完毕后即可发布 v1.0.0 版本

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants