Add new plugin stars (#36)

This commit is contained in:
Simon Lecoq
2021-01-02 23:41:36 +01:00
committed by GitHub
parent a010a333a1
commit 11cb6f042e
12 changed files with 281 additions and 4 deletions

View File

@@ -139,6 +139,7 @@
topics:{enabled:input.bool("plugin_topics")},
projects:{enabled:input.bool("plugin_projects")},
tweets:{enabled:input.bool("plugin_tweets")},
stars:{enabled:input.bool("plugin_stars")},
}
let q = Object.fromEntries(Object.entries(plugins).filter(([key, plugin]) => plugin.enabled).map(([key]) => [key, true]))
info("Plugins enabled", Object.entries(plugins).filter(([key, plugin]) => plugin.enabled).map(([key]) => key))
@@ -208,6 +209,11 @@
for (const option of ["limit"])
info(`Tweets ${option}`, q[`tweets.${option}`] = input.number(`plugin_tweets_${option}`))
}
//Stars
if (plugins.posts.enabled) {
for (const option of ["limit"])
info(`Stars ${option}`, q[`stars.${option}`] = input.number(`plugin_stars_${option}`))
}
//Repositories to use
const repositories = input.number("repositories")

View File

@@ -259,6 +259,43 @@
}
})
}
//Starred repositories query
if (/^query Starred /.test(query)) {
console.debug(`metrics/compute/mocks > mocking graphql api result > Starred`)
return ({
user:{
starredRepositories:{
edges:[
{
starredAt:"2020-10-16T18:53:16Z",
node:{
description:"📊 An image generator with 20+ metrics about your GitHub account such as activity, community, repositories, coding habits, website performances, music played, starred topics, etc. that you can put on your profile or elsewhere !",
forkCount:12,
isFork:false,
issues:{
totalCount: 12
},
nameWithOwner:"lowlighter/metrics",
openGraphImageUrl:"https://repository-images.githubusercontent.com/293860197/7fd72080-496d-11eb-8fe0-238b38a0746a",
pullRequests:{
totalCount:23
},
stargazerCount:120,
licenseInfo:{
nickname:null,
name:"MIT License"
},
primaryLanguage:{
color:"#f1e05a",
name:"JavaScript"
}
}
},
]
}
}
})
}
//Unmocked call
return target(...args)
}

View File

@@ -45,6 +45,7 @@
topics:"Starred topics",
projects:"Projects",
tweets:"Latest tweets",
stars:"Recently starred repositories",
"base.header":"Header",
"base.activity":"Account activity",
"base.community":"Community stats",
@@ -71,6 +72,7 @@
"topics.sort":"stars",
"topics.limit":12,
"tweets.limit":2,
"stars.limit":4,
},
},
templates:{