Showing the active Firebase project in the command line
If you are working on a project where Firebase is used, most likely you have a separate project created for each environment (dev
, staging
, prod
, sometimes maybe even more). During the development, it often happens that you need to configure something using Firebase CLI. Whenever you intend to make a change you want to make sure the right project is set as active. This can be verified easily by running
$ firebase use
which returns something like this
This is good, but the command itself is a bit slow and also you might easily forget to run the command and verify the active project. Then it can happen that you start deploying your temporary testing version of a cloud function to the production environment (!!!). After immediately canceling the script and getting over a little panic attack I knew this cannot happen again. At this point, I decided to create a little helper utility that would always show the currently selected project in the command line if you are in the project directory.
When you install firebase-tools
it creates a configuration file ~/.config/configstore/firebase-tools.json
which apart from…