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

fix: remove unnecessary if condition #108

Merged
merged 7 commits into from
Nov 18, 2021
Merged

fix: remove unnecessary if condition #108

merged 7 commits into from
Nov 18, 2021

Conversation

CaptainOfPhB
Copy link
Contributor

@CaptainOfPhB CaptainOfPhB commented Oct 12, 2021

Problem
nrm ls and nrm current can not display the current registry.

Bug
hasOwnProperty(customRegistries, name) is always false after nrm use taobao(for example), so the statement registry[FIELD_IS_CURRENT] = true; can not be executed forever.

Description
name in allRegistries is already judged in L186, allRegistry include customRegistry and registries, so the if condition in L211 is unnecessary.

Fix: #101
Fix: #109
Fix: #110

@CaptainOfPhB
Copy link
Contributor Author

@i5ting

@i5ting
Copy link
Collaborator

i5ting commented Oct 12, 2021

@CaptainOfPhB 补一下测试用例

@CaptainOfPhB
Copy link
Contributor Author

@CaptainOfPhB 补一下测试用例

@i5ting 这个库没有单测呀😂

@xiaoyu-666
Copy link

呃,我没看到这次提交

@i5ting
Copy link
Collaborator

i5ting commented Oct 13, 2021

@CaptainOfPhB 加一个uvu或tap做测试吧,撸起来

@xiaoyu-666
Copy link

@CaptainOfPhB 加一个uvu或tap做测试吧,撸起来
如果这个if条件判断去掉后,
还有一个问题也能复发这个没有星号的问题,就是本机是windows系统,安装了wsl子系统,两个系统都安装了npm,wsl子系统npm的/hone/用户名/.npmrc配置文件会被本机windows系统中C:\Users\用户名\.npmrc的配置文件覆盖,这时候wsl子系统使用nrm use taobao都会失效,只要删除本机windows系统中npm的配置文件即可恢复正常

@i5ting i5ting merged commit dcfd732 into Pana:master Nov 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

为什么列表前面没有星号? nrm current get nothing
3 participants