mirror of
https://github.com/oceanprotocol/community-numbers.git
synced 2025-01-10 21:22:59 +01:00
tinkering
This commit is contained in:
parent
e4b5f3b552
commit
477912857d
@ -23,7 +23,8 @@ Endpoint: [`https://oceanprotocol-community.now.sh`](https://oceanprotocol-commu
|
|||||||
{
|
{
|
||||||
"github": {
|
"github": {
|
||||||
"stars": 1000,
|
"stars": 1000,
|
||||||
"repos": 1000
|
"repos": 1000,
|
||||||
|
"contributors": 1000
|
||||||
},
|
},
|
||||||
"medium": {
|
"medium": {
|
||||||
"followers": 1000
|
"followers": 1000
|
||||||
|
@ -24,16 +24,31 @@ export default async function fetchGitHubRepos() {
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
const json = await response.json()
|
const jsonRepos = await response.json()
|
||||||
const numbers = json.map((item) => item.stargazers_count)
|
|
||||||
const stars = arrSum(numbers)
|
const starsArray = []
|
||||||
const repositories = json.length
|
const contribArray = []
|
||||||
|
|
||||||
|
jsonRepos.forEach(async (item) => {
|
||||||
|
starsArray.push(item.stargazers_count)
|
||||||
|
|
||||||
|
const responseContrib = await fetch(
|
||||||
|
`https://api.github.com/orgs/oceanprotocol/${item.name}/stats/contributors`,
|
||||||
|
options
|
||||||
|
)
|
||||||
|
const jsonContrib = await responseContrib.json()
|
||||||
|
contribArray.push(jsonContrib.total)
|
||||||
|
})
|
||||||
|
|
||||||
|
const stars = arrSum(starsArray)
|
||||||
|
const repositories = jsonRepos.length
|
||||||
|
const contributors = arrSum(contribArray)
|
||||||
|
|
||||||
log(
|
log(
|
||||||
'✓ GitHub. ' +
|
'✓ GitHub. ' +
|
||||||
`Total: ${repositories} public projects with a total of ${stars} stargazers. ` +
|
`Total: ${repositories} public projects with a total of ${stars} stargazers & ${contributors} contributors. ` +
|
||||||
`Elapsed: ${new Date() - start}ms`
|
`Elapsed: ${new Date() - start}ms`
|
||||||
)
|
)
|
||||||
|
|
||||||
return { stars, repositories }
|
return { stars, repositories, contributors }
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user