From 5b84fe98d973f0d1454c628ae7019e56d5c4ba8d Mon Sep 17 00:00:00 2001 From: Sam Carlton Date: Tue, 25 May 2021 09:12:13 -0500 Subject: [PATCH 1/3] Add test to default build task --- .vscode/tasks.json | 8 ++++++++ package.json | 1 + 2 files changed, 9 insertions(+) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index bc55e51..4b133ff 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -15,6 +15,14 @@ "problemMatcher": [], "label": "npm: generate", "detail": "nuxt generate", + "group": "build" + }, + { + "type": "npm", + "script": "generate-dev", + "problemMatcher": [], + "label": "npm: generate-dev", + "detail": "npm run generate && npm test", "group": { "kind": "build", "isDefault": true diff --git a/package.json b/package.json index 72cdc3c..7685381 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "dev": "nuxt", "build": "nuxt build", "start": "nuxt start", + "generate-dev": "npm run generate && npm test", "generate": "npm run clone-readme && npm run build-lists && npm run generate-nuxt && npm run generate-eleventy", "build-lists": "node -r esm build-lists.js", "generate-nuxt": "NODE_OPTIONS=--max-old-space-size=60000 nuxt generate", From 33c7623bfd230656d02461426ef13b31ddcff2f4 Mon Sep 17 00:00:00 2001 From: Sam Carlton Date: Tue, 25 May 2021 09:12:44 -0500 Subject: [PATCH 2/3] Merge aliases into README app listings --- helpers/build-app-list.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/helpers/build-app-list.js b/helpers/build-app-list.js index 6962396..645001c 100644 --- a/helpers/build-app-list.js +++ b/helpers/build-app-list.js @@ -283,6 +283,7 @@ export default async function () { let bundleId = null let tags = [] + let aliases = [] // Search for this app in the scanList and remove duplicates scanListMap.forEach( ( scannedApp, key ) => { @@ -301,6 +302,12 @@ export default async function () { ...scannedApp.tags ])) + // Merge as set then convert to array to prevent duplicates + aliases = Array.from(new Set([ + ...aliases, + ...scannedApp.aliases + ])) + console.log(`Merged ${alias} (${scannedApp.bundleId}) from scanned apps into ${name} from README`) scanListMap.delete( key ) } @@ -342,6 +349,7 @@ export default async function () { appList.push({ name, + aliases, status, bundleId, lastUpdated, From 86ed9f50c852019340f20f330e92c681219127d0 Mon Sep 17 00:00:00 2001 From: Sam Carlton Date: Tue, 25 May 2021 09:34:04 -0500 Subject: [PATCH 3/3] Merge related links --- helpers/build-app-list.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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 )