Apple saveMethod to api saves

This commit is contained in:
Sam Carlton 2022-06-09 18:15:13 -05:00
parent dc27e091d2
commit 7b795d7245

View file

@ -168,8 +168,7 @@ class BuildLists {
const typeWithRelatedVideos = new Set([ const typeWithRelatedVideos = new Set([
'app', 'app',
'formula', 'formula'
// 'video'
]) ])
return typeWithRelatedVideos.has( appType ) return typeWithRelatedVideos.has( appType )
@ -503,11 +502,16 @@ class BuildLists {
}) })
} }
const hasSaveMethod = listOptions.hasOwnProperty('beforeSave')
const saveMethod = hasSaveMethod ? listOptions.beforeSave : listSet => Array.from( listSet )
const [ saveableEntry ] = saveMethod( new Set( [ listEntry ] ) )
// Ensure the directory exists // Ensure the directory exists
await fs.ensureDir( endpointDirectory ) await fs.ensureDir( endpointDirectory )
// Write the endpoint to JSON // Write the endpoint to JSON
await this.saveToJson( listEntry, endpointPath ) await this.saveToJson( saveableEntry, endpointPath )
}) })
if ( errors.length !== 0 ) { if ( errors.length !== 0 ) {