From dd6f84fdd2d0444e4446eee7f56cfdf1f4becbf1 Mon Sep 17 00:00:00 2001
From: Marcus Schiesser <mail@marcusschiesser.de>
Date: Wed, 27 Mar 2024 15:45:53 +0800
Subject: [PATCH] fix: don't copy data folder for example file

---
 helpers/datasources.ts | 7 +++++--
 helpers/index.ts       | 5 ++---
 helpers/types.ts       | 2 +-
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/helpers/datasources.ts b/helpers/datasources.ts
index 2735eb8d..c8a47e22 100644
--- a/helpers/datasources.ts
+++ b/helpers/datasources.ts
@@ -1,9 +1,12 @@
+import path from "path";
+import { templatesDir } from "./dir";
 import { TemplateDataSource } from "./types";
 
-// Example file has an empty config
 export const EXAMPLE_FILE: TemplateDataSource = {
   type: "file",
-  config: {},
+  config: {
+    path: path.join(templatesDir, "components", "data", "101.pdf"),
+  },
 };
 
 export function getDataSources(
diff --git a/helpers/index.ts b/helpers/index.ts
index b3ba62b7..79ba8dc0 100644
--- a/helpers/index.ts
+++ b/helpers/index.ts
@@ -4,7 +4,6 @@ import path from "path";
 import { cyan } from "picocolors";
 
 import fsExtra from "fs-extra";
-import { templatesDir } from "./dir";
 import { createBackendEnvFile, createFrontendEnvFile } from "./env-variables";
 import { PackageManager } from "./get-pkg-manager";
 import { installLlamapackProject } from "./llama-pack";
@@ -79,8 +78,8 @@ const copyContextData = async (
   for (const dataSource of dataSources) {
     const dataSourceConfig = dataSource?.config as FileSourceConfig;
     // Copy local data
-    const dataPath =
-      dataSourceConfig.path ?? path.join(templatesDir, "components", "data");
+    const dataPath = dataSourceConfig.path;
+
     const destPath = path.join(root, "data", path.basename(dataPath));
     console.log("Copying data from path:", dataPath);
     await fsExtra.copy(dataPath, destPath);
diff --git a/helpers/types.ts b/helpers/types.ts
index c1276602..c524825d 100644
--- a/helpers/types.ts
+++ b/helpers/types.ts
@@ -18,7 +18,7 @@ export type TemplateDataSourceType = "file" | "web";
 export type TemplateObservability = "none" | "opentelemetry";
 // Config for both file and folder
 export type FileSourceConfig = {
-  path?: string;
+  path: string;
 };
 export type WebSourceConfig = {
   baseUrl?: string;
-- 
GitLab