-
Notifications
You must be signed in to change notification settings - Fork 906
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
fix: add more guard conditions for retrieving buildConfig from XcScheme #2196
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @AnnatarHe, thanks for your PR! I believe it's a follow up to the issue #1908 you raised some time ago, unfortunately we had to prioritize other stuff at this moment. I think this is a great starting point, however I feel like we could improve the DX for your solution 🙂
if (xcProjects.length > 1) { | ||
throw new CLIError( | ||
'Multiple Xcode projects found. we are only support one. please remove another one', | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe in that case, instead of forcing to remove the project, we should prompt user which project to use -> maybe store it in cache?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m not sure whether we should prompt the user to choose one option for processing. Additionally, it seems that the current process does not support different projects. the previous code used a simple [].find
to select the first available option, but I guess this is not the only occurrence.
this PR just corrects the error message here. If the CLI is going to support multiple projects in future, we can easily identify where we need to make changes.
additionally, I’m not familiar with this project, so I don’t know how to show a prompt to the user in this project 😂
If necessary, maybe we can raise another pull request after this one is merged? This one is for correcting error messages, and the next one will be for enhancing the DX.
Thanks for the ping! I haven't tested it (I'm supposed to be afk for the holidays :P), but I'm pretty certain this is going to break general usage, including RNTA. I think I've mentioned this at multiple occasions before:
Maybe this should be in a comment in this part of the code to avoid reintroducing wrong assumptions? |
Hi @tido64 ,Thank you for your review. I’m sorry, my English is not good. I don’t really understand what your concern is. This PR only provides some accurate error messages. It doesn’t make any assumptions. The sourceDir is passed by the parent function and the main logic remains the same as before. What changes should I make? Or should I just close it? |
Basically,
Or in a hybrid scenario:
Hopefully the examples above make sense. We cannot throw just because we cannot find An
I think we should close it. Or if you'd like to, it would be nice to have a comment in code explaining all of this so the next person doesn't make the same mistake. |
@tido64 Thanks, your description is perfect, I've learned a lot. this MR got updated, just add a simple comment and use |
Summary:
just an enhancement. Add more guard conditions when retrieving buildConfig from XcScheme.
Test Plan:
add a new project to
/ios/
folder looks like this:when running
npx react-native run-ios
it would throw an accurate error message.Checklist
Note:
I'm not good at English, please feel free to correct the error message. Thanks.