Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I see what files are deployed to Firebase hosting? [duplicate]

Tags:

I need to pull down my code from a firebase hosted site, I created a site this past summer and no longer have the code locally on my laptop. I would like to recode some of the pieces, but don't have the source code anymore (other than the javascript and css I can glean from the served pages). I can't find a way to get the code from the firebase site, does anyone have any ideas?

like image 706
Randal Wilcox Avatar asked Oct 09 '14 19:10

Randal Wilcox


People also ask

How do I check my Firebase Hosting files?

Its quite simple,the only thing you need to do is go to your hosted site. right click and go to inspect element => debugger. There you will find a static folder.

How to edit Firebase Hosting?

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.

Which command is used for deploying a Firebase hosted application?

Using the Firebase CLI, you deploy files from local directories on your computer to our Hosting servers. Beyond serving static content, you can use Cloud Functions for Firebase or Cloud Run to serve dynamic content and host microservices on your sites.


2 Answers

You should of course add your own version control (e.g. git) to manage your revisions and backups so this doesn't occur.

There is a script you can run to download all the assets using the CLI. You can find the script and instructions here. It can also be run using npx:

npx https://gist.github.com/mbleigh/9c8680cf319ace2f506f57380da66e7d <site_name> 

Note that this only returns the compiled/rendered content from the specified public folder and not any precompiled source you may have had on the development machine.

Since your files are static assets, you could also scrape them using wget. This is inferior for advanced apps as you'll get the rendered content and not the source:

wget -r -np https://<YOURAPPNAME>.firebaseapp.com 

Read more on scraping web sites here: https://apple.stackexchange.com/questions/100570/getting-files-all-at-once-from-a-web-page-using-curl

like image 197
Kato Avatar answered Sep 28 '22 01:09

Kato


Maybe this answer is not exactly consisted with requested direction but in order to list the files which are being uploaded you could during the deploy use --debug switch:

firebase deploy --debug 

With this option you will see the POST request. Something like that:

>>> HTTP REQUEST POST https://deploy.firebase.com/firebase/yourapp/releases?token=XXX public=dist, version=-KE5UDaj7oCppckjEBaE, prefix=-KE5UDaj7oCppckjEBaE/, manifest=[path=404.html, object=404.html, path=scripts\main\main.html, object=scripts\main\main.html, path=scripts\scripts.d6106dbd.js, object=scripts\scripts.d6106dbd.js, path=scripts\vendor.68cdc83b.js, object=scripts\vendor.68cdc83b.js, path=styles\main.5b335e2d.css, object=styles\main.5b335e2d.css, path=styles\vendor.d41d8cd9.css, object=styles\vendor.d41d8cd9.css], rules=undefined <<< HTTP RESPONSE 200 server=nginx, date=Wed, 30 Mar 2016 07:46:31 GMT, content-type=application/json; charset=utf-8, content-length=34, connection=close, access-control-allow-origin=*, access-control-allow-methods=GET, PUT, POST, DELETE, OPTIONS, strict-transport-security=max-age=31556926; includeSubDomains; preload, x-content-type-options=nosniff

It might helps to trace what is rally uploaded to firebase hosting.

But I agree that the lack option to simple list the files on firebase hosting do not encourage to use this service.

like image 37
Przemek Nowak Avatar answered Sep 28 '22 01:09

Przemek Nowak