I have a small front-end project with javascript running on firebase hosting and I have to call the build script manually before every time I run firebase deploy
. So I was looking for a way to put it in a pre-deploy script but there's no such thing in firebase CLI documentation.
So anyone has any idea how to make it done?
2 Answers
Predeploy supports in latest Firebase CLI, please update your CLI and create predeploy
in firebase.json
file.
"hosting": {
"predeploy": "npm run build",
"public": "build",
-
1
-
1Interesting... I am trying to use this to build a different flavour of the app (to deploy it to different environments)... it runs my custom pre-deploy build command... but then it ALSO runs the standard one which overrides the former... not sure how to fix this. May 3 at 11:45
There is documentation for predeploy hooks with the Firebase CLI.
For any of the assets you can deploy—hosting, functions, database, storage, and firestore— you can add predeploy and postdeploy hooks in firebase.json, and your scripts will run with the corresponding deployment command. Both predeploy and postdeploy hooks print the standard output and error streams of the scripts to the terminal.
For example:
{
"hosting":{
"postdeploy":"./messageSlack.sh 'Just deployed to Firebase Hosting'",
"public":"public"
}
}
-
oh there it is, don't know why it does not appear in the search result. thank you very much Feb 27, 2018 at 8:40