How to deploy static files only to firebase hosting - firebase

I am just trying to create a static landing page for my app with firebase hosting. The first time initialized and deployed the site it worked fine, but now that I am trying to tweak the design a little bit and upload better images, somehow my index.html file keeps getting overwritten with code that I do not need, I believe it is the firebase default index page which they create when you first set up a projext. I have tried it three times now and it keeps happening, and each time I have to recreate all the edits.
How do I simply deploy static files without all the extra code overwriting the page?
I cd into the folder containing my site, the public folder, and run firebase init, chose only hosting, then chose no for one page app, then no for the git deploy scripts, then run firebase deploy --only hosting --project (my project)
Each time, my index file gets erased and replaced with a firebase spontaneously created file.
I have searched the firebase docs and can find no explanation.
Please help

Try just running the firebase deploy command. If you run the firebase init command the first time and select the project, and make the public folder, then you should only have to run that command once. cd into the folder, and then just run firebase deploy.

Related

Fireabase CLI Stop reuploading all function folder?

How can I make Firebase CLI to not re-upload all the files located in the function directory ?
I have really slow internet connection and modifying an minor bug in function code makes the whole folder/directory to re-upload which 40MB which is taking 25 minutes to upload.
This is not bearable for every code change that I make and can't use emulator because I am trying to learn storage changes function.
How can I speed up this process ?
You can deploy function which you have changed by this command
$ firebase deploy --only functions:YOUR_FUNCTION_NAME
The Firebase CLI will always upload the entire contents of the functions folder, except for node_modules, which will be rebuilt by Cloud Functions using your package.json. There is no way to change this behavior.
You should look into your options to test locally, so you don't have to go through the process of deploying each time you want to test a change.
https://firebase.google.com/docs/functions/local-emulator
https://firebase.google.com/docs/functions/local-shell

Can I regenerate the amplify file team-provider-info.json?

I have an amplify react app with resources pushed to cloud. Unfortunately, when I went to commit I removed the team-provider-info.json without backing it up. I have every other file that originated with amplify in my local project. Can I regenerate team-provider-info.json without starting over? There is no information about that process here: https://aws-amplify.github.io/docs/cli-toolchain/quickstart#teamprovider
There is 2 ways you can generate (that I am aware of).
Firstly you need to view the stack within the cloudformation dashboard of AWS console.
Click the root stack of the environment you need to fix, then click the outputs tab.
This will list you a whole bunch of values to fill the cloudformation vales within the team provider json file.
You can either:
1. Regen the file by running this script in your terminal https://aws-amplify.github.io/docs/cli-toolchain/quickstart#environment-related-commands Or
2. Copy and paste the values into an existing team-provider-info.json file, however for the environment that needs fixing.
Sample outputs tab in cloudformation dashboard
You can simple copy amplify project without team-provider-info.json in an other local directory and execute amplify push in this directory. After login with the same aws account you can choose what Application to clone from the clouds. This will rename your amplify folder to amplify-tmp and generate fresh amplify folder with team-provider-info.json for the choosen Application. You can copy team-provider-info.json in the original project dir or work with new one.

How long it takes for a firebase hosting to work?

I followed the instructions, and deployed a simple web yesterday. At first, it kept showing the default website, saying " you've deployed successfully...", not my web.
Also, the 'firebase open' command + "Hosting: Deployed Site" leads to a undefined site:' undefined.firebaseapp.com '.
But, magically, about an hour later when I open the link from 'firebase console' again, the web showed up... I am not sure whether 'firebase open' command worked cause I didn't try.
Today, I added some features, and deployed again. In the firebase CLI, it said deployed. But, the link still showed the old version.
I'll catch up an hours later to see whether it works, but even it works, it takes too long.
has anyone had the same experience? what's wrong with my web?
Thanks.
This is how I solved this issue for my angular 7 app deployment on Firebase hosting:
ng build --prod
go to dist/myproject and run command Firebase init and...
I went to dist/myproject that now contain build files along with Firebase related files. Copy all files except Firebase related files to dist folder in side dist/myproject.
there you will get overwrite warning just select overwrite option.
after copy process completes, run command Firebase deploy.
after completion of process go to shown URL and there you will find your running app.

Why does firebase warn "* You are currently outside your home directory" during an init?

I am trying to deploy my first firebase app. I am getting the message "* You are currently outside your home directory" I googled it and found this reply
"commented on Dec 6, 2016
Just to make sure you're aware. If someone is experiencing the same problem with with the command firebase init
Make the files .firebaserc and firebase.json manually and the deploy should work normally."
I do not know where to create them or what the should contain.
I have also gone to https://www.npmjs.com/package/firebase-tools to try to fix this problem.
If any one can help with this problem I would appreciate it.
If anyone else worried about this just keep going. I continued with the deployment and it deployed OK.
download firebase CLI binary (in case you didn't download it yet. this is an .exe file if you use windows).
copy the downloaded file into your project's root folder (Folder which contains all the files and folders of your projects).
run the firebase-tools-instant-win_2.exe (firebase CLI binary).
a command window will open.
execute all your command in there.
Initialize a Firebase project
Many common tasks performed using the CLI, such as deploying to a Firebase project, require a project directory. You establish a project directory using the firebase init command. A project directory is usually the same directory as your source control root, and after running firebase init, the directory contains a firebase.json configuration file.
To initialize a new Firebase project, run the following command from within your app's directory:
I used firebase init project in my project's directory to get it to work

How to update a file that I deployed to Firebase Hosting?

On deploying my app to Firebase, I am getting this message:
You're seeing this because you've successfully setup Firebase Hosting. Now it's time to go build something extraordinary!
I learnt from a previous post that I need to replace the default index.html with my custom index.html. How do I do that using the Firebase Console?
You cannot change hosted files in the Firebase Console.
Instead, you should change the index.html on your local copy where you initially ran the firebase deploy command. Once you're done with the changes, run firebase deploy again to push the updated version of your website to Firebase Hosting.
For small changes it is probably faster to run firebase serve. This spins up a local web server, so that you can test the changes. Once you're satisfied they work, publish them to Firebase Hosting with firebase deploy again.
Update: this is now possible through some custom scripting. See my answer here for details: Upload single file to firebase hosting via CLI or other without deleting existing ones?
Simply make the changes you want to and then type
npm run build
After this spin the server again using
firebase deploy
The changes you want will be updated.
You can also see the updated changes with the command
firebase serve
and then run firebase deploy when you're satisfied.
First of all Update all the coding and assets files in your local system then,
1) Go to the directory in the terminal by typing $ cd {add your directory}
2) Login on your terminal console by typing $ firebase login in the terminal
3) after login write $ firebase deploy
then, go to Hosting Section in your Firebase Console and delete the previously deployed files by deleting the previously added section in {Poject_Name} release history,
like this
enter image description here
Its a simple solution. This message is caused by the index.html file in your public folder being replaced with the index.html file provided by firebase.
All you have to do is navigate to the directory of your web app folder on your terminal and type in
$ rm .firebaserc
then
$ firebase init
after you've completed the firebase initialization, replace the new index.html file with the one inside the public folder and then type
$ firebase deploy

Resources