Search code examples
firebasegoogle-cloud-platformrepositorygitignore

What is the practice on committing firebase files in a NodeJS app?


I've recently explored firebase for hosting a React app in a NodeJS environment. Initializing the firebase CLI tools created two files:

.firebaserc
firebase.json

What is the accepted practice for committing these files to the repository? No? I searched Google, and ironically diddn't find what I was looking for.


I work on two machines, and feel like .firebaserc is environment/machine specific, and thus should not be committed to the repository. If I were working on this project with other developers, I have a feeling that I would want firebase.json to be consistent between environments/machines. I would not want another developer making changes to firebase.json independent of others working on the codebase.

Thus, I am thinking commit firebase.json and adding .firebaserc to .gitignore.


Solution

  • You should always check in firebase.json.

    For shared team projects (where you're generally working with the same projects for staging, prod, etc) you would check in .firebaserc. For open-source samples or other codebases where you would not expect everyone to be working with the same projects, you would not check in .firebaserc.

    The only time this gets to be a gray area is when a team wants to have per-developer dev/test projects. Here my guidance would be still to check in the .firebaserc with proper staging/prod/etc. aliases and have each developer just run firebase use my-personal-test-project for individual test environments.