docs: Relative Issues & Component Update Logs Connected to Each Component#3027
docs: Relative Issues & Component Update Logs Connected to Each Component#3027xiaoyatong merged 28 commits intojdf2e:feat_v3.xfrom
Conversation
This comment was marked as off-topic.
This comment was marked as off-topic.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## feat_v3.x #3027 +/- ##
==========================================
Coverage 86.10% 86.10%
==========================================
Files 277 277
Lines 18406 18408 +2
Branches 2807 2807
==========================================
+ Hits 15849 15851 +2
Misses 2552 2552
Partials 5 5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
oasis-cloud
left a comment
There was a problem hiding this comment.
文档上的处理逻辑太重,我认为 issue 和 log 只给筛选链接就行。我们实际要给用户的是 FAQ (提供对用户最常提出的问题及其答案的汇总),最主要关注的是高频问题,而不是组件和 Issue 标题的相关性。
xiaoyatong
left a comment
There was a problem hiding this comment.
issue部分当做一个 块结构,类似 demo 的 codeblock 的方式,进行处理。
避免被动拉取数据和主动拉取数据的混淆,给维护带来太多成本。
scripts/generate-contribution.mjs
Outdated
| REPO_URL: 'https://github.com/jdf2e/nutui-react/', | ||
| HEADERS: { | ||
| Accept: 'application/vnd.github.v3+json', | ||
| Authorization: `Bearer ${TOKEN}`, |
There was a problem hiding this comment.
https://github.com/settings/tokens. 在这里生成Generate new token(classic)复制进去
There was a problem hiding this comment.
这个json的修改时机,可以管控一下,比如每周发版时拉取新数据?
There was a problem hiding this comment.
理论上应该这样,只不过现在运行这个脚本需要一个个人token。在仓库的commit中不允许提交token,依赖本地运行。得看看还能不能通过其他方式注入
src/sites/sites-react/doc/components/contribution/contribution.json
Outdated
Show resolved
Hide resolved
xiaoyatong
left a comment
There was a problem hiding this comment.
1、使用文档补充一下
2、不需要区分issues和提交记录
3、没有内容的就不用展示整个节点了
描述
对所有组件文档的四个语言版本,自动生成Issues列表和组件更新日志模块及url。
关键实现
如何获取到最新的issues和版本日志,和无token访问Github API的频率限制
通过GitHub API和Authorization PAT可以打开速率限制,将获取、处理、更新等逻辑都在脚本中实现,本地通过脚本一键更新所有文档。
如何判断issues / update logs与组件等关联性呢
在实现过程中,直接通过title.includes(comName) 或者路由params拼接搜索的方式 实际匹配结果关联率低,如
'fix(dialog): 关闭按钮默认在底部,24px白色图标 (#2118) @irisSong', 应匹配dialog,但因包含“按钮”,依然会匹配到button组件
'feat(calendar): support renderBottomButton props (#2645) ', 同上,包含renderBottom
Button'希望Dialog组件内置的确认以及取消按钮对异步自带loading或者可以手动设置loading #1202', 同上,包含按钮
希望Dialog组件内置的确认以及取消按钮对异步自带loading或者可以手动设置loading #1202', 到底是Dialog还是loading?简单的字符串包含关系不能满足需求。
解决方法
实现analyzeTitleRelevance 函数通过组件库提交信息的特点,进行了赋分算法用于计算每个组件与标题信息的相关分数。如feat(xxx),括号中的组件内容为作者意图,+100分。完整包含组件英文/中文,+20分。字母拼写错误但部分包含字符串,如Uploade,+3分。等一系列规则。匹配出分数最高且等分的组件数组,对该数组范围的组件进行关联。