import { omit } from 'lodash' ; import { files , category } from '../util/category' ; import { directories } from '../util/directories' ; import { get } from '../util/get' ; import { write } from '../util/write' ; const recipes = category ( 'Recipes' , directories . sanitized ) ; for ( const file of files ( 'Items' , directories . sanitized ) ) { const items = get ( file ) ; for ( const item of items ) { item . recipe = null ; if ( item . sourceSheet === 'Message Cards' ) { continue ; } const id = ( item . variations ? item . variations [ 0 ] : item ) . internalId ; let recipe = recipes . find ( ( recipe ) => recipe . craftedItemInternalId === id ) ?? null ; recipe = recipe ? omit ( recipe , [ 'translations' ] ) : null ; item . recipe = recipe ; } write ( file , items ) ; }