From 7b795d724529eeb220fc28d82ee6028906376bc8 Mon Sep 17 00:00:00 2001 From: Sam Carlton Date: Thu, 9 Jun 2022 18:15:13 -0500 Subject: [PATCH] Apple saveMethod to api saves --- build-lists.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/build-lists.js b/build-lists.js index f77a667..a4af78c 100644 --- a/build-lists.js +++ b/build-lists.js @@ -168,8 +168,7 @@ class BuildLists { const typeWithRelatedVideos = new Set([ 'app', - 'formula', - // 'video' + 'formula' ]) 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 await fs.ensureDir( endpointDirectory ) // Write the endpoint to JSON - await this.saveToJson( listEntry, endpointPath ) + await this.saveToJson( saveableEntry, endpointPath ) }) if ( errors.length !== 0 ) {