cli icon indicating copy to clipboard operation
cli copied to clipboard

WIP: feat: Init for currently exising folders

Open kuzkokov opened this issue 2 years ago • 0 comments

Summary:

Hey, guys. So, this is a third attempt at implementing project init in the existing folder. Basically, I took #1446 and implement fixes from @grabbou code-review.

Then I realized that we should take underscored file names from templates into account and implemented it too. And then I realized that we also change the template placeholder on the project name, including the renaming of folders and files, so we probably should take this into account as well.

But just now I came across this reply, and now I'm confused — do we even have to worry about any conflicts? If so, why?

So now it's more of an issue for discussion rather than PR to review because it most certainly will have some finalization or complete rewriting.

Test Plan:

Current empty folder:

  1. Create an empty folder mkdir TestApp1.
  2. Go to a newly created folder cd TestApp1.
  3. Init a new app react-native init TestApp1 --directory .
  4. As a result a new app gets created in TestApp1 folder.

Non-current empty existing folder:

  1. Create an empty folder mkdir TestApp2.
  2. Init a new app react-native init TestApp2 --directory TestApp2
  3. As a result a new app gets created in TestApp2 folder.

Current folder with conflicting files:

  1. Create an empty folder mkdir TestApp3.
  2. Go to a newly created folder cd TestApp3.
  3. Create some conflicting files mkdir android && touch android/gradlew && touch App.js && touch package.json.
  4. Init a new app react-native init TestApp3 --directory .
  5. As a result get a crash with corresponding error saying that some files are conflicting.
Screenshot 2021-07-15 at 00 31 28

kuzkokov avatar Apr 12 '22 17:04 kuzkokov