@@ -4,7 +4,7 @@ import util from "util"
44import * as utils from "./utils.mjs"
55
66//Setup
7- export default async function metrics ( { login, q} , { graphql, rest, plugins, conf, die = false , verify = false , convert = null } , { Plugins, Templates} ) {
7+ export default async function metrics ( { login, q} , { graphql, rest, plugins, conf, die = false , verify = false , convert = null , callbacks = null } , { Plugins, Templates} ) {
88 //Compute rendering
99 try {
1010 //Debug
@@ -59,8 +59,8 @@ export default async function metrics({login, q}, {graphql, rest, plugins, conf,
5959
6060 //Executing base plugin and compute metrics
6161 console . debug ( `metrics/compute/${ login } > compute` )
62- await Plugins . base ( { login, q, data, rest, graphql, plugins, queries, pending, imports} , conf )
63- await computer ( { login, q} , { conf, data, rest, graphql, plugins, queries, account : data . account , convert, template} , { pending, imports} )
62+ await Plugins . base ( { login, q, data, rest, graphql, plugins, queries, pending, imports, callbacks } , conf )
63+ await computer ( { login, q} , { conf, data, rest, graphql, plugins, queries, account : data . account , convert, template, callbacks } , { pending, imports} )
6464 const promised = await Promise . all ( pending )
6565
6666 //Check plugins errors
@@ -211,39 +211,53 @@ export default async function metrics({login, q}, {graphql, rest, plugins, conf,
211211}
212212
213213//Metrics insights
214- metrics . insights = async function ( { login} , { graphql, rest, conf} , { Plugins, Templates} ) {
215- const q = {
216- template : "classic" ,
217- achievements : true ,
218- "achievements.threshold" : "X" ,
219- isocalendar : true ,
220- "isocalendar.duration" : "full-year" ,
221- languages : true ,
222- "languages.limit" : 0 ,
223- activity : true ,
224- "activity.limit" : 100 ,
225- "activity.days" : 0 ,
226- notable : true ,
227- followup : true ,
228- "followup.sections" : "repositories, user" ,
229- habits : true ,
230- "habits.from" : 100 ,
231- "habits.days" : 7 ,
232- "habits.facts" : false ,
233- "habits.charts" : true ,
234- introduction : true ,
235- }
236- const plugins = {
237- achievements : { enabled : true } ,
238- isocalendar : { enabled : true } ,
239- languages : { enabled : true , extras : false } ,
240- activity : { enabled : true , markdown : "extended" } ,
241- notable : { enabled : true } ,
242- followup : { enabled : true } ,
243- habits : { enabled : true , extras : false } ,
244- introduction : { enabled : true } ,
245- }
246- return metrics ( { login, q} , { graphql, rest, plugins, conf, convert : "json" } , { Plugins, Templates} )
214+ metrics . insights = async function ( { login} , { graphql, rest, conf, callbacks} , { Plugins, Templates} ) {
215+ return metrics ( { login, q :metrics . insights . q } , { graphql, rest, plugins :metrics . insights . plugins , conf, callbacks, convert : "json" } , { Plugins, Templates} )
216+ }
217+ metrics . insights . q = {
218+ template : "classic" ,
219+ achievements : true ,
220+ "achievements.threshold" : "X" ,
221+ isocalendar : true ,
222+ "isocalendar.duration" : "full-year" ,
223+ languages : true ,
224+ "languages.limit" : 0 ,
225+ activity : true ,
226+ "activity.limit" : 100 ,
227+ "activity.days" : 0 ,
228+ "activity.timestamps" : true ,
229+ notable : true ,
230+ "notable.repositories" : true ,
231+ followup : true ,
232+ "followup.sections" : "repositories, user" ,
233+ introduction : true ,
234+ topics : true ,
235+ "topics.mode" : "icons" ,
236+ "topics.limit" : 0 ,
237+ stars : true ,
238+ "stars.limit" : 6 ,
239+ reactions : true ,
240+ "reactions.details" : "percentage" ,
241+ repositories : true ,
242+ "repositories.pinned" : 6 ,
243+ sponsors : true ,
244+ calendar : true ,
245+ "calendar.limit" : 0 ,
246+ }
247+ metrics . insights . plugins = {
248+ achievements : { enabled : true } ,
249+ isocalendar : { enabled : true } ,
250+ languages : { enabled : true , extras : false } ,
251+ activity : { enabled : true , markdown : "extended" } ,
252+ notable : { enabled : true } ,
253+ followup : { enabled : true } ,
254+ introduction : { enabled : true } ,
255+ topics : { enabled : true } ,
256+ stars : { enabled : true } ,
257+ reactions : { enabled : true } ,
258+ repositories : { enabled : true } ,
259+ sponsors : { enabled : true } ,
260+ calendar : { enabled : true } ,
247261}
248262
249263//Metrics insights static render
@@ -278,5 +292,5 @@ metrics.insights.output = async function({login, imports, conf}, {graphql, rest,
278292 </body>
279293 </html>`
280294 await browser . close ( )
281- return { mime : "text/html" , rendered}
295+ return { mime : "text/html" , rendered, errors : json . errors }
282296}
0 commit comments