-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathindex.js
52 lines (47 loc) · 1.68 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/* eslint-disable no-undef */
const fetch = require("node-fetch");
const fs = require("fs");
getContributors();
getOpenCollective();
function getContributors() {
const writeStream = fs.createWriteStream(".redomdoc/contributors.js");
fetch("https://api.github.com/repos/redom/redom/contributors")
.then(res => res.json())
.then(json => {
let content = "module.exports = [";
json.forEach(data => {
const { html_url, avatar_url, login } = data;
content += `{
html_url: "${html_url}",
avatar_url: "${avatar_url}",
login: "${login}",
},`;
});
content += "]";
writeStream.write(content);
writeStream.end();
});
}
function getOpenCollective() {
const writeStream = fs.createWriteStream(".redomdoc/backers.js");
fetch("https://opencollective.com/redom/members/all.json")
.then(res => res.json())
.then(json => {
let content = "module.exports = [";
json.forEach(data => {
const { name, image, website, role, profile } = data;
if (role === "BACKER") {
content += `{
name: "${name}",
image: "${image}",
website: "${website}",
profile: "${profile}",
role: "${role}",
},`;
}
});
content += "]";
writeStream.write(content);
writeStream.end();
});
}