From c014778194d34e99e58f568b3113758342bf17a7 Mon Sep 17 00:00:00 2001
From: Marcus Schiesser <mail@marcusschiesser.de>
Date: Fri, 10 Nov 2023 17:38:15 +0700
Subject: [PATCH] fix: ensure that no HTML component files are copied if shadcn
 is selected

---
 templates/components/ui/shadcn/README.md | 1 +
 templates/index.ts                       | 9 ++++++---
 2 files changed, 7 insertions(+), 3 deletions(-)
 create mode 100644 templates/components/ui/shadcn/README.md

diff --git a/templates/components/ui/shadcn/README.md b/templates/components/ui/shadcn/README.md
new file mode 100644
index 00000000..ebfcf48c
--- /dev/null
+++ b/templates/components/ui/shadcn/README.md
@@ -0,0 +1 @@
+Using the chat component from https://github.com/marcusschiesser/ui (based on https://ui.shadcn.com/)
diff --git a/templates/index.ts b/templates/index.ts
index 7463be23..c7e0db49 100644
--- a/templates/index.ts
+++ b/templates/index.ts
@@ -99,11 +99,14 @@ const installTSTemplate = async ({
   /**
    * Copy the selected UI files to the target directory and reference it.
    */
-  if (framework === "nextjs") {
+  if (framework === "nextjs" && ui !== "html") {
     console.log("\nUsing UI:", ui, "\n");
     const uiPath = path.join(compPath, "ui", ui);
-    const componentsPath = path.join("app", "components");
-    await copy("**", path.join(root, componentsPath, "ui"), {
+    const destUiPath = path.join(root, "app", "components", "ui");
+    // remove the default ui folder
+    await fs.rm(destUiPath, { recursive: true });
+    // copy the selected ui folder
+    await copy("**", destUiPath, {
       parents: true,
       cwd: uiPath,
     });
-- 
GitLab