From 200e99db6de6cab62c3188fd8bc3dac049f5a675 Mon Sep 17 00:00:00 2001
From: Marcus Schiesser <mail@marcusschiesser.de>
Date: Mon, 13 Nov 2023 10:08:25 +0700
Subject: [PATCH] fix: didn't copy UI readme

---
 .../shadcn/{README.md => README-template.md}  |  0
 templates/index.ts                            | 35 ++++++++++---------
 2 files changed, 19 insertions(+), 16 deletions(-)
 rename templates/components/ui/shadcn/{README.md => README-template.md} (100%)

diff --git a/templates/components/ui/shadcn/README.md b/templates/components/ui/shadcn/README-template.md
similarity index 100%
rename from templates/components/ui/shadcn/README.md
rename to templates/components/ui/shadcn/README-template.md
diff --git a/templates/index.ts b/templates/index.ts
index c7e0db49..732bedf3 100644
--- a/templates/index.ts
+++ b/templates/index.ts
@@ -57,25 +57,27 @@ const installTSTemplate = async ({
   const copySource = ["**"];
   if (!eslint) copySource.push("!eslintrc.json");
 
+  const rename = (name: string) => {
+    switch (name) {
+      case "gitignore":
+      case "eslintrc.json": {
+        return `.${name}`;
+      }
+      // README.md is ignored by webpack-asset-relocator-loader used by ncc:
+      // https://github.com/vercel/webpack-asset-relocator-loader/blob/e9308683d47ff507253e37c9bcbb99474603192b/src/asset-relocator.js#L227
+      case "README-template.md": {
+        return "README.md";
+      }
+      default: {
+        return name;
+      }
+    }
+  };
+
   await copy(copySource, root, {
     parents: true,
     cwd: templatePath,
-    rename(name) {
-      switch (name) {
-        case "gitignore":
-        case "eslintrc.json": {
-          return `.${name}`;
-        }
-        // README.md is ignored by webpack-asset-relocator-loader used by ncc:
-        // https://github.com/vercel/webpack-asset-relocator-loader/blob/e9308683d47ff507253e37c9bcbb99474603192b/src/asset-relocator.js#L227
-        case "README-template.md": {
-          return "README.md";
-        }
-        default: {
-          return name;
-        }
-      }
-    },
+    rename,
   });
 
   /**
@@ -109,6 +111,7 @@ const installTSTemplate = async ({
     await copy("**", destUiPath, {
       parents: true,
       cwd: uiPath,
+      rename,
     });
   }
 
-- 
GitLab