Skip to content

Commit 9b7c7bc

Browse files
authored
Correction of data for 2022 and 2023 (#66)
1 parent 0819ccc commit 9b7c7bc

File tree

29 files changed

+1171
-984
lines changed

29 files changed

+1171
-984
lines changed

DEVELOP.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
- sync_xlab.js 从 xlab 接口 根据年份来同步 `rankingList.json` 中的最新排行信息,同步完成后需要 使用 update_year_user 来重新获取 github 用户信息。
66
- update_year_user.js 根据年份来更新 `rankingList.json` 里面的用户的 github 信息,注意需要配置 github token 否则会被 github api 限制拉取频率导致更新失败, 然后修改 main 函数里面的需要更新的年份的信息即可。
77
- update_all_user.js 更新整个 `rankingList.json` 中所有用户信息, 同样需要配置 github token 否则会被 github api 限制拉取频率导致更新失败。
8-
- front-matter.js, 在使用上面的脚本更新完用户信息后,使用此脚本来讲信息同步到 `source` 目录下对应的文件下的 `index.md` 的 front-matter 中 (--- front-matter ---)
8+
- front-matter.js 在使用上面的脚本更新完用户信息后,使用此脚本来讲信息同步到 `source` 目录下对应的文件下的 `index.md` 的 front-matter 中 (--- front-matter ---)
99

10-
`rankingList.json` 文件下数据更新前的机构
10+
`rankingList.json` 文件下数据更新前的结构
1111

1212
```json
1313
[
@@ -29,6 +29,7 @@
2929
```
3030

3131
脚本更新后的数据结构
32+
3233
```json
3334
[
3435
{
@@ -59,7 +60,9 @@
5960
### 往年榜单
6061

6162
所有往年榜单都在 `source/opensource-ranking` 目录下,每个文件都是一个年度榜单,文件名为 `2022.md` 这样的格式, 只需要修改里面的年份即可。
63+
6264
例如
65+
6366
```md
6467
---
6568
title: 榜单详情 2022
@@ -69,4 +72,4 @@ data_year: 2022
6972

7073
```
7174

72-
首页只会展示最新一年的榜单数据。
75+
首页只会展示最新一年的榜单数据。

script/front-matter.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
/***
1+
/**
22
* Author: shuashuai
33
* @description 批量将 rankingList.json 中的 github 用户信息更新到对应的 index.md 的 front-matter 中,同时对于不存在的用户,会自动创建对应目录,生成默认 index.md 文件。
4-
*
54
*/
65

76
const fs = require('fs').promises;
@@ -90,6 +89,5 @@ async function main(year) {
9089
}
9190
}
9291

93-
9492
// 执行主程序
95-
main(2024);
93+
main(2024);

script/sync_xlab.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
/***
1+
/**
22
* Author: shuashuai
33
* @description 按照年份从 xlab 接口获取数据,更新到 rankingList.json 中, 该操作会覆盖重置现有数据,之后需要执行 update_year_user.js 去github 拉取用户信息, 最后使用 front-matter.js 更新用户详情。
4-
*
54
*/
65

76
const fs = require('fs').promises;
@@ -15,7 +14,7 @@ async function fetchXlab(year) {
1514
const { data: res } = data;
1615
console.log(res.length);
1716
if (res.length > 0) {
18-
// 现根据 rank 排名在截取前99 为
17+
// 根据 rank 排名截取前 99 位
1918
const res100 = res.sort((a, b) => a.rank - b.rank).slice(0, 99);
2019
return res100.map(v => ({
2120
ranking: v.rank,
@@ -52,7 +51,7 @@ async function main(year) {
5251

5352
const yearIndex = rankingData.findIndex(v => v.year === year);
5453
// 获取当前时间戳
55-
const update = `${new Date().getFul8Year()}${new Date().getMonth() + 1} 月`;
54+
const update = `${new Date().getFullYear()}${new Date().getMonth() + 1} 月`;
5655
const ranking = {
5756
year,
5857
update: update,
@@ -72,4 +71,4 @@ async function main(year) {
7271
await writeRankingData(rankingData);
7372
}
7473

75-
main(2024);
74+
main(2024);

script/update_all_user.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
/***
1+
/**
22
* Author: shuashuai
33
* @description 根据 rankingList.json de login 字段来从 github 批量获取 github 用户信息,更推荐使用 update_year_user.js 脚本,按照年份更新用户信息
44
* @param GITHUB_TOKEN github token,不配置会被 github api 限制,无法大量获取没使用前请先去配置
55
* @param TIME_DELAY 防止速度过快被 github 限制,间隔 多少 ms 请求一次信息
6-
*
76
*/
87

98
const fs = require('fs').promises;
@@ -106,4 +105,4 @@ async function main() {
106105
}
107106
}
108107

109-
main();
108+
main();

script/update_year_user.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
/***
1+
/**
22
* Author: shuashuai
33
* @description 按照输入的年份, 根据 rankingList.json 的 login 字段来从 github 批量获取 github 用户信息
44
* @param GITHUB_TOKEN github token,不配置会被 github api 限制,无法大量获取没使用前请先去配置
55
* @param TIME_DELAY 防止速度过快被 github 限制,间隔 多少 ms 请求一次信息
6-
*
76
*/
87

98
const fs = require('fs').promises;
@@ -115,5 +114,4 @@ async function main(year) {
115114
}
116115
}
117116

118-
119-
main(2024);
117+
main(2024);

source/ClarkXia/index.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
slug: ClarkXia
3+
name: null
4+
description: "hangzhou"
5+
github_id: 4219965
6+
github_avatar: https://avatars.githubusercontent.com/u/4219965?v=4
7+
---
8+

source/LuciferYang/index.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
slug: LuciferYang
3+
name: YangJie
4+
description: "Beijing"
5+
github_id: 1475305
6+
github_avatar: https://avatars.githubusercontent.com/u/1475305?v=4
7+
---
8+

source/MistEO/index.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
slug: MistEO
3+
name: MistEO
4+
description: "HangZhou, China"
5+
github_id: 18511905
6+
github_avatar: https://avatars.githubusercontent.com/u/18511905?v=4
7+
---
8+

source/XVilka/index.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
slug: XVilka
3+
name: Anton Kochkov
4+
description: "China, Shanghai"
5+
github_id: 203261
6+
github_avatar: https://avatars.githubusercontent.com/u/203261?v=4
7+
---
8+

0 commit comments

Comments
 (0)