From 456ce349d61edbcc92449a85dd258ad65365d710 Mon Sep 17 00:00:00 2001 From: Kara Brightwell Date: Thu, 9 May 2024 09:57:28 +0100 Subject: [PATCH] build: don't throw in generate-docs when no readme --- scripts/generate-docs.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/generate-docs.js b/scripts/generate-docs.js index 356727a38..51be65c26 100644 --- a/scripts/generate-docs.js +++ b/scripts/generate-docs.js @@ -114,9 +114,9 @@ async function main() { const readmePath = path.join('plugins', plugin, 'readme.md') const generatedOptionsMarkdown = await formatPluginSchemas(plugin) - const originalReadme = await fs.readFile(readmePath, 'utf-8') - try { + const originalReadme = await fs.readFile(readmePath, 'utf-8') + const replacedReadme = replaceBetween( originalReadme, generatedOptionsMarkdown, @@ -127,7 +127,11 @@ async function main() { await fs.writeFile(readmePath, replacedReadme, 'utf-8') console.log(`written ${readmePath}`) } catch (e) { - console.error(`no replacement markers in ${readmePath}`) + if (e.code === 'ENOENT') { + console.error(`${plugin} has no readme`) + } else { + console.error(`no replacement markers in ${readmePath}`) + } } }) )