From 7bd25b3875b1e62ef61fdb40fdb373ad5b944590 Mon Sep 17 00:00:00 2001 From: Marcus Schiesser <mail@marcusschiesser.de> Date: Thu, 23 Nov 2023 20:58:43 +0700 Subject: [PATCH] fix: copy pdf-parse test doc for npm build --- templates/index.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/templates/index.ts b/templates/index.ts index 963f8f7e..2c1f8737 100644 --- a/templates/index.ts +++ b/templates/index.ts @@ -32,6 +32,14 @@ const copyTestData = async ( engine?: TemplateEngine, openAIKey?: string, ) => { + if (framework === "nextjs") { + // XXX: This is a hack to make the build for nextjs work with pdf-parse + // pdf-parse needs './test/data/05-versions-space.pdf' to exist - can be removed when pdf-parse is removed + const srcFile = path.join(__dirname, "components", "data", "101.pdf"); + const destPath = path.join(root, "test", "data"); + await fs.mkdir(destPath, { recursive: true }); + await fs.copyFile(srcFile, path.join(destPath, "05-versions-space.pdf")); + } if (engine === "context" || framework === "fastapi") { const srcPath = path.join(__dirname, "components", "data"); const destPath = path.join(root, "data"); -- GitLab