mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
Generate app variations with fake list
This commit is contained in:
parent
85254fe0f4
commit
2cca34a689
4 changed files with 119 additions and 40 deletions
|
|
@ -55,7 +55,7 @@ class BuildLists {
|
||||||
name: 'app',
|
name: 'app',
|
||||||
path: '/static/app-list.json',
|
path: '/static/app-list.json',
|
||||||
buildMethod: async () => (await Promise.all([
|
buildMethod: async () => (await Promise.all([
|
||||||
buildFakeList({ totalApps: !isProduction ? 500 : 0 }),
|
!isProduction && buildFakeList(),
|
||||||
buildAppList()
|
buildAppList()
|
||||||
])).flat(1)
|
])).flat(1)
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Source 1: https://42matters.com/docs/app-market-data/ios/apps/appstore-genres
|
// Source 1: https://42matters.com/docs/app-market-data/ios/apps/appstore-genres
|
||||||
export default {
|
const genresByID = {
|
||||||
'0': ['Mobile Software Application'],
|
'0': ['Mobile Software Application'],
|
||||||
'6018': ['Book'],
|
'6018': ['Book'],
|
||||||
'6000': ['Business'],
|
'6000': ['Business'],
|
||||||
|
|
@ -75,3 +75,9 @@ export default {
|
||||||
'13029': ['Newsstand', 'Travel & Regional'],
|
'13029': ['Newsstand', 'Travel & Regional'],
|
||||||
'13030': ['Newsstand', 'Women\'s Interest'],
|
'13030': ['Newsstand', 'Women\'s Interest'],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const allGenres = Array.from( new Set( Object.values(genresByID).map( genreId => genreId.flat(1) ) ))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export default genresByID
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@
|
||||||
import { v4 as uuid } from 'uuid'
|
import { v4 as uuid } from 'uuid'
|
||||||
|
|
||||||
// import statuses, { getStatusName } from './statuses'
|
// import statuses, { getStatusName } from './statuses'
|
||||||
// import appStoreGenres from './app-store/genres.js'
|
import { allGenres } from './app-store/genres.js'
|
||||||
// import { findCategoryForTagsSet } from './categories.js'
|
import { categories, appCategories } from './categories.js'
|
||||||
import parseDate from './parse-date.js'
|
import parseDate from './parse-date.js'
|
||||||
// import { eitherMatches } from './matching.js'
|
// import { eitherMatches } from './matching.js'
|
||||||
import { getAppEndpoint } from './app-derived'
|
import { getAppEndpoint } from './app-derived'
|
||||||
|
|
@ -11,54 +11,115 @@ import { makeSlug } from './slug.js'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export const statusMessages = [
|
||||||
|
'✅ Yes, Full Native Apple Silicon Support',
|
||||||
|
'✳️ Yes, works via Translation or Virtualization',
|
||||||
|
'⏹ No, not working at all but support is in development',
|
||||||
|
'🚫 No, not yet supported only works on Intel-based Macs',
|
||||||
|
'🔶 App has not yet been reported to be native to Apple Silicon',
|
||||||
|
'🔶 Unknown, more info needed',
|
||||||
|
]
|
||||||
|
|
||||||
|
function makeAppVariation ( variationOptions ) {
|
||||||
|
const [
|
||||||
|
// Statuses
|
||||||
|
statusMessage,
|
||||||
|
|
||||||
|
// Category Slugs
|
||||||
|
categorySlug,
|
||||||
|
|
||||||
|
// Tags
|
||||||
|
tagOne,
|
||||||
|
] = variationOptions
|
||||||
|
|
||||||
|
const fakeAppId = uuid()
|
||||||
|
|
||||||
|
const name = `Fake App ${fakeAppId}`
|
||||||
|
const slug = makeSlug( name )
|
||||||
|
|
||||||
|
const category = {
|
||||||
|
label: 'Developer Tools',
|
||||||
|
slug: 'developer-tools'
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
name,
|
||||||
|
aliases: [],
|
||||||
|
status: '',
|
||||||
|
bundleId: '',
|
||||||
|
lastUpdated: parseDate( '2021-02-07T03:20:42.086Z' ),
|
||||||
|
// url,
|
||||||
|
text: statusMessage,
|
||||||
|
slug,
|
||||||
|
endpoint: getAppEndpoint({
|
||||||
|
category: {
|
||||||
|
slug: null
|
||||||
|
},
|
||||||
|
slug: slug
|
||||||
|
}),
|
||||||
|
category: categories[categorySlug],
|
||||||
|
tags: [
|
||||||
|
tagOne,
|
||||||
|
'fake'
|
||||||
|
],
|
||||||
|
// content: token.content,
|
||||||
|
relatedLinks: [
|
||||||
|
{
|
||||||
|
label: 'Website',
|
||||||
|
href: 'https://doesitarm.com/apple-silicon-app-test/',
|
||||||
|
}
|
||||||
|
],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export default async function ( options = {} ) {
|
export default async function ( options = {} ) {
|
||||||
|
|
||||||
const {
|
const {
|
||||||
totalApps = 100
|
totalApps = 100
|
||||||
} = options
|
} = options
|
||||||
|
|
||||||
|
|
||||||
|
const appOptions = [
|
||||||
|
// Statuses
|
||||||
|
statusMessages,
|
||||||
|
|
||||||
|
// Category Slugs
|
||||||
|
Object.keys( appCategories ),
|
||||||
|
|
||||||
|
// Tags
|
||||||
|
[
|
||||||
|
'',
|
||||||
|
// ...allGenres
|
||||||
|
]
|
||||||
|
]
|
||||||
|
|
||||||
|
let appVariations = appOptions[0].map(function(item) { return [item]; });
|
||||||
|
|
||||||
|
// https://stackoverflow.com/a/35004005/1397641
|
||||||
|
for (var k = 1; k < appOptions.length; k++) {
|
||||||
|
var next = [];
|
||||||
|
appVariations.forEach(function(item) {
|
||||||
|
appOptions[k].forEach(function(word) {
|
||||||
|
const line = item.slice(0)
|
||||||
|
line.push(word)
|
||||||
|
next.push(line)
|
||||||
|
})
|
||||||
|
});
|
||||||
|
appVariations = next
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('Total variations', appVariations.length)
|
||||||
|
|
||||||
const appList = []
|
const appList = []
|
||||||
|
|
||||||
|
|
||||||
for (let i=0; i<totalApps; i++) {
|
for ( const variationOptions of appVariations ) {
|
||||||
|
|
||||||
const fakeAppId = uuid()
|
const appVariant = makeAppVariation( variationOptions )
|
||||||
|
|
||||||
const name = `Fake App ${fakeAppId}`
|
console.log('appVariant', appVariant)
|
||||||
const slug = makeSlug( name )
|
|
||||||
|
|
||||||
const category = {
|
appList.push( appVariant )
|
||||||
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/',
|
|
||||||
}
|
|
||||||
],
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -185,6 +185,18 @@ export const categories = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const nonAppCategorySlugs = [
|
||||||
|
'games',
|
||||||
|
'homebrew',
|
||||||
|
'no-category'
|
||||||
|
]
|
||||||
|
|
||||||
|
export const appCategories = Object.fromEntries(
|
||||||
|
Object.entries(categories).filter( ([ slug ]) => {
|
||||||
|
return !nonAppCategorySlugs.includes( slug )
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
export const categoriesById = Object.fromEntries( Object.entries( categories ).map( ([ key, category ]) => [category.id, { ...category, key } ] ) )
|
export const categoriesById = Object.fromEntries( Object.entries( categories ).map( ([ key, category ]) => [category.id, { ...category, key } ] ) )
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue