simondotm / nx-firebase

Firebase plugin for Nx Monorepos
https://www.npmjs.com/package/@simondotm/nx-firebase
MIT License
175 stars 31 forks source link

getconfig produces broken config #164

Open ciriousjoker opened 8 months ago

ciriousjoker commented 8 months ago
  1. Deleted any previous configs just to be sure.
  2. Command used: npx nx run firebase:getconfig
  3. Result: CleanShot 2023-10-23 at 02 41 09@2x

Easy fix for a human though, so low priority.

context: I'm using VSCode's inline terminal, but this shouldn't matter

simondotm commented 7 months ago

@ciriousjoker This is a good one. Thanks for reporting.

It's been a while since I used function configs (and probably in a much older 13.x era version of Nx before they added the fancy console output), so I haven't used it myself lately.

So the problem is that any kind of pipe of output in an nx run captures the Nx console stdout also. nx -q run quiet mode is no use because it suppresses everything.

I dont see any other way to be able to capture command output to a file in Nx.

I note your PR comment about preserving --config & --project for firebase CLI, which ideally we want to do, so the best solution I can think of is to:

  1. Don't try to pipe output direct to the .runtimeconfig file, instead:
  2. Log the JSON to stdout, and prompt with echo for user to copy that JSON to their .runtimeconfig file instead
simondotm commented 7 months ago

On a related note, I believe the general trend for Firebase is going to be sunsetting function configs and moving to environment vars instead. They already state that v2 cloud functions do not support function configs.

This isn't ideal, as I was toying with using function configs on a personal project just last week to dodge the secrets billing (only 6 for free, Google? come on!). And yeah I know its cheap, but so am I. 😅

But, no can do, because I'm using v2 cloud functions.

End of side track.

ciriousjoker commented 7 months ago

Yes, V2 Cloud functions use a different way of managing configs, but for older projects, a working runtimeconfig is probably better than one for the correct NX project, bit broken. Therefore I'd personally still merge it, but aside from that idc since on our project this is solved manually anyway :)

simondotm commented 7 months ago

Yeah, life is never that simple for plugin dev though because we have to be mindful of user experience and migration paths etc. No biggie, just part of the process. I'll take a look at this soon.

mackelito commented 5 months ago

Any progress on this?