Open jthegedus opened 5 years ago
an interesting idea, but I'm not sure it's one we'd tackle right away. PRs are always welcome, though!
Can you describe the contents of the firebase.json
files in your monorepo? Typically I would expect a single firebase.json
at the root of the structure and a single .firebaserc
to go along with it. More info about your project structure would help me understand the use case :smile:
This is feature request is just a matter of convenience, not pressing at all.
More info about your project structure would help me understand the use case
Can you describe the contents of the firebase.json files in your monorepo?
Can you describe the contents of the
firebase.json
files in your monorepo? Typically I would expect a singlefirebase.json
at the root of the structure and a single.firebaserc
to go along with it. More info about your project structure would help me understand the use case 😄
Here's a relevant use case I'm currently working with:
For a mono-repo that contains multiple firebase projects, I want to be able to robustly protect against a potential developer error of accidentally deploying the wrong functions to an incorrect target firebase project, which is tricky because it's only possible to have one .firebaserc
file at the moment.
Further details:
In my (Nx) mono-repo workspace I've got multiple firebase projects in play - 2 separate firebase functions "applications" (project1 and project2), each with two environments (dev + prod), so 4 firebase projects all together - lets call them: project1-dev
, project1-prod
, project2-dev
, and project2-prod
.
All 4 firebase projects are set in the .firebaserc
file in the workspace root as aliases with the same names.
Each of my two applications has its own firebase.<projectname>.json
config in the root, which I can use to deploy as follows:
For project1:
firebase deploy -P project1-dev --config firebase.project1.json --only functions
OR
firebase deploy -P project1-prod --config firebase.project1.json --only functions
For project2:
firebase deploy -P project2-dev --config firebase.project2.json --only functions
OR
firebase deploy -P project2-prod --config firebase.project2.json --only functions
The significant risk here is that one day, a developer (possibly me!) might accidentally do this:
firebase use project1-dev
firebase deploy --config firebase.project2.json --only functions
Which is potential disaster because we've got project2's functions being deployed to project1, possibly overwriting existing functions. The CLI might warn "some functions exist on the cloud not in your project" etc. but if there are similar named functions it might not.
I'm not sure yet if making .firebaserc
tree relative (as per OP suggestion) will solve my specific issue.
However, in my case, being able to specify a .firebaserc
file in the firebase.json
config (or possibly even as a CLI parameter) would be helpful also. This way we have some means to prevent deployment to an invalid target in scenarios where there are multiple firebase projects in play.
It would be great if the logic for loading the
.firebaserc
looked up the directory tree similar to read-pkg-up.This would save having to copy
.firebaserc
files across service folders in monorepo architectures.currently:
what this would allow:
Related code: