5151import { useMessage } from " naive-ui" ;
5252import { nameToEmoji } from ' gemoji'
5353import useUtools from " ../composables/useUtools" ;
54+ import { rawEmojis , typeData } from " ../data" ;
5455const message = useMessage ();
5556const utools = useUtools ()
56-
57-
5857const { ctrl_alt } = useMagicKeys ();
59-
6058whenever (ctrl_alt , () => {
6159 handleCopy ()
6260})
63-
6461const handleCopy = async () => {
6562 if (! subject .value ) {
6663 message .error (" 必填项必填" );
@@ -75,71 +72,14 @@ const handleCopy = async () => {
7572// https://github.com/conventional-changelog/commitlint/blob/master/%40commitlint/config-conventional/index.js
7673// TODO 后期引入默认emoji
7774// TODO 后期引入国际化
78- const typeOptions = ref ([
79- {
80- value: " feat" ,
81- label: " 新功能(feat)" ,
82- emoji: " ✨" ,
83- },
84- {
85- value: " fix" ,
86- label: " 修复bug(fix)" ,
87- emoji: " 🐛" ,
88- },
89- {
90- value: " docs" ,
91- label: " 文档变更(docs)" ,
92- emoji: " 📝" ,
93- },
94- {
95- value: " style" ,
96- label: " 无关代码的格式(style)" ,
97- emoji: " 🎨" ,
98- },
99- {
100- value: " refactor" ,
101- label: " 重构(refactor)" ,
102- emoji: " ♻️" ,
103- },
104- {
105- value: " perf" ,
106- label: " 优化性能(perf)" ,
107- emoji: " ⚡️" ,
108- },
109- {
110- value: " test" ,
111- label: " 增加或更新测试(test)" ,
112- emoji: " ✅" ,
113- },
114-
115- {
116- value: " build" ,
117- label: " 构建系统或外部依赖更改(build)" ,
118- emoji: " 🛠️" ,
119- },
120- {
121- value: " ci" ,
122- label: " CI配置或脚本变动(ci)" ,
123- emoji: " 👷" ,
124- },
125- {
126- value: " chore" ,
127- label: " 不影响代码的其余变动(chore)" ,
128- emoji: " 🔧" ,
129- },
130- {
131- value: " revert" ,
132- label: " 回退之前版本(revert)" ,
133- emoji: " ⏪" ,
134- },
135-
136- ]);
75+ const typeOptions = ref (typeData );
76+ // 默认emoji
77+ const defatltEmoji = ref (" ✨" );
13778// 类型
13879const type = ref (" feat" );
139-
14080watch (type , (val ) => {
14181 // console.log(val)
142- emoji .value = typeOptions .value .find ((item ) => item .value === val )?.emoji ?? ' ✨ '
82+ emoji .value = typeOptions .value .find ((item ) => item .value === val )?.emoji ?? defatltEmoji
14383})
14484// 范围
14585const scope = ref (" " );
@@ -152,74 +92,7 @@ const body = ref("");
15292// 最后
15393const footer = ref (" " );
15494
155- const rawEmojis = [
156- { " name" : " art" , " description" : " 结构改进 / 格式化代码" },
157- { " name" : " zap" , " description" : " 性能改善" },
158- { " name" : " fire" , " description" : " 删除代码或者文件" },
159- { " name" : " bug" , " description" : " 修了一个 BUG" },
160- { " name" : " ambulance" , " description" : " 重大热修复" },
161- { " name" : " sparkles" , " description" : " 引入新的特性" },
162- { " name" : " pencil" , " description" : " 写文档" },
163- { " name" : " rocket" , " description" : " 部署相关" },
164- { " name" : " lipstick" , " description" : " 更新界面与样式文件" },
165- { " name" : " tada" , " description" : " 创世提交" },
166- { " name" : " white_check_mark" , " description" : " 更新测试" },
167- { " name" : " lock" , " description" : " 修复安全问题" },
168- { " name" : " apple" , " description" : " 修复在苹果系统上的问题" },
169- { " name" : " penguin" , " description" : " 修复在 Linux 系统上的问题" },
170- { " name" : " checkered_flag" , " description" : " 修复在 Windows 系统上的问题" },
171- { " name" : " robot" , " description" : " 修复在安卓系统上的问题" },
172- { " name" : " green_apple" , " description" : " 修复在 iOS 系统上的问题" },
173- { " name" : " bookmark" , " description" : " 发布 / 版本标签" },
174- { " name" : " rotating_light" , " description" : " 消除 linter 警告" },
175- { " name" : " construction" , " description" : " 进行中" },
176- { " name" : " green_heart" , " description" : " 修复持续集成构建" },
177- { " name" : " arrow_down" , " description" : " 降级依赖" },
178- { " name" : " arrow_up" , " description" : " 升级依赖" },
179- { " name" : " pushpin" , " description" : " 固定依赖在特定的版本" },
180- { " name" : " construction_worker" , " description" : " 添加持续集成构建系统" },
181- { " name" : " chart_with_upwards_trend" , " description" : " 添加分析或者跟踪代码" },
182- { " name" : " recycle" , " description" : " 代码重构" },
183- { " name" : " whale" , " description" : " Docker 容器相关" },
184- { " name" : " heavy_plus_sign" , " description" : " 添加依赖" },
185- { " name" : " heavy_minus_sign" , " description" : " 删除依赖" },
186- { " name" : " wrench" , " description" : " 改变配置文件" },
187- { " name" : " globe_with_meridians" , " description" : " 国际化与本地化" },
188- { " name" : " pencil2" , " description" : " 修正拼写错误" },
189- { " name" : " poop" , " description" : " 写需要改进的坏代码" },
190- { " name" : " rewind" , " description" : " 回滚改动" },
191- { " name" : " twisted_rightwards_arrows" , " description" : " 合并分支" },
192- { " name" : " package" , " description" : " 更新编译后的文件或者包" },
193- { " name" : " alien" , " description" : " 由于外部 API 变动而更新代码" },
194- { " name" : " truck" , " description" : " 文件移动或者重命名" },
195- { " name" : " page_facing_up" , " description" : " 添加或者更新许可" },
196- { " name" : " boom" , " description" : " 引入破坏性的改动" },
197- { " name" : " bento" , " description" : " 添加或者更新静态资源" },
198- { " name" : " ok_hand" , " description" : " 代码审核后更新代码" },
199- { " name" : " wheelchair" , " description" : " 改进可访问性" },
200- { " name" : " bulb" , " description" : " 给源代码加文档" },
201- { " name" : " beers" , " description" : " 醉写代码" },
202- { " name" : " speech_balloon" , " description" : " 更新文本和字面" },
203- { " name" : " card_file_box" , " description" : " 执行数据库相关的改动" },
204- { " name" : " loud_sound" , " description" : " 添加日志" },
205- { " name" : " mute" , " description" : " 删除日志" },
206- { " name" : " busts_in_silhouette" , " description" : " 添加贡献者(们)" },
207- { " name" : " children_crossing" , " description" : " 改进用户体验 / 可用性" },
208- { " name" : " building_construction" , " description" : " 架构改动" },
209- { " name" : " iphone" , " description" : " 响应性设计相关" },
210- { " name" : " clown_face" , " description" : " 模拟相关" },
211- { " name" : " egg" , " description" : " 添加一个彩蛋" },
212- { " name" : " see_no_evil" , " description" : " 添加或者更新 .gitignore 文件" },
213- { " name" : " camera_flash" , " description" : " 添加或者更新快照" },
214- { " name" : " alembic" , " description" : " 研究新事物" },
215- { " name" : " hammer_and_wrench" , " description" : " 构建系统更改" },
216- { " name" : " wrench" , " description" : " 不影响代码的其余变动" },
217- { " name" : " mag" , " description" : " 改进搜索引擎优化" },
218- { " name" : " wheel_of_dharma" , " description" : " Kubernetes 相关的工作" },
219- { " name" : " label" , " description" : " 添加或者更新类型(Flow, TypeScript)" },
220- ]
221-
222- const emoji = ref (' ✨' )
95+ const emoji = ref (defatltEmoji )
22396
22497const emojiOptions = computed (() => {
22598 return rawEmojis .map ((item ) => {
0 commit comments