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
.
As Frank suggested, you should definitely add the . firebase directory to your . gitignore or equivalent file, since it contains information that's not strictly part of your project, and is likely not applicable for everyone sharing and contributing to your project source code.
The firebase init command creates a firebase. json configuration file in the root of your project directory. The firebase. json file is required to deploy assets with the Firebase CLI because it specifies which files and settings from your project directory are deployed to your Firebase project.
You cannot change hosted files in the Firebase Console. Instead, you should change the index. html on your local copy where you initially ran the firebase deploy command. Once you're done with the changes, run firebase deploy again to push the updated version of your website to Firebase Hosting.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With