Initializing firebase CLI Features in an existing Firebase project directory
Asked Answered
T

3

33

I am trying to add features "Hosting" into a Firebase project file which has already installed Functions.

So I want to know if I can do this with Firebase Init. or this will erase my existing firebase function. Is there anyway that I can do this without erasing my Firebase Functions.

And, in order to use firebase function, do I have to install Database as well? Or just Functions and Hosting.

Thank you.

Tantalizing answered 24/6, 2018 at 15:46 Comment(0)
U
22

The Firebase CLI will not overwrite files unless it asks you to. For each configuration file that it might overwrite, it will ask for confirmation. You can add new products to you project configuration with no problem. You can use each product independently.

You can verify all this for yourself by initializing a new project folder and testing it out your concerns separately from your existing project folder. As long as you don't deploy anything, no changes will be made to your project hosted in Firebase.

Universal answered 24/6, 2018 at 16:27 Comment(2)
Thank you! The new CLI feature is added without erasing any data!Tantalizing
What if you do deploy, will one setup overwrite the other? For instance if you 1 project and 2 project folders, with function A in one folder and function B in the other and you deploy the one with function A and then the one with function B... will you have both functions in the project or only function B?Endgame
T
74

I feel that the accepted answer does not satisfy the question.

To initialize more features on the firebase project, type the command

firebase init [feature]

In my scenario, i had started firebase functions and needed to add the hosting, so my case was to type firebase init hosting. Firebase will proceed and start the feature with all configurations of the current project

enter image description here

Tedi answered 28/11, 2018 at 17:39 Comment(1)
This ans satisfy the question. I wanted to know how to add extra feature to existing firebase project. will firebase init will overwrite the existing setup or add the new features.Schizopod
U
22

The Firebase CLI will not overwrite files unless it asks you to. For each configuration file that it might overwrite, it will ask for confirmation. You can add new products to you project configuration with no problem. You can use each product independently.

You can verify all this for yourself by initializing a new project folder and testing it out your concerns separately from your existing project folder. As long as you don't deploy anything, no changes will be made to your project hosted in Firebase.

Universal answered 24/6, 2018 at 16:27 Comment(2)
Thank you! The new CLI feature is added without erasing any data!Tantalizing
What if you do deploy, will one setup overwrite the other? For instance if you 1 project and 2 project folders, with function A in one folder and function B in the other and you deploy the one with function A and then the one with function B... will you have both functions in the project or only function B?Endgame
C
0

Type firebase init in existing firebase project and select a feature (press spacebar) that you want to add .

Cosher answered 12/12, 2022 at 6:15 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.