【发布时间】:2021-03-22 21:03:32
【问题描述】:
当我运行 firebase deploy 时,我正在寻找一种排除某些 firebase 功能的方法。但是我想在运行模拟器时保留这些功能。
当我使用颤振驱动程序执行集成测试,并且我的应用程序连接到模拟器时,我需要一些方法来从我的测试脚本更改 firestore 中的数据。我可以使用 http 包调用的 firebase 函数将是一个很好的方法。但这些仿真器特定功能不得部署到生产环境中。我知道我可以使用--only 标志,当我运行firebase deploy 来指定所有功能时,我想部署。但这有点麻烦。我不想每次都写下我要部署的所有功能的名称。
我知道,我的 firebase.json 中的函数键可以与“忽略”字段一起使用。但我无法弄清楚它是如何工作的。在 src/index.ts 文件中导出的所有函数(编译到 lib/src/index.js)都已部署。那么忽略键是如何工作的呢?我试着这样使用它:
{
"functions": {
"source": "functions",
"ignore": [
"**/node_modules/**",
"**/src/emulator/**"
]
}
}
但这会导致部署错误。
【问题讨论】:
标签: typescript firebase google-cloud-functions firebase-tools