How to create angular library using Angular 12 -part 4
In this section, we will see how to deploy angular application including angular library to firebase hosting using firebase cli tools.
Firebase account creation
To deploy your angular application to firebase hosting, you need to have an account on the firebase website https://console.firebase.google.com. Firebase expects Google account for login. If not create the Google account and login.
Create a project
Once done with the firebase account creation, now create Firebase project by clicking on the Create a project or Add Project button.
Once you click on create a project or Add project button, then you need to follow three step process to create a project.
Step 1: Provide a unique name for your Firebase project. In my case, I have named it as angular-lib-app. then click on continue for step 2.
Step 2: Enable or disable Google Analytics for your Firebase project. By default enabled so click on continue. If you don't want Google Analytics for your project, disable the analytics then click on continue.
Step 3: Configure Google Analytics by selecting default account for firebase from the dropdown field and click on create project.
After click on create project button, firebase will take few minutes to create the project.
Install Firebase CLI Tools
The Firebase Command Line Interface (CLI) Tools can be used to test, manage, and deploy your Firebase project from the command line. Install the Firebase CLI using npm. To download and install the Firebase CLI run the following command:
npm install -g firebase-tools
“-g” will provide you with the globally accessible firebase command.
Open the command prompt/git bash to run following command:
This command will open the Firebase login in the default browser for you to login so that we can work on our Firebase project from our machine using firebase tools CLI.
Initialize your Firebase project
Before initializing the firebase to your project, build your project using following command
ng build --project=my-app
Run the following command from the root of your local app directory:
Deploy the App on Firebase
Deploy the app by running following command:
This confirms that our application working fine.
In next section will see how to create npm account, and publish the library in npm.