33# The script should immediately exit if any command in the script fails.
44set -e
55
6- # This script deploys the Cloud Functions of the screenshot tool to Firebase.
7- # Before deploying, the script installs all dependencies of the functions.
6+ # This script deploys the Screenshot Tool and their Cloud Functions to Firebase.
7+ # Before deploying, the script installs all dependencies of the functions and builds the app .
88
99# Go to the project root directory
1010cd $( dirname ${0} ) /../..
@@ -24,10 +24,18 @@ firebaseBin=$(npm bin)/firebase
2424# Go to the screenshot-test folder because otherwise Firebase tries to deploy the wrong project.
2525cd ${screenshotToolFolder}
2626
27- # Install node modules for the screenshot functions. Firebase CLI needs to execute the functions
27+ # Install node_modules for the application and afterwards build the application in production.
28+ (npm install; $( npm bin) /ng build --aot -prod) &
29+
30+ # Install node modules for screenshot-tool functions. Firebase CLI needs to execute the functions
2831# to collect all function names before it can deploy them.
29- (cd functions; npm install)
32+ (cd functions; npm install) &
33+
34+ # The screenshot application is being built asynchronously. Also the dependencies for the
35+ # Cloud Functions are built asynchronously. This means that the script needs to wait for all
36+ # async tasks to finish before proceeding.
37+ wait
3038
31- # Deploy the screenshot application and functions to Firebase
39+ # Deploy the screenshot application and their functions to Firebase
3240${firebaseBin} deploy --token ${MATERIAL2_SCREENSHOT_FIREBASE_DEPLOY_TOKEN} --non-interactive \
3341 --project material2-screenshots
0 commit comments