diff --git a/build-lists.js b/build-lists.js index 096fc2d..fbed236 100644 --- a/build-lists.js +++ b/build-lists.js @@ -1,12 +1,15 @@ import { promises as fs } from 'fs' import dotenv from 'dotenv' +import buildFakeList from './helpers/build-fake-app-list.js' import buildAppList from './helpers/build-app-list.js' import buildGamesList from './helpers/build-game-list.js' import buildHomebrewList from './helpers/build-homebrew-list.js' import buildVideoList from './helpers/build-video-list.js' import buildDeviceList from './helpers/build-device-list.js' + +import { isProduction } from './helpers/environment.js' import { videosRelatedToApp } from './helpers/related.js' import { buildVideoPayload, buildAppBenchmarkPayload } from './helpers/build-payload.js' @@ -51,7 +54,10 @@ class BuildLists { { name: 'app', path: '/static/app-list.json', - buildMethod: buildAppList, + buildMethod: async () => (await Promise.all([ + buildFakeList({ totalApps: !isProduction ? 500 : 0 }), + buildAppList() + ])).flat(1) }, { name: 'game', diff --git a/helpers/build-fake-app-list.js b/helpers/build-fake-app-list.js new file mode 100644 index 0000000..c8dea50 --- /dev/null +++ b/helpers/build-fake-app-list.js @@ -0,0 +1,67 @@ + +import { v4 as uuid } from 'uuid' + +// import statuses, { getStatusName } from './statuses' +// import appStoreGenres from './app-store/genres.js' +// import { findCategoryForTagsSet } from './categories.js' +import parseDate from './parse-date.js' +// import { eitherMatches } from './matching.js' +import { getAppEndpoint } from './app-derived' +import { makeSlug } from './slug.js' + + + +export default async function ( options = {} ) { + + const { + totalApps = 100 + } = options + + const appList = [] + + + for (let i=0; i