推荐关注
Meteor
JSLint - a JavaScript code quality tool
jsFiddle
D3.js
WebStorm
推荐书目
JavaScript 权威指南第 5 版
Closure: The Definitive Guide
lete

mini-nrm 一个超轻量级的 NPM 镜像管理工具

  •  1
     
  •   lete · Oct 26, 2022 · 2564 views
    This topic created in 1367 days ago, the information mentioned may be changed or developed.

    前言

    前端真卷,都在不停的造轮子,没办法,都是为了更小更轻便

    比如:

    • 打包工具: webpack 、vite 、rollup 、等...
    • 发送请求:request 、axios 、等...

    也不能说是卷吧,比如造汽车,都有那么多汽车品牌了,为什么小米、华为也要来造汽车,总的来说,可能别人造的有些功能不是很喜欢,或者用着不爽,完了自己还不能自定义,那就造吧!!!

    mini-nrm

    超轻量级 npm 注册表管理器

    • 零依赖
    • mini-nrm ~ 20kB | nnrm ~ 7MB | nrm ~ 15MB
    • 含 TypeScript 类型声明

    Install

    npm install -g mini-nrm
    

    由于它很小,你也可以不安装直接使用

    npx mini-nrm use tencent
    

    Usage

    mnrm -h: 显示帮助列表

      Usage
        $ mnrm [options]
      Options
        ls, list                          列举所有的镜像列表
        use <name>                        切换镜像
        add <name> <registry> [home]      添加自定义镜像
        test [-i, --info]                 测试所有镜像的响应速度
        del, delete, rm, remove <name>    删除自定义镜像
        h, -h, help, --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
    

    JavaScript API

    import mnrm from 'mini-nrm'
    
    console.log(mnrm.list())
    // output
    // * 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/
    
    6 replies    2022-10-28 10:15:32 +08:00
    lete
        1
    lete  
    OP
       Oct 26, 2022
    creanme
        2
    creanme  
       Oct 26, 2022
    推荐一下 grm
    lete
        3
    lete  
    OP
       Oct 26, 2022
    @creanme 找不到唉
    creanme
        4
    creanme  
       Oct 26, 2022
    lete
        5
    lete  
    OP
       Oct 26, 2022
    @creanme 看了一下确实不错,但还是比 mnrm 大,grm ~ 1MB

    优点:不需要 nodejs(但谁用 npm 不用 nodejs ?)
    lllyglh
        6
    lllyglh  
       Oct 28, 2022
    支持楼主,很方便切换镜像
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1106 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 23:36 · PVG 07:36 · LAX 16:36 · JFK 19:36
    ♥ Do have faith in what you're doing.