-
Notifications
You must be signed in to change notification settings - Fork 103
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: support icons:generate #761
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #761 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 646 646
Lines 17671 17671
Branches 1099 1099
=========================================
Hits 17671 17671 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
从刷下来的结果看一共会遇到以下几个问题: 一、需要调整svg的filename
二、svg 和 组件不是完全对应的驼峰以及Kebab关系的情况
三、币名没有简写导致的问题,其实里面有时候会出现有的简写有的复杂了的问题
我的计划是三个pr,第一个完成这个脚本的完善优化,第二个去做以上的重命名,第三个纯粹的去更新icon。 期待你们的评价和建议~ |
如果只是文件名改了,其实还好,就是看起来有点奇怪🤪 这些都是有品牌规范的,such like |
@Likang0122 其实我是想TokenPocket 转 kebab-case 为token-pocket,原文件名 tokenpocket-colorful.svg,看起来也不是驼峰也不是 kebab-case ,感觉挺奇怪的,但是最后还要听取大家意见,也可以选择跳过这几个文件保持原有的。 |
趁着这次定一下就好,看怎么处理合适,而且这个 |
改名这个我觉得不用改的,其实就是用小写的品牌名就可以,不用特地按照单词分割。比如 metamask 不会有人叫 meta mask 的。 |
1inch 这个主要是因为变量名没法以数字开头,所以特殊处理了。 |
感觉 |
那我就先不改其他的文件名了,针对可能会出问题的名字就用一个对象去跳过好了,保留原文件名,再看看 @Likang0122 |
|
||
<%= svgIdentifier %>.displayName = '<%= svgIdentifier %>'; | ||
|
||
`.trim(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里 trim
后会不会导致生成的 tsx 缺少文末换行符
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
从执行脚本的结果看好像没影响,并且pre-commit的格式化应该不会导致产生影响规范的事情发生。
[中文版模板 / Chinese template]
💡 Background and solution
参考@Wxh16144 大佬 pr(ant-design/ant-design-icons#635), 实现了icon-preview(通过jsdoc, 鼠标放在组件上可以看到icon的样式),因为打包方式、产物以及命名上有一些不同,所以在代码上略有改造。
这个同步脚本应该后续也用得上,略加改造同步 svg 可以提高后续添加 svg 的效率直接拖入图片就可以转成组件代码,降低cv和命名心智,
目前部分目录会有点问题,佬们看看是需要重命名呢,还是跳过这些文件,还是完善正则去兼容。