Activity 16: Documentation of your Activity #15

Documentation: How I Deployed My Angular Project to Firebase

This document outlines the steps I took to deploy my Angular project (Activity #15) to Firebase Hosting.

Here’s what I did:

Step 1: Install Firebase CLI

First, I made sure I had Node.js installed on my computer. Then, I installed the Firebase CLI globally using npm:

npm install -g firebase-tools

Step 2: Log in to Firebase

Next, I logged in to my Firebase account from the terminal:

firebase login

Step 3: Initialize Firebase in My Project

  1. Go to My Angular Project Directory:
    I changed the directory to my Angular project by running:

     cd C:\Users\Teacher\AngularComponent
    
  2. Initialize Firebase:
    Navigate to your Angular project directory and initialize Firebase:

     cd C:\Users\Teacher\AngularComponent
    
     firebase init
    
    • Select Hosting when prompted.

    • Choose an existing Firebase project or create a new one.

Set the Public Directory

  1. Identify Your Project's Build Output Directory: If your Angular project is named Angular Component, your public directory (where the build files will be located) will usually be:

      dist/angular-component
    
  2. Continue with Configuration:

    • Single Page Application Configuration: I selected Yes when asked if I wanted to configure it as a single-page app.

    • Finish Initialization: I followed the prompts to complete the Firebase setup.

Step 4: Build Your Angular Project

If you're using Angular CLI version 18.2.7, you should use the --configuration flag for building your project and not this one: ng build --prod

Here’s how to proceed:

I built my Angular project using the --configuration flag, since I’m using Angular CLI version 18.2.7:

    ng build --configuration production

Step 5: Deploy to Firebase

Now, it was time to deploy my project to Firebase Hosting

    firebase deploy

Step 6: Access Your Deployed Application

Once the deployment is complete, Firebase will provide a hosting URL.

I can access my deployed Angular application at this link:

angularcomponent-master.web.app