From 8fcddd72ac636cf9489d761f40c47ca64d828014 Mon Sep 17 00:00:00 2001 From: Sam Carlton Date: Wed, 25 May 2022 13:24:16 -0500 Subject: [PATCH] Generate kind index with app names --- build-lists.js | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/build-lists.js b/build-lists.js index 441af39..95b6282 100644 --- a/build-lists.js +++ b/build-lists.js @@ -18,7 +18,10 @@ import getListSummaryNumbers from '~/helpers/get-list-summary-numbers.js' import { videosRelatedToApp } from '~/helpers/related.js' import { buildVideoPayload, buildAppBenchmarkPayload } from '~/helpers/build-payload.js' -import { categories, getAppCategory } from '~/helpers/categories.js' +import { + categories, + makeSummaryOfListings +} from '~/helpers/categories.js' import { getAppType, getAppEndpoint, @@ -374,7 +377,7 @@ class BuildLists { }).flat() } - saveKinds = async function () { + async saveKinds () { const kindLists = this.makeKindLists() @@ -402,6 +405,21 @@ class BuildLists { console.log( '\n\n' ) } + const kindIndex = categories + + // Delete no-category + delete kindIndex['no-category'] + + // Store sample names into kindIndex as description + for ( const categorySlug in kindIndex ) { + kindIndex[categorySlug].description = kindLists[categorySlug].summary.sampleNames + } + + console.log( 'kindIndex', kindIndex ) + + // Save the index + await this.saveToJson( kindIndex, `${ apiDirectory }/kind/index.json` ) + } saveApiEndpoints = async ( listOptions ) => {