How to create angular library using Angular 12 -part 4

Gangadhara Sirigeri Mathada
3 min readJun 14, 2021

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 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.

Create a project

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 1: Name for the project

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 2: Enable or disable Google Analytics

Step 3: Configure Google Analytics by selecting default account for firebase from the dropdown field and click on create project.

Step 3: Configure Google Analytics
Choose or create a Google Analytics account

After click on create project button, firebase will take few minutes to create the project.

Crated angular-lib-app

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.

Firebase cli tool installed

Firebase login

Open the command prompt/git bash to run following command:

firebase login

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.

Logged into firebase

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:

Firebase initialize

Deploy the App on Firebase

Deploy the app by running following command:

firebase deploy
Deploy the App on Firebase
Hosted application

This confirms that our application working fine.

In next section will see how to create npm account, and publish the library in npm.

Source Code

Download here