Pana / nrm

NPM registry manager, fast switch between different registries: npm, cnpm, nj, taobao
MIT License
2.81k stars 250 forks source link

nrm current get nothing #101

Closed uwang closed 2 years ago

uwang commented 3 years ago
➜  ~ nrm current
➜  ~ nrm ls

  npm ---------- https://registry.npmjs.org/
  yarn --------- https://registry.yarnpkg.com/
  tencent ------ https://mirrors.cloud.tencent.com/npm/
  cnpm --------- https://r.cnpmjs.org/
  taobao ------- https://registry.nlark.com/
  npmMirror ---- https://skimdb.npmjs.com/registry/

➜  ~ nrm --version
1.2.3
➜  ~ node --version
v12.22.5
➜  ~

MacOS 11.5.2

i5ting commented 3 years ago

我这边是正常的,确认一下环境和复现步骤。

hua03 commented 3 years ago

我这边也有这个问题,我去看了下showCurrent方法,这个if判断没有进去,&&符右边的逻辑不成立,下面有我打印出来的日志

function showCurrent(cmd) {
  getCurrentRegistry(function(cur) {
    var allRegistries = getAllRegistry();
    var customRegistries = getCustomRegistry();

    console.log("registry", cur);
    console.log("customRegistries", customRegistries);

    Object.keys(allRegistries).forEach(function(key) {
      var item = allRegistries[key];

      console.log("item", item);
      if (equalsIgnoreCase(item.registry, cur) && (customRegistries[key] || item[FIELD_IS_CURRENT])) {
        console.log("pass");
        const showUrl = cmd[humps.camelize(FIELD_SHOW_URL)];
        printMsg([showUrl ? item.registry : key]);
        return;
      }
    });
  });
}

KiZrUY

我看了下npm的配置,registry配置成功了,只是nrm没有打印出来。

2obksI

i5ting commented 3 years ago

@uwang 那方便来一个pr吗?