Move Stork toml build into build-lists

This commit is contained in:
Sam Carlton 2022-05-09 16:20:28 -05:00
parent 1c25b19e74
commit c0dbaf88f9
2 changed files with 13 additions and 4 deletions

View file

@ -25,6 +25,10 @@ import {
} from './helpers/app-derived.js'
import { makeSearchableList } from './helpers/searchable-list.js'
import {
writeStorkToml
} from './helpers/stork/toml.js'
// Setup dotenv
dotenv.config()
@ -535,10 +539,15 @@ class BuildLists {
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 => {
const sitemapEndpoints = Object.values(this.endpointMaps).map( endpointSet => {
return Array.from( endpointSet , ([route, payload]) => ({ route, payload }) )
} ).flat(1), './static/sitemap-endpoints.json')
} ).flat(1)
// Save sitemap endpoints
await this.saveToJson( sitemapEndpoints, './static/sitemap-endpoints.json')
// Save stork toml index
await writeStorkToml( sitemapEndpoints )
}
console.log('Total Nuxt Endpoints', this.endpointMaps.nuxt.size )

View file

@ -48,7 +48,7 @@
"precommit": "npm run lint",
"clone-readme": "cp ./README.md README-temp.md",
"cloudflare-deploy": "npm run build-api",
"vercel-build": "npm run build-lists-and-api && npm run build-stork && npm run test-postbuild-api",
"vercel-build": "npm run build-lists-and-api && npm run test-postbuild-api",
"netlify-build": "npm run test-prebuild-functions && npm run generate-astro"
},
"dependencies": {