simondotm / nx-firebase

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

Deploy only changed Functions #239

Open ChazUK opened 1 month ago

ChazUK commented 1 month ago

Hi, I was wondering if it'd be possible to deploy only the functions that have changed.

I'm not sure how Nx would work on that level, unless each function had it's own tag in the dependency tree.

simondotm commented 1 month ago

If you have one firebase function project per exported cloud function, you could use nx affected eg.

nx affected -t deploy --tag=firebase:function

to deploy only changed firebase function projects

I believe the firebase CLI already does some hashing when it deploys? I found this comment:

The Firebase CLI has a functionality that skips functions that have not been modified, but that logic only runs when deploying all functions. When given instructions to deploy a specific function/set of functions, it assumes that you know best and skips the change detection logic.

Perhaps the way the plugin runs the deploy command needs to be checked to see if it allows this optimization. 🤔