samedi 26 décembre 2020

Firebase deploy to another site

I am using Firebase Hosting to deploy my app

enter image description here

As you can see, I have 2 apps: clone-a50db and clone-eeb88 and the app clone-eeb88 is already in use, so now I want to deploy my app to the other which is clone-a50db.

This is how I did:

firebase init
? Are you ready to proceed? Yes
? Which Firebase CLI features do you want to set up for this folder? Press Space to select features, then Enter to confirm your choices. Hosting: Configure and deploy Firebase Hosting sites` 

=== Project Setup

First, let's associate this project directory with a Firebase project.
You can create multiple project aliases by running firebase use --add,
but for now we'll just set up a default project.

i  .firebaserc already has a default project, using clone-eeb88.

=== Hosting Setup

Your public directory is the folder (relative to your project directory) that
will contain Hosting assets to be uploaded with firebase deploy. If you
have a build process for your assets, use your build's output directory.`

? What do you want to use as your public directory? build
? Configure as a single-page app (rewrite all urls to /index.html)? Yes
? Set up automatic builds and deploys with GitHub? No
+  Wrote build/index.html

i  Writing configuration info to firebase.json...
i  Writing project information to .firebaserc...

+  Firebase initialization complete!`
npm run build
firebase deploy --only hosting` (because I already deployed function in advanced)

It worked but instead of deploy to clone-a50db, it deployed to clone-eeb88, it is feasible because it is using default project which is clone-eeb88 as it told in the setup, please tell me how to switch my site, thank you so much and happy new year

firebase.json

{
  "hosting": {
    "public": "build",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  },
  "functions": {
    "predeploy": [
      "npm --prefix \"$RESOURCE_DIR\" run lint"
    ],
    "source": "functions"
  }
}



Aucun commentaire:

Enregistrer un commentaire