Skip to content

Instantly share code, notes, and snippets.

@IchordeDionysos
Last active July 18, 2019 09:28
Show Gist options
  • Save IchordeDionysos/51f86e8cd93851319651b959803ac04e to your computer and use it in GitHub Desktop.
Save IchordeDionysos/51f86e8cd93851319651b959803ac04e to your computer and use it in GitHub Desktop.
Demonstrates the problem when deploying functions of different repos to the same project
echo "Trying this out on Firebase version:"
firebase --version
echo "We are setting up a demonstration project"
mkdir demonstration
cd demonstration/
echo "Please select Javascript and no eslint and to install using npm"
firebase init functions
echo "Creating two sample functions"
echo "const functions = require('firebase-functions')" >> functions/functions1.js
echo "exports.helloWorld1 = functions.https.onRequest((request, response) => {response.send('Hello from 1')})" >> functions/functions1.js
echo "const functions = require('firebase-functions')" >> functions/functions2.js
echo "exports.helloWorld2 = functions.https.onRequest((request, response) => {response.send('Hello from 2')})" >> functions/functions2.js
echo "Deploying both sample functions"
rm functions/index.js
echo "const functions1 = require('./functions1')" >> functions/index.js
echo "const functions2 = require('./functions2')" >> functions/index.js
echo "Object.assign(exports, functions1)" >> functions/index.js
echo "Object.assign(exports, functions2)" >> functions/index.js
firebase deploy --non-interactive
echo "Deploying only one sample function, which will fail as the script is NON-interactive"
rm functions/index.js
echo "const functions1 = require('./functions1')" >> functions/index.js
echo "Object.assign(exports, functions1)" >> functions/index.js
firebase deploy --non-interactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment