Skip to content

Commit

Permalink
fix: don't copy data folder for example file
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusschiesser committed Mar 27, 2024
1 parent 99e758f commit dd6f84f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
7 changes: 5 additions & 2 deletions helpers/datasources.ts
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
5 changes: 2 additions & 3 deletions helpers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion helpers/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit dd6f84f

Please sign in to comment.