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

Feat: add recommend icon to registry #55

Merged
merged 5 commits into from
Aug 3, 2021

Conversation

luhc228
Copy link
Collaborator

@luhc228 luhc228 commented Jul 26, 2021

Closed: #51

方案

  • npm 镜像源:外网显示,内网不显示,原因是内网用户大部分养成用 tnpm 的习惯,不需要来回切换镜像源
  • 安装/升级/重装依赖时,内网用户默认用内网源,外网用户使用 npm config 的源

预览图:
内网环境:
image
外网环境:
image

@luhc228 luhc228 changed the base branch from main to release-next July 26, 2021 10:54
@luhc228 luhc228 self-assigned this Jul 26, 2021
@luhc228 luhc228 requested a review from fyangstudio July 26, 2021 10:54
main/data/data.json Outdated Show resolved Hide resolved
});
if (recommendedNpmRegistryIndex > -1) {
npmRegistries[recommendedNpmRegistryIndex].recommended = true;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个逻辑感觉写复杂了:

npmRegistries.forEach(item => {
  item.recommended = isAliInternal ? item.registry === ALI_NPM_REGISTRY : item.registry === TAOBAO_NPM_REGISTRY;
});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

另外安装依赖的地方是不是要强制提示下?比如如果要安装 @ali/xxx 的包,但是 registry 不是 ali 源,这时候直接强制替换掉(只是这次安装替换)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个逻辑感觉写复杂了:

npmRegistries.forEach(item => {
  item.recommended = isAliInternal ? item.registry === ALI_NPM_REGISTRY : item.registry === TAOBAO_NPM_REGISTRY;
});

fixed

@luhc228 luhc228 requested a review from imsobear July 28, 2021 09:25
@luhc228 luhc228 mentioned this pull request Aug 3, 2021
6 tasks
@luhc228 luhc228 merged commit 23aa183 into release-next Aug 3, 2021
@luhc228 luhc228 deleted the feat/add-recommend-icon-to-registry branch August 3, 2021 05:21
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.

镜像源地址增加推荐的标签
3 participants