Skip to content

Commit ce3d8b3

Browse files
committed
fix a bug in autoGen
1 parent 4abbf2a commit ce3d8b3

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242

4343
## 文章
4444

45+
1. [中不中奖,都是抽奖程序的锅?](/articles/20191216_liuguanyu_中不中奖,都是抽奖程序的锅?.md)(20191216 [@liuguanyu](https://github.com/liuguanyu))
4546
1. [『 Vue 小 Case 』- Vue Prop 中的 null vs undefined](/articles/20191128_verymuch_『_Vue_小_Case_』-_Vue_Prop_中的_null_vs_undefined.md)(20191128 [@verymuch](https://github.com/verymuch))
4647
1. [iOS 13 新增了哪些无障碍功能?](/articles/20191118_anjia_iOS_13_新增了哪些无障碍功能?.md)(20191118 [@anjia](https://github.com/anjia))
4748
1. [把你的NodeJS程序给没有NodeJS的人运行](/articles/20191113_liuguanyu_把你的NodeJS程序给没有NodeJS的人运行.md)(20191113 [@liuguanyu](https://github.com/liuguanyu))
@@ -65,7 +66,7 @@
6566
1. [ES2019新特性你知道哪些](/articles/20190826_betseyliu_ES2019新特性你知道哪些.md)(20190826 [@betseyliu](https://github.com/betseyliu))
6667
1. [css blend mode](/articles/20190819_verymuch_css_blend_mode.md)(20190819 [@verymuch](https://github.com/verymuch))
6768
1. [【译】移动App的可访问性陷阱和测试方法](/articles/20190815_anjia_【译】移动App的可访问性陷阱和测试方法.md)(20190815 [@anjia](https://github.com/anjia))
68-
1. [源自babel的多包管理工具:Lerna](/articles/20190812_anjia_源自babel的多包管理工具:Lerna.md)(20190812 [@anjia](https://github.com/anjia))
69+
1. [源自babel的多包管理工具:Lerna](/articles/20190812_liuguanyu_源自babel的多包管理工具:Lerna.md)(20190812 [@liuguanyu](https://github.com/liuguanyu))
6970
1. [捕获FMP的原理](/articles/20190807_berwin_捕获FMP的原理.md)(20190807 [@berwin](https://github.com/Berwin))
7071
1. [setTimeout小尴尬的启示](/articles/20190805_cncuckoo_setTimeout小尴尬的启示.md)(20190805 [@cncuckoo](https://github.com/cncuckoo))
7172
1. [CORS为什么要区分『简单请求』和『预检请求』?](/articles/20190801_hax_CORS为什么要区分『简单请求』和『预检请求』?.md)(20190801 [@hax](https://github.com/hax))
@@ -184,4 +185,4 @@
184185
>
185186
> 谢谢合作!
186187
187-
188+

autoGen.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,17 @@ function getArticlesInfo(dir) {
9898

9999
files.forEach(file => {
100100
const execReg = /^(\d{8})[-_]([^_]+)[-_](.+)(?:.md)$/;
101-
let [fileName, date, writer, articleName] = execReg.exec(file);
102-
fileName = rename(articlesDir, fileName);
103-
articlesInfo.push({
104-
fileName,
105-
date,
106-
articleName: articleName.replace(/_/g, ' '),
107-
writer: writer.toLowerCase(),
108-
});
101+
const info = execReg.exec(file);
102+
if (info !== null){
103+
let [fileName, date, writer, articleName] = execReg.exec(file);
104+
fileName = rename(articlesDir, fileName);
105+
articlesInfo.push({
106+
fileName,
107+
date,
108+
articleName: articleName.replace(/_/g, ' '),
109+
writer: writer.toLowerCase(),
110+
});
111+
}
109112
})
110113

111114
return articlesInfo.sort((a, b) => b.date - a.date);
@@ -181,4 +184,4 @@ ${copyright}
181184
fs.writeFile('./README.md', spliceInfo(), function(err){
182185
if(err) throw err;
183186
console.log('更新成功');
184-
})
187+
})

0 commit comments

Comments
 (0)