[英]firebase deploy: how to modify pre-deploy
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
.我有一个在 firebase 托管上运行 javascript 的小型前端项目,每次运行
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.所以我一直在寻找一种将其放入预部署脚本的方法,但 firebase CLI 文档中没有这样的东西。 So anyone has any idea how to make it done?
那么有人知道如何完成吗?
Predeploy supports in latest Firebase CLI, please update your CLI and create predeploy
in firebase.json
file.预部署支持最新的 Firebase CLI,请更新您的 CLI 并在
firebase.json
文件中创建predeploy
。
"hosting": {
"predeploy": "npm run build",
"public": "build",
There is documentation for predeploy hooks with the Firebase CLI.有关于使用 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.
对于您可以部署的任何资产(托管、函数、数据库、存储和 firestore),您可以在 firebase.json 中添加部署前和部署后挂钩,您的脚本将使用相应的部署命令运行。 Both predeploy and postdeploy hooks print the standard output and error streams of the scripts to the terminal.
predeploy 和 postdeploy 挂钩都将脚本的标准输出和错误流打印到终端。
For example:例如:
{
"hosting":{
"postdeploy":"./messageSlack.sh 'Just deployed to Firebase Hosting'",
"public":"public"
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.