Fix missing game benchmark pages

This commit is contained in:
Sam Carlton 2021-03-02 21:37:07 -06:00
parent 7c696573e7
commit 361505e6cd

View file

@ -9,7 +9,7 @@ import buildVideoList from './helpers/build-video-list.js'
import { buildVideoPayload, buildAppBenchmarkPayload } from './helpers/build-payload.js' import { buildVideoPayload, buildAppBenchmarkPayload } from './helpers/build-payload.js'
import { categories, getAppCategory } from './helpers/categories.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' import { makeSearchableList } from './helpers/searchable-list.js'
// Setup dotenv // Setup dotenv
@ -154,7 +154,7 @@ class BuildLists {
console.log('Build Lists started') console.log('Build Lists started')
for (const listOptions of this.listsOptions) { for ( const listOptions of this.listsOptions ) {
const methodName = `Building ${listOptions.name}` const methodName = `Building ${listOptions.name}`
console.time(methodName) console.time(methodName)
@ -162,9 +162,7 @@ class BuildLists {
const builtList = await listOptions.buildMethod() const builtList = await listOptions.buildMethod()
// Run the build method to get the lists // Run the build method to get the lists
this.lists[listOptions.name] = new Set([ this.lists[listOptions.name] = new Set( builtList )
...builtList
])
console.timeEnd(methodName) console.timeEnd(methodName)
console.log(`Finished ${listOptions.name} list with ${this.lists[listOptions.name].size} items`) console.log(`Finished ${listOptions.name} list with ${this.lists[listOptions.name].size} items`)
@ -223,10 +221,9 @@ class BuildLists {
this.lists[listKey].forEach( app => { this.lists[listKey].forEach( app => {
const isVideo = (app.category === undefined) const isVideo = (app.category === undefined)
const isApp = (app.endpoint.includes('/app/')) const appType = getAppType( app )
const isGame = (app.category === 'games')
if (isVideo) { if ( isVideo ) {
// this.endpointSets.eleventy.add({ // this.endpointSets.eleventy.add({
// route: getVideoEndpoint(app), // route: getVideoEndpoint(app),
// // payload: buildVideoPayload( app, this.allVideoAppsList, this.lists.video ) // // payload: buildVideoPayload( app, this.allVideoAppsList, this.lists.video )
@ -240,18 +237,22 @@ class BuildLists {
return return
} }
// if ( isGame ) { console.log() }
// Add benchmark endpoints for apps and games // Add benchmark endpoints for apps and games
if ( isApp || isGame ) { if ( appType === 'app' || appType === 'game' ) {
this.endpointSets.nuxt.add({ this.endpointSets.nuxt.add({
route: `${getAppEndpoint(app)}/benchmarks`, route: `${getAppEndpoint(app)}/benchmarks`,
payload: buildAppBenchmarkPayload( app, this.allVideoAppsList, this.lists.video ) payload: buildAppBenchmarkPayload( app, this.allVideoAppsList, this.lists.video )
}) })
} }
// Add app or game endpoint
this.endpointSets.nuxt.add({ this.endpointSets.nuxt.add({
route: getAppEndpoint(app), route: getAppEndpoint(app),
payload: { app } payload: { app }
}) })
// console.log('Added to nuxt endpoints', getAppEndpoint(app))
return return
}) })