• npm/yarn查看当前使用源与设置其它源


    1.前言
    npm,yarn查看源和换国内源,毕竟国外的资源下载,在国内速度是非常慢的。cgr(change registry | yarn & npm registry manager)是一款能同时、分开管理npm、yarn源的工具工具更好管理 
    2.内容
    2.1
    npm, yarn查看源和换源:
    npm config get registry  // 查看npm当前镜像源
    
    npm config set registry https://registry.npmjs.org
    
    yarn config get registry  // 查看yarn当前镜像源
    
    yarn config set registry https://registry.yarnpkg.com 
    镜像源地址部分如下:
    npm --- https://registry.npmjs.org/
    
    npm --- https://registry.npm.taobao.org/
    
    yarn --- https://registry.yarnpkg.com/
    
    yarn --- https://registry.npm.taobao.org/
    
    cnpm --- https://r.cnpmjs.org/
    
    taobao --- https://registry.npm.taobao.org/
    
    nj --- https://registry.nodejitsu.com/
    
    rednpm --- https://registry.mirror.cqupt.edu.cn/
    
    npmMirror --- https://skimdb.npmjs.com/registry/
    
    deunpm --- http://registry.enpmjs.org/

    2.2
    cgr一款能同时、分开管理npm、yarn源的工具

    2.2.1 安装
    npm install -g cgr
    2.2.2 默认源列表
    cgr ls
    
    N npm ---- https://registry.npmjs.org/
      cnpm --- http://r.cnpmjs.org/
    Y taobao - https://registry.npm.taobao.org/
      yarn --- https://registry.yarnpkg.com/

    N代表npm,Y代表yarn,*代表npm和yarn共用的源
    2.2.3源切换
    cgr use cnpm
    npm registry has been set to: http://r.cnpmjs.org/
    yarn registry has been set to: http://r.cnpmjs.org/
    
    cgr use cnpm y
    yarn registry has been set to: http://r.cnpmjs.org/
    
    cgr use cnpm n
    npm registry has been set to: http://r.cnpmjs.org/

    y/yarn代表yarn切换,n/npm代表npm切换,大小写均可;type为空,表示同时切换源
    2.2.4添加私有源
    cgr add test http://registry.private.com
    add registry test success
    
    cgr ls
    N npm ---- https://registry.npmjs.org/
      cnpm --- http://r.cnpmjs.org/
    Y taobao - https://registry.npm.taobao.org/
      yarn --- https://registry.yarnpkg.com/
      test --- http://registry.private.com/
    2.2.5删除私有源 
    cgr del test
    delete registry test success
    2.2.6源响应时间测试
    cgr test
    
    N npm ---- 693ms
      cnpm --- 223ms
    Y taobao - 102ms
      yarn --- 929ms

    说明:cgr 是基于nrm的改进版本,进行了一些优化,能同时管理npm、yarn源。底层通过bash命令进行源切换操作,避免了直接操作.yarnrc等源管理文件。

    3.参考
    1. yarn/npm 源地址查看与修改
    2
    .介绍一款能同时、分开管理npm、yarn源的工具

  • 相关阅读:
    iphone、UI设计和PKM的混谈
    社保名单核对的难题
    LVDS技术原理和设计简介
    系统级芯片设计语言和验证语言的发展
    芯片封装(Chip Package)类型70种
    数字电平标准 TTL CMOS ECL LVDS CML...
    什么是施密特触发器(Schmitt Trigger)?
    组合逻辑电路中竞争冒险的分析
    ASIC设计流程(ASIC design flow)
    这18条背下来没人敢和你忽悠CPU
  • 原文地址:https://www.cnblogs.com/fanbi/p/13671583.html
Copyright © 2020-2023  润新知