diff --git a/scripts/updateData.js b/scripts/updateData.js index f08906c..24f82b6 100644 --- a/scripts/updateData.js +++ b/scripts/updateData.js @@ -82,25 +82,15 @@ const pullSponsors = async (collective, {type = 'organizations'} = {}) => { const {data} = await getWithRetry(`https://opencollective.com/${collective}/members/${type}.json`); return data.map(({lastTransactionAt, ...entry}) => { - const {profile, website} = entry; + const {profile} = entry; const login = new URL(profile).pathname.split('/').pop(); - console.log(`Sponsor: ${login}`); - - const targetLink = website || entry.twitter || entry.github || entry.profile; - - const parsed = parseURL(targetLink); - - const alt = parsed && parsed.origin; + console.log(`Open Collective member: ${login}`); return { ...entry, - alt, - login, - displayName: entry.name || login, - targetLink, - utmLink: parsed && makeUTMURL(targetLink) + login } }); } @@ -208,12 +198,9 @@ const processSponsors = async (sponsorsData, sponsorsConfig = './data/sponsors.j // merge Open Collective sponsors sponsorsData.forEach(sponsor => { if (sponsor.role !== 'BACKER' && sponsor.role && sponsor.totalAmountDonated <= 0) { - console.log(`Ignore sponsor [${sponsor.displayName}]`); return; } - console.log(`Process sponsor [${sponsor.displayName}]`); - computedSponsors[sponsor.login] = {...sponsor}; }); @@ -227,6 +214,10 @@ const processSponsors = async (sponsorsData, sponsorsConfig = './data/sponsors.j await Promise.all(Object.values(computedSponsors).map(async (sponsor) => { let {login, icon, website, displayName, description, links} = sponsor; + sponsor.displayName = displayName = displayName || sponsor.name || login; + + console.log(`Process sponsor [${displayName}]`); + const iconHTML = icon ? `` : ''; let tooltip = `

${iconHTML}${displayName} (${sponsor.totalAmountDonated}$${sponsor.tier && sponsor.isActive ? ' ' + sponsor.tier + '' : ''})

`; @@ -266,6 +257,12 @@ const processSponsors = async (sponsorsData, sponsorsConfig = './data/sponsors.j tooltip += `
${icons}
` sponsor.tooltip = tooltip; + + sponsor.targetLink = website || sponsor.twitter || sponsor.github || sponsor.profile; + + const parsed = parseURL(sponsor.targetLink); + + sponsor.utmLink = !sponsor.utmLink && parsed && makeUTMURL(sponsor.targetLink); })); const sortedSponsors = {};