Skip to content
Snippets Groups Projects
Commit 60816cc0 authored by Marcus Schiesser's avatar Marcus Schiesser
Browse files

fix: don't copy backend files for frontend-only

......@@ -71,7 +71,7 @@ export async function createApp({
// install backend
const backendRoot = path.join(root, "backend");
await makeDir(backendRoot);
await installTemplate({ ...args, root: backendRoot });
await installTemplate({ ...args, root: backendRoot, backend: true });
// install frontend
const frontendRoot = path.join(root, "frontend");
await makeDir(frontendRoot);
......@@ -80,6 +80,7 @@ export async function createApp({
root: frontendRoot,
framework: "nextjs",
customApiPath: "http://localhost:8000/api/chat",
backend: false,
});
// copy readme for fullstack
await fs.promises.copyFile(
......@@ -87,7 +88,7 @@ export async function createApp({
path.join(root, "README.md"),
);
} else {
await installTemplate(args);
await installTemplate({ ...args, backend: true });
}
process.chdir(root);
......
......@@ -267,7 +267,9 @@ const installPythonTemplate = async ({
);
};
export const installTemplate = async (props: InstallTemplateArgs) => {
export const installTemplate = async (
props: InstallTemplateArgs & { backend: boolean },
) => {
process.chdir(props.root);
if (props.framework === "fastapi") {
await installPythonTemplate(props);
......@@ -275,16 +277,20 @@ export const installTemplate = async (props: InstallTemplateArgs) => {
await installTSTemplate(props);
}
// Copy the environment file to the target directory.
await createEnvLocalFile(props.root, props.framework, props.openAIKey);
if (props.backend) {
// This is a backend, so we need to copy the test data and create the env file.
// Copy test pdf file
await copyTestData(
props.root,
props.framework,
props.packageManager,
props.engine,
);
// Copy the environment file to the target directory.
await createEnvLocalFile(props.root, props.framework, props.openAIKey);
// Copy test pdf file
await copyTestData(
props.root,
props.framework,
props.packageManager,
props.engine,
);
}
};
export * from "./types";
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment