Can't use create-t3-app inside of git bare repo worktree folder
Describe the bug I can't initialize create-t3-app inside of a git worktree folder because it already contains a .git file.
To Reproduce create a repo on github
cd project
git clone [email protected]/user/repo --bare .
git worktree add main
cd main
pnpx create-t3-app@latest
# select no for "initialize git repo"
It will abort because the directory is not empty.
Expected behavior The script should continue because the .git file does not interfere with other files.
I think what you are describing is a bit of an edgecase, and only warn when certain directories exists would be complicated.
What I could see here is modifying the existing prompt to allow for something like:
Directory is not empty, how would you
like to proceed?
> Abort installation
> Clear the directory and continue installation
> Continue installation and overwrite conflicting files
What do you think?
That’s a great solution
I don’t know how much work this would be, but listing the conflicting files would be useful.
Feel free to PR this. I dont have much time for coding currently.
It only aborts if you are creating a new directory with the same name, right?
I think what you are describing is a bit of an edgecase, and only warn when certain directories exists would be complicated.
What I could see here is modifying the existing prompt to allow for something like:
Directory is not empty, how would you like to proceed? > Abort installation > Clear the directory and continue installation > Continue installation and overwrite conflicting filesWhat do you think?
Wouldn't this solution cause this warning to happen the majority of the time you are using the cli (e.g. in a folder with other projects)?
Wouldn't this solution cause this warning to happen the majority of the time you are using the cli (e.g. in a folder with other projects)?
It shouldn't. This prompt only shows up if it detects that the directory you have entered to scaffold in isn't empty. This behavior should not change. What's proposed is to have more options when this occurs. Currently we only have cancel or empty directory, the proposal is to have an option to continue without emptying and just overwriting the conflicting files and let the rest remain.
For anyone wanting to pick this up, I think we should satisfy with my suggestion above and just let the fs calls overwrite.
Explicitly saying what files conflict seems scary and bad if we get it "wrong" (indicated by the amount of edge cases I could think this seems quite likely).