Fetch the repository succeeded.
const fs = require('fs');
const componentName = ['button', 'icon', 'layout', 'pagination', 'tabs', 'steps', 'breadcrumb', 'menu', 'checkbox', 'select', 'switch', 'radio', 'search', 'cascader', 'filtrate', 'inputNumber', 'input', 'slider', 'transfer', 'upload', 'timePicker', 'badge', 'collapse', 'tooltips', 'tag', 'timeline', 'table', 'progress', 'spin', 'alert', 'drawer', 'message', 'modal', 'notification', 'popconfirm']
const logs = () => {
let logPath = ['./dataFeat.json', './dataFix.json', './dataOther.json']
for (let p of logPath) {
if (p.includes("Feat")) {
extractFs(p, '_feat')
}
if (p.includes('Fix')) {
extractFs(p, '_fix')
}
if (p.includes('Other')) {
extractFs(p, '_other')
}
// if (p.includes('Null')) {
// extractFs(p, '_null')
// }
}
}
const extractFs = (p, mode) => {
fs.readFile(p, 'utf-8', (err, data) => {
if (!err) {
let objs = {
[mode]: []
};
const lines = data.split(/\r?\n/);
lines.forEach((line) => {
if (line) {
let temp = JSON.parse(line);
let type = temp.type
let header = temp.header
let hash = temp.hash.substring(0, 7)
let jira = temp.issue ? temp.issue : "";
let commitData = temp.committerDate
//匹配描述中的组件名
let arr=findComponent(header);
let obj = {
'type': type,
'header': header,
'hash': hash,
'jira': jira,
'commitData': commitData,
name:arr
}
objs[mode].push(obj)
}
});
const ws = fs.createWriteStream(`./${mode}.json`, { flags: 'w' })
ws.write(JSON.stringify(objs, null, "\t"))
ws.close();
console.log(mode + ' 生成成功!!')
} else {
console.log(mode + " 生成失败")
}
})
}
const findComponent=(str)=>{
let arr=[];
for(let name of componentName){
let pattern=name;
if(name[name.length-1]==='s'){
pattern=name.substring(0,name.length-1)
}
let re=new RegExp(pattern,'i')
//
if(re.test(str)){
// console.log('ok',name)
arr.push(name)
}
}
return arr;
}
logs()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。