Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Merge requests
  • !8028

fix(react-scripts): proactively append to .gitignore during generation

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/bmuenzenmeyer/7892-safe-move-gitignore into master Nov 25, 2019
  • Overview 6
  • Commits 1
  • Pipelines 0
  • Changes 1

Created by: bmuenzenmeyer

close #7892 (closed)

Proactively append to .gitignore during generation instead relying on a try/catch

As #7892 (closed) illustrates, relying on the EEXISTS error is not reliable after the fs-extra@8.X upgrade. This fact was confirmed by the fs-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 append gitignore to it, rather than rely on the try catch logic to sniff for EEXISTS / dest already exists errors from fs-extra

Testing

I attempted to test this:

  1. adding a directory to the monorepo, foo
  2. placing a .gitignore into it with contents.
  3. I commit that to avoid the git status porcelain check
  4. Run 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 script create-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.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/bmuenzenmeyer/7892-safe-move-gitignore