From 361505e6cd5bee025487bc50231f091f19f4e2b0 Mon Sep 17 00:00:00 2001 From: Sam Carlton Date: Tue, 2 Mar 2021 21:37:07 -0600 Subject: [PATCH] Fix missing game benchmark pages --- build-lists.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/build-lists.js b/build-lists.js index 8c77825..2b64a4a 100644 --- a/build-lists.js +++ b/build-lists.js @@ -9,7 +9,7 @@ import buildVideoList from './helpers/build-video-list.js' import { buildVideoPayload, buildAppBenchmarkPayload } from './helpers/build-payload.js' import { categories, getAppCategory } from './helpers/categories.js' -import { getAppEndpoint, getVideoEndpoint } from './helpers/app-derived.js' +import { getAppType, getAppEndpoint, getVideoEndpoint } from './helpers/app-derived.js' import { makeSearchableList } from './helpers/searchable-list.js' // Setup dotenv @@ -154,7 +154,7 @@ class BuildLists { console.log('Build Lists started') - for (const listOptions of this.listsOptions) { + for ( const listOptions of this.listsOptions ) { const methodName = `Building ${listOptions.name}` console.time(methodName) @@ -162,9 +162,7 @@ class BuildLists { const builtList = await listOptions.buildMethod() // Run the build method to get the lists - this.lists[listOptions.name] = new Set([ - ...builtList - ]) + this.lists[listOptions.name] = new Set( builtList ) console.timeEnd(methodName) console.log(`Finished ${listOptions.name} list with ${this.lists[listOptions.name].size} items`) @@ -223,10 +221,9 @@ class BuildLists { this.lists[listKey].forEach( app => { const isVideo = (app.category === undefined) - const isApp = (app.endpoint.includes('/app/')) - const isGame = (app.category === 'games') + const appType = getAppType( app ) - if (isVideo) { + if ( isVideo ) { // this.endpointSets.eleventy.add({ // route: getVideoEndpoint(app), // // payload: buildVideoPayload( app, this.allVideoAppsList, this.lists.video ) @@ -240,18 +237,22 @@ class BuildLists { return } + // if ( isGame ) { console.log() } + // Add benchmark endpoints for apps and games - if ( isApp || isGame ) { + if ( appType === 'app' || appType === 'game' ) { this.endpointSets.nuxt.add({ route: `${getAppEndpoint(app)}/benchmarks`, payload: buildAppBenchmarkPayload( app, this.allVideoAppsList, this.lists.video ) }) } + // Add app or game endpoint this.endpointSets.nuxt.add({ route: getAppEndpoint(app), payload: { app } }) + // console.log('Added to nuxt endpoints', getAppEndpoint(app)) return })