Skip to content

fix: allow project creation in directories with only .git folder #866

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

saseungmin
Copy link
Contributor

Summary

Problem

Currently, the library validation prevents creating projects in directories that contain any files, including .git folders. This creates a frustrating user experience when:

  1. Users clone an empty GitHub repository
  2. The directory contains only a .git folder
  3. The validation fails with "Directory already exists" error

This is a common workflow where developers create a GitHub repo first, then clone it locally to set up their React Native library.

image

Solution

  • Treat directories as "empty" if they contain no files OR only a .git folder
  • Allow project creation in such directories

This follows the same pattern used by Vite's create-vite tool:

Test plan

  1. yarn install
  2. cd packages/create-react-native-library
  3. yarn prepare
  4. run ./bin/create-react-native-library

Tested scenarios:

  • Empty directory - works as before
  • Directory with only .git - now works ✅
  • Directory with other files - still blocked as expected
  • Non-existent directory - works as before

- Enable creating projects in freshly cloned empty repositories
- Resolves issue where users couldn't create projects in cloned repos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant