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

Merged
merged 1 commit into from
Jul 20, 2025

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
Copy link
Member

@satya164 satya164 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR

@satya164 satya164 added this pull request to the merge queue Jul 20, 2025
Merged via the queue into callstack:main with commit a933e02 Jul 20, 2025
9 checks passed
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.

2 participants