Fixed barrels and input
This commit is contained in:
@@ -1,15 +1,22 @@
|
||||
import { EnrichedEntity, Entity } from '../types'
|
||||
import details from '../../res/details.json'
|
||||
import manual from '../../res/manual.json'
|
||||
import exclude from '../../res/exclude.json'
|
||||
|
||||
const joined = [...details, ...manual] as Entity[]
|
||||
const manualEntities = manual as Entity[]
|
||||
const manualKeys = new Set(manualEntities.map(entity => entity.href))
|
||||
const detailEntities = (details as Entity[]).filter(detail => !manualKeys.has(detail.href))
|
||||
|
||||
const factories = joined.map((detail: EnrichedEntity) => {
|
||||
detail.usedBy = joined.filter(f =>
|
||||
Object.keys(f.recipe?.prerequisites ?? {}).includes(detail.href)
|
||||
)
|
||||
return detail
|
||||
})
|
||||
const joined = [...detailEntities, ...manualEntities]
|
||||
|
||||
const factories = joined
|
||||
.map((detail: EnrichedEntity) => {
|
||||
detail.usedBy = joined.filter(f =>
|
||||
Object.keys(f.recipe?.prerequisites ?? {}).includes(detail.href)
|
||||
)
|
||||
return detail
|
||||
})
|
||||
.filter(detail => !(exclude as string[]).includes(detail.href))
|
||||
|
||||
const detailsMap = Object.fromEntries(
|
||||
factories.map((detail: EnrichedEntity) => [detail.href, detail])
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
export interface Recipe {
|
||||
prerequisites: Dict<number>
|
||||
prerequisites: Dict<number | undefined>
|
||||
time: number
|
||||
output: Dict<number>
|
||||
output: Dict<number | undefined>
|
||||
}
|
||||
|
||||
export interface UnfetchedEntity {
|
||||
|
||||
Reference in New Issue
Block a user