Closed melanieseltzer closed 5 years ago
In #286 we discussed that we'll check for dirty repo state when hitting the Eject button, and if anything is untracked/unstaged, throw an error dialog up letting the user know that they need to handle it themselves before ejecting (so we're not going to auto commit before ejecting). Also provide a link to git documentation if they need it, in that dialog.
I'll probably work on this myself cause I was playing around with it already. git-state worked pretty well for checking repo state (the check
method is what I used). Any objections to install that package?
Git-state
looks great but I would keep it simple for now. I think just wrapping it in a try/catch during eject should work here and display a message box that's telling the repo is not clean.
You can check the stderr if it contains clean repo required
- not sure what the exact text is but with this you can generate the custom error message.
If it's not containing the text swallow this error as well. Could be that Git is not available.
Your mentioned implementation details in the comment at PR #286 are OK & sorry for the confusion about how to implement it. I've first thought this is a pretty straight forward issue but there are many details to take care of.
Describe the bug
CRA 2.0 introduces functionality that automatically initializes a git repo upon project creation (CRA 2.0 Changelog (look for #1288)).
When new projects are created through Guppy,
package.json
file gets a Guppy key added. Now with thegit init
running it's sayingpackage.json
has an uncommitted change, and Eject fails silently.Usually if you run Eject in terminal you'll get this failure if you have uncommitted changes:
Need to handle that error so it doesn't fail silently, and prompts you to commit your changes. And/or should automatically do a commit upon finishing project creation (is this possible?).