From 921a25e758c0750237b5e6d3fba056cfbdb8742c Mon Sep 17 00:00:00 2001 From: Sam Carlton Date: Sun, 27 Feb 2022 15:04:59 -0600 Subject: [PATCH] Exclude large lists from api build --- build-lists.js | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/build-lists.js b/build-lists.js index 1409dd3..3e47c3e 100644 --- a/build-lists.js +++ b/build-lists.js @@ -249,7 +249,9 @@ class BuildLists { const listOptions = this.listsOptions[listOptionsKey] - await this.saveList( listOptions ) + if ( !withApi ) { + await this.saveList( listOptions ) + } const searchableList = makeSearchableList( this.lists[listOptions.name] ) @@ -383,15 +385,17 @@ class BuildLists { // ['/app/chrome', this.endpointMaps.eleventy.get( '/app/chrome' )] // ]) - for ( const [ endpointSetName, endpointSet ] of Object.entries(this.endpointMaps) ) { - // Save Endpoints - await this.saveToJson(Array.from( endpointSet , ([route, payload]) => ({ route, payload })), `./static/${endpointSetName}-endpoints.json`) - } + if ( !withApi ) { + for ( const [ endpointSetName, endpointSet ] of Object.entries(this.endpointMaps) ) { + // Save Endpoints + await this.saveToJson(Array.from( endpointSet , ([route, payload]) => ({ route, payload })), `./static/${endpointSetName}-endpoints.json`) + } - // Save sitemap endpoints - await this.saveToJson(Object.values(this.endpointMaps).map( endpointSet => { - return Array.from( endpointSet , ([route, payload]) => ({ route, payload }) ) - } ).flat(1), './static/sitemap-endpoints.json') + // Save sitemap endpoints + await this.saveToJson(Object.values(this.endpointMaps).map( endpointSet => { + return Array.from( endpointSet , ([route, payload]) => ({ route, payload }) ) + } ).flat(1), './static/sitemap-endpoints.json') + } console.log('Total Nuxt Endpoints', this.endpointMaps.nuxt.size ) console.log('Total Eleventy Endpoints', this.endpointMaps.eleventy.size )