mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-15 06:35:20 -07:00
Make bundleId array
This commit is contained in:
parent
9e7e24c681
commit
eefd19004e
1 changed files with 33 additions and 10 deletions
|
|
@ -1,9 +1,11 @@
|
||||||
|
|
||||||
import { promises as fs } from 'fs'
|
// import { promises as fs } from 'fs'
|
||||||
|
|
||||||
|
import fs from 'fs-extra'
|
||||||
import MarkdownIt from 'markdown-it'
|
import MarkdownIt from 'markdown-it'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
|
||||||
import statuses, { getStatusName } from './statuses'
|
import statuses, { getStatusName } from './statuses.js'
|
||||||
import appStoreGenres from './app-store/genres.js'
|
import appStoreGenres from './app-store/genres.js'
|
||||||
import { findCategoryForTagsSet } from './categories.js'
|
import { findCategoryForTagsSet } from './categories.js'
|
||||||
import parseDate from './parse-date'
|
import parseDate from './parse-date'
|
||||||
|
|
@ -150,6 +152,27 @@ export default async function () {
|
||||||
// Store app scans
|
// Store app scans
|
||||||
await axios
|
await axios
|
||||||
.get(process.env.SCANS_SOURCE)
|
.get(process.env.SCANS_SOURCE)
|
||||||
|
|
||||||
|
.then( async response => {
|
||||||
|
const appBundles = []
|
||||||
|
|
||||||
|
for (const appScan of response.data.appList) {
|
||||||
|
|
||||||
|
// Add app to bundle list
|
||||||
|
appBundles.push([
|
||||||
|
// bundleId as key
|
||||||
|
appScan.bundleIdentifier,
|
||||||
|
|
||||||
|
// Versions as value
|
||||||
|
appScan.versions
|
||||||
|
])
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
await fs.writeJson('./static/app-bundles.json', appBundles)
|
||||||
|
|
||||||
|
return response
|
||||||
|
})
|
||||||
.then(function (response) {
|
.then(function (response) {
|
||||||
|
|
||||||
response.data.appList.forEach( appScan => {
|
response.data.appList.forEach( appScan => {
|
||||||
|
|
@ -206,7 +229,7 @@ export default async function () {
|
||||||
scanListMap.set( appSlug, {
|
scanListMap.set( appSlug, {
|
||||||
name: appName,
|
name: appName,
|
||||||
aliases: appScan['aliases'],
|
aliases: appScan['aliases'],
|
||||||
bundleId: appScan.bundleIdentifier,
|
bundleIds: [ appScan.bundleIdentifier ],
|
||||||
status: statusName,
|
status: statusName,
|
||||||
lastUpdated: parseDate( appScan['Date'] ),
|
lastUpdated: parseDate( appScan['Date'] ),
|
||||||
// url,
|
// url,
|
||||||
|
|
@ -281,7 +304,7 @@ export default async function () {
|
||||||
|
|
||||||
const [ name, url ] = link.substring(1, link.length-1).split('](')
|
const [ name, url ] = link.substring(1, link.length-1).split('](')
|
||||||
|
|
||||||
let bundleId = null
|
const bundleIds = []
|
||||||
let tags = []
|
let tags = []
|
||||||
let aliases = []
|
let aliases = []
|
||||||
const relatedLinksMap = new Map( getTokenLinks(token.children).map( link => [ link.href, link ] ) )
|
const relatedLinksMap = new Map( getTokenLinks(token.children).map( link => [ link.href, link ] ) )
|
||||||
|
|
@ -293,9 +316,9 @@ export default async function () {
|
||||||
// console.log( key, alias, name, eitherMatches(alias, name) )
|
// console.log( key, alias, name, eitherMatches(alias, name) )
|
||||||
|
|
||||||
if ( eitherMatches(alias, name) ) {
|
if ( eitherMatches(alias, name) ) {
|
||||||
// If we don't have a bundleId yet
|
// If we don't have any bundleIds yet
|
||||||
// Set this app's bundleId
|
// Add this app's bundleId to the list
|
||||||
if ( bundleId === null ) { bundleId = scannedApp.bundleId }
|
if ( !bundleIds.includes( scannedApp.bundleIds[0] ) ) { bundleIds.push(scannedApp.bundleIds[0]) }
|
||||||
|
|
||||||
// Merge this scanned app's tags into the matching app
|
// Merge this scanned app's tags into the matching app
|
||||||
tags = Array.from(new Set([
|
tags = Array.from(new Set([
|
||||||
|
|
@ -318,7 +341,7 @@ export default async function () {
|
||||||
} )
|
} )
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`Merged ${alias} (${scannedApp.bundleId}) from scanned apps into ${name} from README`)
|
console.log(`Merged ${alias} (${scannedApp.bundleIds[0]}) from scanned apps into ${name} from README`)
|
||||||
scanListMap.delete( key )
|
scanListMap.delete( key )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -365,7 +388,7 @@ export default async function () {
|
||||||
name,
|
name,
|
||||||
aliases,
|
aliases,
|
||||||
status,
|
status,
|
||||||
bundleId,
|
bundleIds,
|
||||||
lastUpdated,
|
lastUpdated,
|
||||||
// url,
|
// url,
|
||||||
text,
|
text,
|
||||||
|
|
@ -379,7 +402,7 @@ export default async function () {
|
||||||
|
|
||||||
|
|
||||||
// if ( tags.length > 1 ) {
|
// if ( tags.length > 1 ) {
|
||||||
// console.log('tags', name, bundleId, tags)
|
// console.log('tags', name, bundleIds, tags)
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue