From 241131746ddfe4b6d1db0690b9bf3eda2a10d62e Mon Sep 17 00:00:00 2001 From: tom Date: Mon, 1 Jul 2024 17:04:01 -0400 Subject: [PATCH 1/8] update prerender to include a content manifest csv output --- script/prerender/contentManifest.ts | 54 +++++++++++++++++++++++++++++ script/prerender/fleet.ts | 30 ++++++---------- script/prerender/local.ts | 4 ++- script/prerender/sitemap.ts | 36 ++++++------------- script/prerender/thread.ts | 23 +----------- 5 files changed, 78 insertions(+), 69 deletions(-) create mode 100644 script/prerender/contentManifest.ts diff --git a/script/prerender/contentManifest.ts b/script/prerender/contentManifest.ts new file mode 100644 index 0000000000..99affdd4dc --- /dev/null +++ b/script/prerender/contentManifest.ts @@ -0,0 +1,54 @@ +import { BookWithOSWebData, ArchiveTreeNode, ArchiveTree } from "../../src/app/content/types"; +import { content } from "../../src/app/content/routes"; +import { writeAssetFile } from "./fileUtils"; +import { stripIdVersion } from "../../src/app/content/utils/idUtils"; +import { splitTitleParts } from "../../src/app/content/utils/archiveTreeUtils"; + +const quoteValue = (value?: string) => value ? `"${value.replace(/"/g, '""')}"` : '""'; + +export const renderAndSaveContentManfiest = async( + saveFile: (path: string, contents: string) => Promise, + books: BookWithOSWebData[] +) => { + + const rows = books.map(book => getContentsRows(book, book.tree)) + .reduce((result, item) => ([...result, ...item]), [] as string[][]) + + const manifestText = [ + ['id', 'title', 'text title', 'slug', 'url', 'toc type', 'toc target type'], + ...rows + ].map(row => row.map(quoteValue).join(',')).join('\n'); + + await saveFile('/rex/content-metadata.csv', manifestText); +}; + +function getContentsRows(book: BookWithOSWebData, node: ArchiveTree | ArchiveTreeNode, chapterNumber?: string): string[][] { + const {title, toc_target_type} = node; + const [titleNumber, titleString] = splitTitleParts(node.title); + const textTitle = `${titleNumber || chapterNumber || ''} ${titleString}`.replace(/\s+/, ' ').trim(); + const id = stripIdVersion(node.id); + const toc_type = node.toc_type ?? (id === book.id ? 'book' : '') + + const urlParams = 'contents' in node + ? ['', ''] + : [node.slug, content.getUrl({book: {slug: book.slug}, page: {slug: node.slug}})] + + const contents = 'contents' in node + ? node.contents.map(child => getContentsRows(book, child, titleNumber || chapterNumber)) + .reduce((result, item) => ([...result, ...item]), [] as string[][]) + : []; + + return [ + [stripIdVersion(id), title, textTitle, ...urlParams, toc_type, toc_target_type ?? ''], + ...contents + ] +} + + +// simple helper for local +const writeAssetFileAsync = async(filepath: string, contents: string) => { + return writeAssetFile(filepath, contents); +}; +export const renderContentManifest = async(books: BookWithOSWebData[]) => { + return renderAndSaveContentManfiest(writeAssetFileAsync, books); +}; diff --git a/script/prerender/fleet.ts b/script/prerender/fleet.ts index 969b9dbaf6..d27f57a537 100644 --- a/script/prerender/fleet.ts +++ b/script/prerender/fleet.ts @@ -43,11 +43,13 @@ import { getBooksConfigSync } from '../../src/gateways/createBookConfigLoader'; import createOSWebLoader from '../../src/gateways/createOSWebLoader'; import { readFile } from '../../src/helpers/fileUtils'; import { globalMinuteCounter, prepareBookPages } from './contentPages'; -import { SerializedBookMatch, SerializedPageMatch } from './contentRoutes'; +import { SerializedPageMatch } from './contentRoutes'; import createRedirects from './createRedirects'; import './logUnhandledRejectionsAndExit'; import renderManifest from './renderManifest'; -import { SitemapPayload } from './sitemap'; +import { SitemapPayload, renderAndSaveSitemapIndex } from './sitemap'; +import { writeS3ReleaseXmlFile } from "./fileUtils"; +import { renderAndSaveContentManfiest } from "./contentManifest"; const { ARCHIVE_URL, @@ -86,7 +88,6 @@ const sqsClient = new SQSClient({ region: WORK_REGION }); type PageTask = { payload: SerializedPageMatch, type: 'page' }; type SitemapTask = { payload: SitemapPayload, type: 'sitemap' }; -type SitemapIndexTask = { payload: SerializedBookMatch[], type: 'sitemapIndex' }; const booksConfig = getBooksConfigSync(); const archiveLoader = createArchiveLoader({ @@ -288,8 +289,7 @@ async function getQueueUrls(workersStackName: string) { class Stats { public pages = 0; public sitemaps = 0; - public sitemapIndexes = 0; - get total() { return this.pages + this.sitemaps + this.sitemapIndexes; } + get total() { return this.pages + this.sitemaps; } } function makePrepareAndQueueBook(workQueueUrl: string, stats: Stats) { @@ -347,11 +347,7 @@ function makePrepareAndQueueBook(workQueueUrl: string, stats: Stats) { console.log(`[${book.title}] Sitemap queued`); - // Used in the sitemap index - return { - params: { book: { slug: book.slug } }, - state: { bookUid: book.id, bookVersion: book.version }, - }; + return book; }; } @@ -371,14 +367,8 @@ async function queueWork(workQueueUrl: string) { `All ${stats.pages} page prerendering jobs and all ${stats.sitemaps} sitemap jobs queued` ); - await sendWithRetries(sqsClient, new SendMessageCommand({ - MessageBody: JSON.stringify({ payload: books, type: 'sitemapIndex' } as SitemapIndexTask), - QueueUrl: workQueueUrl, - })); - - stats.sitemapIndexes = 1; - - console.log('1 sitemap index job queued'); + renderAndSaveSitemapIndex(writeS3ReleaseXmlFile, books); + renderAndSaveContentManfiest(writeS3ReleaseXmlFile, books); return stats; } @@ -463,8 +453,8 @@ async function finishRendering(stats: Stats) { const elapsedMinutes = globalMinuteCounter(); console.log( - `Prerender complete in ${elapsedMinutes} minutes. Rendered ${stats.pages} pages, ${ - stats.sitemaps} sitemaps and ${stats.sitemapIndexes} sitemap index. ${ + `Prerender complete in ${elapsedMinutes} minutes. Rendered ${stats.pages} pages, and ${ + stats.sitemaps} sitemaps. ${ stats.total / elapsedMinutes}ppm` ); } diff --git a/script/prerender/local.ts b/script/prerender/local.ts index 05d9dee155..7670546cf5 100644 --- a/script/prerender/local.ts +++ b/script/prerender/local.ts @@ -27,6 +27,7 @@ import { createDiskCache } from './fileUtils'; import renderManifest from './renderManifest'; import { renderSitemap, renderSitemapIndex } from './sitemap'; import userLoader from './stubbedUserLoader'; +import { renderContentManifest } from "./contentManifest"; const { REACT_APP_BUY_PRINT_CONFIG_URL, @@ -88,7 +89,8 @@ async function render() { await renderSitemap(book.slug, sitemap); } - await renderSitemapIndex(); + await renderSitemapIndex(books); + await renderContentManifest(books); await renderManifest(); await createRedirects(archiveLoader, osWebLoader); diff --git a/script/prerender/sitemap.ts b/script/prerender/sitemap.ts index b46d1c0b75..133799d502 100644 --- a/script/prerender/sitemap.ts +++ b/script/prerender/sitemap.ts @@ -1,14 +1,11 @@ -import filter from 'lodash/fp/filter'; -import flow from 'lodash/fp/flow'; -import get from 'lodash/fp/get'; -import identity from 'lodash/fp/identity'; -import map from 'lodash/fp/map'; -import max from 'lodash/fp/max'; import sitemap, { SitemapItemOptions } from 'sitemap'; import { SerializedPageMatch } from './contentRoutes'; import { writeAssetFile } from './fileUtils'; +import { BookWithOSWebData } from "../../src/app/content/types"; +import { getSitemapItemOptions } from "./contentPages"; export const sitemapPath = (pathName: string) => `/rex/sitemaps/${pathName}.xml`; +export const contentManifestPath = (pathName: string) => `/rex/manifest/${pathName}.xml`; export type SitemapPayload = { pages: SerializedPageMatch[], slug: string }; @@ -28,40 +25,27 @@ export const renderAndSaveSitemap = async( export const renderAndSaveSitemapIndex = async( saveFile: (path: string, contents: string) => Promise, - urls: SitemapItemOptions[] + books: BookWithOSWebData[] ) => { - const sitemapIndex = sitemap.buildSitemapIndex({ urls }); + const sitemapIndex = sitemap.buildSitemapIndex({urls: books.map(book => + getSitemapItemOptions(book, `https://openstax.org${sitemapPath(book.slug)}`) + )}); const filePath = sitemapPath('index'); await saveFile(filePath, sitemapIndex.toString()); - - return filePath; }; // renderSitemap() and renderSitemapIndex() are used only by single-instance prerender code -// Multi-instance code cannot store an array of sitemaps in memory and then use it across instances -const sitemaps: SitemapItemOptions[] = []; - const writeAssetFileAsync = async(filepath: string, contents: string) => { return writeAssetFile(filepath, contents); }; export const renderSitemap = async(filename: string, urls: SitemapItemOptions[]) => { - const lastmod = flow( - map(get('lastmod')), - filter(identity), - max - )(urls); - - const filePath = await renderAndSaveSitemap(writeAssetFileAsync, filename, urls); - - const url = `https://openstax.org${filePath}`; - - sitemaps.push({url, lastmod}); + await renderAndSaveSitemap(writeAssetFileAsync, filename, urls); }; -export const renderSitemapIndex = async() => { - return renderAndSaveSitemapIndex(writeAssetFileAsync, sitemaps); +export const renderSitemapIndex = async(books: BookWithOSWebData[]) => { + return renderAndSaveSitemapIndex(writeAssetFileAsync, books); }; diff --git a/script/prerender/thread.ts b/script/prerender/thread.ts index c10594384e..b8b898edb3 100644 --- a/script/prerender/thread.ts +++ b/script/prerender/thread.ts @@ -25,17 +25,13 @@ import createImageCDNUtils from '../../src/gateways/createImageCDNUtils'; import { getSitemapItemOptions, renderAndSavePage } from './contentPages'; import { deserializePageMatch, - getArchiveBook, getArchivePage, - SerializedBookMatch, SerializedPageMatch, } from './contentRoutes'; import { writeS3ReleaseHtmlFile, writeS3ReleaseXmlFile } from './fileUtils'; import './logUnhandledRejectionsAndExit'; import { renderAndSaveSitemap, - renderAndSaveSitemapIndex, - sitemapPath, SitemapPayload, } from './sitemap'; import userLoader from './stubbedUserLoader'; @@ -92,24 +88,8 @@ function makeSitemapTask(services: AppOptions['services']) { }; } -function makeSitemapIndexTask(services: AppOptions['services']) { - return async(payload: SerializedBookMatch[]) => { - const books = payload.map( - (book: SerializedBookMatch, index: number) => assertObject( - book, `Sitemap Index task payload[${index}] is not an object: ${payload}` - ) - ); - const items = await asyncPool(MAX_CONCURRENT_CONNECTIONS, books, async(book) => { - const archiveBook = await getArchiveBook(services, book); - return getSitemapItemOptions(archiveBook, `https://openstax.org${sitemapPath(book.params.book.slug)}`); - }); - return renderAndSaveSitemapIndex(writeS3ReleaseXmlFile, items); - }; -} - type AnyTaskFunction = ((payload: SerializedPageMatch) => void) | - ((payload: SitemapPayload) => void) | - ((payload: SerializedBookMatch[]) => void); + ((payload: SitemapPayload) => void); type TaskFunctionsMap = { [key: string]: AnyTaskFunction | undefined }; @@ -145,7 +125,6 @@ async function makeTaskFunctionsMap() { return { page: makePageTask(services), sitemap: makeSitemapTask(services), - sitemapIndex: makeSitemapIndexTask(services), } as TaskFunctionsMap; } From e272313c7e8d67da8b2b9fe8d1f23d66f5a47064 Mon Sep 17 00:00:00 2001 From: tom Date: Mon, 1 Jul 2024 17:08:26 -0400 Subject: [PATCH 2/8] add toc node types --- src/app/content/types.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/app/content/types.ts b/src/app/content/types.ts index bf65c2a001..5c1d201906 100644 --- a/src/app/content/types.ts +++ b/src/app/content/types.ts @@ -114,6 +114,8 @@ export interface ArchiveTreeNode { id: string; title: string; slug: string; + toc_type?: string; + toc_target_type?: string; } export type ArchiveTreeSectionType = 'book' | 'unit' | 'chapter' | 'page' | 'eoc-dropdown' | 'eob-dropdown'; From a97648c0a5e3b976d6048bf04cbc9f3cc685db3c Mon Sep 17 00:00:00 2001 From: tom Date: Mon, 1 Jul 2024 17:14:01 -0400 Subject: [PATCH 3/8] Add lanugage and book slug --- script/prerender/contentManifest.ts | 12 +++++++----- script/prerender/local.ts | 2 ++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/script/prerender/contentManifest.ts b/script/prerender/contentManifest.ts index 99affdd4dc..b5777b632f 100644 --- a/script/prerender/contentManifest.ts +++ b/script/prerender/contentManifest.ts @@ -15,7 +15,7 @@ export const renderAndSaveContentManfiest = async( .reduce((result, item) => ([...result, ...item]), [] as string[][]) const manifestText = [ - ['id', 'title', 'text title', 'slug', 'url', 'toc type', 'toc target type'], + ['id', 'title', 'text title', 'language', 'slug', 'url', 'toc type', 'toc target type'], ...rows ].map(row => row.map(quoteValue).join(',')).join('\n'); @@ -29,9 +29,11 @@ function getContentsRows(book: BookWithOSWebData, node: ArchiveTree | ArchiveTre const id = stripIdVersion(node.id); const toc_type = node.toc_type ?? (id === book.id ? 'book' : '') - const urlParams = 'contents' in node - ? ['', ''] - : [node.slug, content.getUrl({book: {slug: book.slug}, page: {slug: node.slug}})] + const urlParams = toc_type === 'book' + ? [node.slug, ''] + : 'contents' in node + ? ['', ''] + : [node.slug, content.getUrl({book: {slug: book.slug}, page: {slug: node.slug}})] const contents = 'contents' in node ? node.contents.map(child => getContentsRows(book, child, titleNumber || chapterNumber)) @@ -39,7 +41,7 @@ function getContentsRows(book: BookWithOSWebData, node: ArchiveTree | ArchiveTre : []; return [ - [stripIdVersion(id), title, textTitle, ...urlParams, toc_type, toc_target_type ?? ''], + [stripIdVersion(id), title, textTitle, book.language, ...urlParams, toc_type, toc_target_type ?? ''], ...contents ] } diff --git a/script/prerender/local.ts b/script/prerender/local.ts index 7670546cf5..5bfb76439f 100644 --- a/script/prerender/local.ts +++ b/script/prerender/local.ts @@ -82,12 +82,14 @@ async function render() { const books = await prepareBooks(archiveLoader, osWebLoader); + /* for (const book of books) { const bookPages = prepareBookPages(book); const sitemap = await renderPages(renderHelpers, bookPages); await renderSitemap(book.slug, sitemap); } + */ await renderSitemapIndex(books); await renderContentManifest(books); From 820f5bafbc392c6315596a2f3791661f9c8c8cac Mon Sep 17 00:00:00 2001 From: tom Date: Tue, 2 Jul 2024 08:59:56 -0400 Subject: [PATCH 4/8] :shirt: --- script/prerender/contentManifest.ts | 22 +++++++++++----------- script/prerender/fleet.ts | 4 ++-- script/prerender/local.ts | 2 +- script/prerender/sitemap.ts | 8 ++++---- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/script/prerender/contentManifest.ts b/script/prerender/contentManifest.ts index b5777b632f..bd78b7ada9 100644 --- a/script/prerender/contentManifest.ts +++ b/script/prerender/contentManifest.ts @@ -1,8 +1,8 @@ -import { BookWithOSWebData, ArchiveTreeNode, ArchiveTree } from "../../src/app/content/types"; -import { content } from "../../src/app/content/routes"; -import { writeAssetFile } from "./fileUtils"; -import { stripIdVersion } from "../../src/app/content/utils/idUtils"; -import { splitTitleParts } from "../../src/app/content/utils/archiveTreeUtils"; +import { BookWithOSWebData, ArchiveTreeNode, ArchiveTree } from '../../src/app/content/types'; +import { content } from '../../src/app/content/routes'; +import { writeAssetFile } from './fileUtils'; +import { stripIdVersion } from '../../src/app/content/utils/idUtils'; +import { splitTitleParts } from '../../src/app/content/utils/archiveTreeUtils'; const quoteValue = (value?: string) => value ? `"${value.replace(/"/g, '""')}"` : '""'; @@ -12,11 +12,11 @@ export const renderAndSaveContentManfiest = async( ) => { const rows = books.map(book => getContentsRows(book, book.tree)) - .reduce((result, item) => ([...result, ...item]), [] as string[][]) + .reduce((result, item) => ([...result, ...item]), [] as string[][]); const manifestText = [ ['id', 'title', 'text title', 'language', 'slug', 'url', 'toc type', 'toc target type'], - ...rows + ...rows, ].map(row => row.map(quoteValue).join(',')).join('\n'); await saveFile('/rex/content-metadata.csv', manifestText); @@ -27,13 +27,13 @@ function getContentsRows(book: BookWithOSWebData, node: ArchiveTree | ArchiveTre const [titleNumber, titleString] = splitTitleParts(node.title); const textTitle = `${titleNumber || chapterNumber || ''} ${titleString}`.replace(/\s+/, ' ').trim(); const id = stripIdVersion(node.id); - const toc_type = node.toc_type ?? (id === book.id ? 'book' : '') + const toc_type = node.toc_type ?? (id === book.id ? 'book' : ''); const urlParams = toc_type === 'book' ? [node.slug, ''] : 'contents' in node ? ['', ''] - : [node.slug, content.getUrl({book: {slug: book.slug}, page: {slug: node.slug}})] + : [node.slug, content.getUrl({book: {slug: book.slug}, page: {slug: node.slug}})]; const contents = 'contents' in node ? node.contents.map(child => getContentsRows(book, child, titleNumber || chapterNumber)) @@ -42,8 +42,8 @@ function getContentsRows(book: BookWithOSWebData, node: ArchiveTree | ArchiveTre return [ [stripIdVersion(id), title, textTitle, book.language, ...urlParams, toc_type, toc_target_type ?? ''], - ...contents - ] + ...contents, + ]; } diff --git a/script/prerender/fleet.ts b/script/prerender/fleet.ts index d27f57a537..5b6f9ca72e 100644 --- a/script/prerender/fleet.ts +++ b/script/prerender/fleet.ts @@ -48,8 +48,8 @@ import createRedirects from './createRedirects'; import './logUnhandledRejectionsAndExit'; import renderManifest from './renderManifest'; import { SitemapPayload, renderAndSaveSitemapIndex } from './sitemap'; -import { writeS3ReleaseXmlFile } from "./fileUtils"; -import { renderAndSaveContentManfiest } from "./contentManifest"; +import { writeS3ReleaseXmlFile } from './fileUtils'; +import { renderAndSaveContentManfiest } from './contentManifest'; const { ARCHIVE_URL, diff --git a/script/prerender/local.ts b/script/prerender/local.ts index 5bfb76439f..322dfafb84 100644 --- a/script/prerender/local.ts +++ b/script/prerender/local.ts @@ -27,7 +27,7 @@ import { createDiskCache } from './fileUtils'; import renderManifest from './renderManifest'; import { renderSitemap, renderSitemapIndex } from './sitemap'; import userLoader from './stubbedUserLoader'; -import { renderContentManifest } from "./contentManifest"; +import { renderContentManifest } from './contentManifest'; const { REACT_APP_BUY_PRINT_CONFIG_URL, diff --git a/script/prerender/sitemap.ts b/script/prerender/sitemap.ts index 133799d502..ea6d11a382 100644 --- a/script/prerender/sitemap.ts +++ b/script/prerender/sitemap.ts @@ -1,8 +1,8 @@ import sitemap, { SitemapItemOptions } from 'sitemap'; import { SerializedPageMatch } from './contentRoutes'; import { writeAssetFile } from './fileUtils'; -import { BookWithOSWebData } from "../../src/app/content/types"; -import { getSitemapItemOptions } from "./contentPages"; +import { BookWithOSWebData } from '../../src/app/content/types'; +import { getSitemapItemOptions } from './contentPages'; export const sitemapPath = (pathName: string) => `/rex/sitemaps/${pathName}.xml`; export const contentManifestPath = (pathName: string) => `/rex/manifest/${pathName}.xml`; @@ -25,9 +25,9 @@ export const renderAndSaveSitemap = async( export const renderAndSaveSitemapIndex = async( saveFile: (path: string, contents: string) => Promise, - books: BookWithOSWebData[] + books: BookWithOSWebData[] ) => { - const sitemapIndex = sitemap.buildSitemapIndex({urls: books.map(book => + const sitemapIndex = sitemap.buildSitemapIndex({urls: books.map(book => getSitemapItemOptions(book, `https://openstax.org${sitemapPath(book.slug)}`) )}); From 6c9fc52b8f9c6cc1971f2884d3177982c468c973 Mon Sep 17 00:00:00 2001 From: tom Date: Tue, 2 Jul 2024 09:01:53 -0400 Subject: [PATCH 5/8] remove debug --- script/prerender/local.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/script/prerender/local.ts b/script/prerender/local.ts index 322dfafb84..4f6347b874 100644 --- a/script/prerender/local.ts +++ b/script/prerender/local.ts @@ -82,14 +82,12 @@ async function render() { const books = await prepareBooks(archiveLoader, osWebLoader); - /* for (const book of books) { const bookPages = prepareBookPages(book); const sitemap = await renderPages(renderHelpers, bookPages); await renderSitemap(book.slug, sitemap); } - */ await renderSitemapIndex(books); await renderContentManifest(books); From 647bf6657084c863dc5456073d15845e48dddb2d Mon Sep 17 00:00:00 2001 From: tom Date: Tue, 2 Jul 2024 09:45:23 -0400 Subject: [PATCH 6/8] :shirt: --- script/prerender/contentManifest.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/script/prerender/contentManifest.ts b/script/prerender/contentManifest.ts index bd78b7ada9..ffcef80e6b 100644 --- a/script/prerender/contentManifest.ts +++ b/script/prerender/contentManifest.ts @@ -22,14 +22,18 @@ export const renderAndSaveContentManfiest = async( await saveFile('/rex/content-metadata.csv', manifestText); }; -function getContentsRows(book: BookWithOSWebData, node: ArchiveTree | ArchiveTreeNode, chapterNumber?: string): string[][] { +function getContentsRows( + book: BookWithOSWebData, + node: ArchiveTree | ArchiveTreeNode, + chapterNumber?: string +): string[][] { const {title, toc_target_type} = node; const [titleNumber, titleString] = splitTitleParts(node.title); const textTitle = `${titleNumber || chapterNumber || ''} ${titleString}`.replace(/\s+/, ' ').trim(); const id = stripIdVersion(node.id); - const toc_type = node.toc_type ?? (id === book.id ? 'book' : ''); + const tocType = node.toc_type ?? (id === book.id ? 'book' : ''); - const urlParams = toc_type === 'book' + const urlParams = tocType === 'book' ? [node.slug, ''] : 'contents' in node ? ['', ''] @@ -41,7 +45,7 @@ function getContentsRows(book: BookWithOSWebData, node: ArchiveTree | ArchiveTre : []; return [ - [stripIdVersion(id), title, textTitle, book.language, ...urlParams, toc_type, toc_target_type ?? ''], + [stripIdVersion(id), title, textTitle, book.language, ...urlParams, tocType, toc_target_type ?? ''], ...contents, ]; } From 0bf7852d036e4fbe63386433ef113f7e7d6afa34 Mon Sep 17 00:00:00 2001 From: tom Date: Wed, 3 Jul 2024 16:18:15 -0400 Subject: [PATCH 7/8] :pencil: --- script/prerender/contentManifest.ts | 4 ++-- script/prerender/sitemap.ts | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/script/prerender/contentManifest.ts b/script/prerender/contentManifest.ts index ffcef80e6b..f57766b577 100644 --- a/script/prerender/contentManifest.ts +++ b/script/prerender/contentManifest.ts @@ -6,7 +6,7 @@ import { splitTitleParts } from '../../src/app/content/utils/archiveTreeUtils'; const quoteValue = (value?: string) => value ? `"${value.replace(/"/g, '""')}"` : '""'; -export const renderAndSaveContentManfiest = async( +export const renderAndSaveContentManifest = async( saveFile: (path: string, contents: string) => Promise, books: BookWithOSWebData[] ) => { @@ -56,5 +56,5 @@ const writeAssetFileAsync = async(filepath: string, contents: string) => { return writeAssetFile(filepath, contents); }; export const renderContentManifest = async(books: BookWithOSWebData[]) => { - return renderAndSaveContentManfiest(writeAssetFileAsync, books); + return renderAndSaveContentManifest(writeAssetFileAsync, books); }; diff --git a/script/prerender/sitemap.ts b/script/prerender/sitemap.ts index ea6d11a382..7538d59066 100644 --- a/script/prerender/sitemap.ts +++ b/script/prerender/sitemap.ts @@ -5,7 +5,6 @@ import { BookWithOSWebData } from '../../src/app/content/types'; import { getSitemapItemOptions } from './contentPages'; export const sitemapPath = (pathName: string) => `/rex/sitemaps/${pathName}.xml`; -export const contentManifestPath = (pathName: string) => `/rex/manifest/${pathName}.xml`; export type SitemapPayload = { pages: SerializedPageMatch[], slug: string }; From 2d69aa45b303a2f63e14c264e06b93033671c51f Mon Sep 17 00:00:00 2001 From: tom Date: Thu, 8 Aug 2024 14:38:15 -0400 Subject: [PATCH 8/8] fix import --- script/prerender/fleet.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script/prerender/fleet.ts b/script/prerender/fleet.ts index 5b6f9ca72e..9e5173110c 100644 --- a/script/prerender/fleet.ts +++ b/script/prerender/fleet.ts @@ -49,7 +49,7 @@ import './logUnhandledRejectionsAndExit'; import renderManifest from './renderManifest'; import { SitemapPayload, renderAndSaveSitemapIndex } from './sitemap'; import { writeS3ReleaseXmlFile } from './fileUtils'; -import { renderAndSaveContentManfiest } from './contentManifest'; +import { renderAndSaveContentManifest } from './contentManifest'; const { ARCHIVE_URL, @@ -368,7 +368,7 @@ async function queueWork(workQueueUrl: string) { ); renderAndSaveSitemapIndex(writeS3ReleaseXmlFile, books); - renderAndSaveContentManfiest(writeS3ReleaseXmlFile, books); + renderAndSaveContentManifest(writeS3ReleaseXmlFile, books); return stats; }