-
Notifications
You must be signed in to change notification settings - Fork 905
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
Why doesn't this CLI let me create a new project in an existing, empty directory? #1418
Comments
It's because we get generate Android/iOS package names based on the project name. Feel free to add such a feature to read it from the directory if the project name param is a dot :) |
ok, I'll work on this then. It'll be great if you could clarify a few things for me
This is the workflow in my mind.
|
Refs: react-native-community#1418 * init command doesn't create a new project if directory already exists * so let user pass a directory path as projectName * or using --directory option * if directory doesn't contain any conflicting files, create the project
Refs: react-native-community#1418 * init command doesn't create a new project if directory already exists * so let user pass a directory path as projectName * or using --directory option * if directory doesn't contain any conflicting files, create the project
Please review this commit: 131d0be |
Create a PR please :) |
I'm stuck at writing tests for this. To validate a directory, the code checks the local file system. So should I use something like mock-fs for this? |
There hasn't been any activity on this issue in the past 3 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 7 days. |
Ask your Question
When i run this command:
npx react-native init --directory . --skip-install awesomeproject
, I get the errorerror Error occurred while trying to create project directory.
Note that the '.' directory is completely emptyI checked the code and it seems the cli only checks if the directory already exists, and if it does, error is thrown here
But in create-react-app, you can just specify the directory, the command works, as long as package.json does not exist, even if the directory does.
Is there are particular reason react-native does this? If not, I think the CRA way is better and I would love to implement it in this CLI
The text was updated successfully, but these errors were encountered: