From 4023490f43eaa504f809b03b041ffe32acc28ae3 Mon Sep 17 00:00:00 2001 From: Zbynek Konecny Date: Sat, 9 Apr 2022 10:32:10 +0200 Subject: [PATCH] Use ID as fallback for developer name --- plugins/gatsby-source-jenkinsplugins/utils.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/gatsby-source-jenkinsplugins/utils.js b/plugins/gatsby-source-jenkinsplugins/utils.js index 1e23743dd..60e42386b 100644 --- a/plugins/gatsby-source-jenkinsplugins/utils.js +++ b/plugins/gatsby-source-jenkinsplugins/utils.js @@ -123,7 +123,7 @@ const processPlugin = ({createNode, names, stats, updateData, detachedPlugins, c names.push(pluginName); const developers = plugin.developers || []; const labels = plugin.labels || []; - developers.forEach(maint => {maint.id = maint.developerId, delete (maint.developerId);}); + developers.forEach(convertDeveloper); plugin.scm = fixGitHubUrl(plugin.scm, plugin.defaultBranch || 'master'); const pluginStats = stats[pluginName] || {installations: null}; pluginStats.trend = computeTrend(plugin, stats, updateData.plugins); @@ -271,6 +271,13 @@ const fixGitHubUrl = (url, defaultBranch) => { return url; }; +const convertDeveloper = (maint) => { + maint.id = maint.developerId; + // graceful degradation: if names are lost, use ID + maint.name = maint.name || maint.id.replace('_', ' '); + delete (maint.developerId); +}; + const computeTrend = (plugin, stats, plugins) => { if (!stats[plugin.name]) { return 0;