From fa398a9c21332dea18aaab8d38aeef91af8a5f68 Mon Sep 17 00:00:00 2001 From: Chris Hubbard Date: Tue, 23 Jan 2024 09:12:19 -0500 Subject: [PATCH] Use first collection when no layout-collections specified --- scripts/convertConfig.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/convertConfig.ts b/scripts/convertConfig.ts index 759fa85ea..44972deff 100644 --- a/scripts/convertConfig.ts +++ b/scripts/convertConfig.ts @@ -785,9 +785,12 @@ function convertConfig(dataDir: string, verbose: number) { } } const layoutCollectionElements = layout.getElementsByTagName('layout-collection'); - const layoutCollections = Array.from(layoutCollectionElements).map((element) => { - return element.attributes.getNamedItem('id')!.value; - }); + const layoutCollections = + layoutCollectionElements.length > 0 + ? Array.from(layoutCollectionElements).map((element) => { + return element.attributes.getNamedItem('id')!.value; + }) + : [data.bookCollections[0].id]; data.layouts.push({ mode,