From 6963a9e85ea97b47be2edd199afa98100f728cf1 Mon Sep 17 00:00:00 2001 From: tash-2s <81064017+tash-2s@users.noreply.github.com> Date: Thu, 30 Nov 2023 12:37:27 -0600 Subject: [PATCH] fix(create-mud): include `.gitignore` files in created projects (#1945) Co-authored-by: Kevin Ingersoll --- .changeset/mighty-years-whisper.md | 5 +++++ packages/create-mud/scripts/copy-templates.sh | 9 +++++++++ templates/.npmignore | 2 -- 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 .changeset/mighty-years-whisper.md delete mode 100644 templates/.npmignore diff --git a/.changeset/mighty-years-whisper.md b/.changeset/mighty-years-whisper.md new file mode 100644 index 0000000000..5f684cdebf --- /dev/null +++ b/.changeset/mighty-years-whisper.md @@ -0,0 +1,5 @@ +--- +"create-mud": patch +--- + +Templates now correctly include their respective `.gitignore` files diff --git a/packages/create-mud/scripts/copy-templates.sh b/packages/create-mud/scripts/copy-templates.sh index 073b502e80..fecce5f974 100755 --- a/packages/create-mud/scripts/copy-templates.sh +++ b/packages/create-mud/scripts/copy-templates.sh @@ -22,3 +22,12 @@ if grep -r -E 'link:' ./dist/templates; then echo "Linked dependencies found in dist/templates" exit 1 fi + +# Since npm-packlist does not include ".gitignore" files in the packaging process, +# these files are renamed to "gitignore". +# create-create-app automatically renames them back to ".gitignore" upon execution. +find ./dist/templates/* -name ".gitignore" -type f | while read -r file; do + newfile="$(dirname "$file")/gitignore" + echo "Renaming $file to $newfile" + mv "$file" "$newfile" +done diff --git a/templates/.npmignore b/templates/.npmignore deleted file mode 100644 index 81fa541009..0000000000 --- a/templates/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -# make sure our npm package includes the template's gitignore -!.gitignore