-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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(react-scripts): proactively append to .gitignore during generation #8028
fix(react-scripts): proactively append to .gitignore during generation #8028
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.
This makes sense to me, and looks good. I'm not sure it can make it into 3.3, but it is a candidate for the next release.
Thanks for the approval. Understand timing is sometimes tough, but as far as I know not including this will cause a bug in 3.3.0 https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/package.json#L54 |
I've confirmed that not including this PR is causing a bug in
|
@mrmckeb @iansu @ianschmitz @petetnt hoping this can get looked at again soon - it's an active 3.3.0 bug |
@bmuenzenmeyer This issue should be very low impact right now, but I appreciate it needs to be dealt with. @ianschmitz can you take a look at this one? |
Thanks @bmuenzenmeyer, we'll get this into v3.3.1 - which should be out in the next week or two. |
close #7892
Proactively append to
.gitignore
during generation instead relying on atry/catch
As #7892 illustrates, relying on the
EEXISTS
error is not reliable after thefs-extra@8.X
upgrade. This fact was confirmed by thefs-extra
team when I opened an an issue with them.The solution is to check whether or not
.gitignore
exists in the current repo and proactively appendgitignore
to it, rather than rely on the try catch logic to sniff forEEXISTS
/dest already exists
errors fromfs-extra
Testing
I attempted to test this:
foo
.gitignore
into it with contents.yarn create-react-app foo --template typescript
This succeeds, but gives me warnings about not having a version that supports
template
. If I do not supply a template, the CLI tells me none was applied.When I run this without the
template
arg, I get a reverse error message, stating no template was applied. Having maintained a fork for a long time, I know not to rely on the npm scriptcreate-react-app
as gospel for a real generation. I also know that this new template functionality is still in progress - so I am guessing it's just a quick of this being a bit in-flight.I think a better approach may be to add a check for this proper appending via CI, but I wanted to get this out here first. I'd also state that the code is pretty darn simple, mostly co-opted from the existing try / catch, and that I don't see any
.gitignore
coverage currently in the e2e tests. Perhaps a visual review is okay without a formal test - but I'll leave that to the maintainers to decide.