Skip to content

Instantly share code, notes, and snippets.

@torresalmonte
torresalmonte / README.md
Created November 19, 2019 18:03 — forked from puf/README.md

Firebase Hosting Deploy Single File

This utility script deploy a single local file to an existing Firebase Hosting site. Other files that are already deployed are left unmodified.

The difference with firebase deploy is that this script does not require you to have a local snapshot of all hosted files, you just need the one file that you want to add/update.

USE AT YOUR OWN RISK. NO WARRANTY IS PROVIDED.

Fetch All Files from Firebase Hosting

This script fetches all of the files from the currently deployed version of a Firebase Hosting site. You must be signed in via the Firebase CLI and have "Site Viewer" permission on the site in question to be able to properly run the script.

Running via NPX

npx https://gist.github.com/mbleigh/9c8680cf319ace2f506f57380da66e7d <site_name>
const functions = require('firebase-functions');
const admin = require('firebase-admin');
const axios = require('axios');
admin.initializeApp();
async function adminAuthEmailRequest(request) {
var token = await admin.apps[0].INTERNAL.getToken();
var requestCopy = JSON.parse(JSON.stringify(request));
requestCopy.headers = requestCopy.headers || {};
var authHeader = 'Authorization';