Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 351
Todd Avatar asked Apr 20 '17 18:04

Todd


People also ask

Should I add firebase files 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.

What script should be run before every deploy firebase?

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.

How do you update a file that I deployed to firebase hosting?

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.


1 Answers

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.

like image 141
Michael Bleigh Avatar answered Oct 22 '22 09:10

Michael Bleigh