mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
Add Fake apps for non-production builds
This commit is contained in:
parent
d1a30c9aa2
commit
17746f7d8d
2 changed files with 74 additions and 1 deletions
|
|
@ -1,12 +1,15 @@
|
||||||
import { promises as fs } from 'fs'
|
import { promises as fs } from 'fs'
|
||||||
import dotenv from 'dotenv'
|
import dotenv from 'dotenv'
|
||||||
|
|
||||||
|
import buildFakeList from './helpers/build-fake-app-list.js'
|
||||||
import buildAppList from './helpers/build-app-list.js'
|
import buildAppList from './helpers/build-app-list.js'
|
||||||
import buildGamesList from './helpers/build-game-list.js'
|
import buildGamesList from './helpers/build-game-list.js'
|
||||||
import buildHomebrewList from './helpers/build-homebrew-list.js'
|
import buildHomebrewList from './helpers/build-homebrew-list.js'
|
||||||
import buildVideoList from './helpers/build-video-list.js'
|
import buildVideoList from './helpers/build-video-list.js'
|
||||||
import buildDeviceList from './helpers/build-device-list.js'
|
import buildDeviceList from './helpers/build-device-list.js'
|
||||||
|
|
||||||
|
|
||||||
|
import { isProduction } from './helpers/environment.js'
|
||||||
import { videosRelatedToApp } from './helpers/related.js'
|
import { videosRelatedToApp } from './helpers/related.js'
|
||||||
import { buildVideoPayload, buildAppBenchmarkPayload } from './helpers/build-payload.js'
|
import { buildVideoPayload, buildAppBenchmarkPayload } from './helpers/build-payload.js'
|
||||||
|
|
||||||
|
|
@ -51,7 +54,10 @@ class BuildLists {
|
||||||
{
|
{
|
||||||
name: 'app',
|
name: 'app',
|
||||||
path: '/static/app-list.json',
|
path: '/static/app-list.json',
|
||||||
buildMethod: buildAppList,
|
buildMethod: async () => (await Promise.all([
|
||||||
|
buildFakeList({ totalApps: !isProduction ? 500 : 0 }),
|
||||||
|
buildAppList()
|
||||||
|
])).flat(1)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'game',
|
name: 'game',
|
||||||
|
|
|
||||||
67
helpers/build-fake-app-list.js
Normal file
67
helpers/build-fake-app-list.js
Normal file
|
|
@ -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<totalApps; i++) {
|
||||||
|
|
||||||
|
const fakeAppId = uuid()
|
||||||
|
|
||||||
|
const name = `Fake App ${fakeAppId}`
|
||||||
|
const slug = makeSlug( name )
|
||||||
|
|
||||||
|
const category = {
|
||||||
|
label: 'Developer Tools',
|
||||||
|
slug: 'developer-tools'
|
||||||
|
}
|
||||||
|
|
||||||
|
appList.push({
|
||||||
|
name,
|
||||||
|
aliases: [],
|
||||||
|
status: '',
|
||||||
|
bundleId: '',
|
||||||
|
lastUpdated: parseDate( '2021-02-07T03:20:42.086Z' ),
|
||||||
|
// url,
|
||||||
|
text: '🔶 App has not yet been reported to be native to Apple Silicon',
|
||||||
|
slug,
|
||||||
|
endpoint: getAppEndpoint({
|
||||||
|
category: {
|
||||||
|
slug: null
|
||||||
|
},
|
||||||
|
slug: slug
|
||||||
|
}),
|
||||||
|
category,
|
||||||
|
tags: [
|
||||||
|
'fake'
|
||||||
|
],
|
||||||
|
// content: token.content,
|
||||||
|
relatedLinks: [
|
||||||
|
{
|
||||||
|
label: 'Website',
|
||||||
|
href: 'https://doesitarm.com/apple-silicon-app-test/',
|
||||||
|
}
|
||||||
|
],
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return appList
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue