diff --git a/helpers/build-app-list.js b/helpers/build-app-list.js index 645001c..d793a47 100644 --- a/helpers/build-app-list.js +++ b/helpers/build-app-list.js @@ -284,6 +284,7 @@ export default async function () { let bundleId = null let tags = [] let aliases = [] + const relatedLinksMap = new Map( getTokenLinks(token.children).map( link => [ link.href, link ] ) ) // Search for this app in the scanList and remove duplicates scanListMap.forEach( ( scannedApp, key ) => { @@ -308,13 +309,26 @@ export default async function () { ...scannedApp.aliases ])) + // Merge relatated links + for ( const link of scannedApp.relatedLinks ) { + + relatedLinksMap.set( link.href, { + ...link, + label: (link.label === 'View') ? 'App Website' : link.label + } ) + } + console.log(`Merged ${alias} (${scannedApp.bundleId}) from scanned apps into ${name} from README`) scanListMap.delete( key ) } } }) - const relatedLinks = getTokenLinks(token.children) + + // Convert link map values into array for JSON + const relatedLinks = Array.from( relatedLinksMap.values() ) + + // console.log('relatedLinks', relatedLinks) const appSlug = makeSlug( name )