diff --git a/templates/index.ts b/templates/index.ts index 963f8f7ef976e1e0c58c42b4806d068845e1159c..2c1f8737706d9f58afb7a269d15c743f2f8f2bc3 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");