simondotm / nx-firebase

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

Support -P option in deploy targets #23

Closed simondotm closed 3 years ago

simondotm commented 3 years ago

Multi-project workspaces need extra care when using deploy without switching to the correct firebase project target first (firebase use <target> or firebase deploy -P <target> Worst case scenario is that the wrong things might be deployed to the wrong target.

We can improve this by adding -P to the deploy target.

Either document suggestion to add -P manually, or support some way to set the firebase target on an apps' deploy target

simondotm commented 3 years ago

It might be a good idea to add a top level option to the app that is an array of allowed serve/deploy project aliases for this app. In this way maybe we can do something intuitive like: nx deploy app will use the default/first project alias as a --project deploy target nx deploy:<alias> app will use the given project alias as a --project deploy target (as long as it is one of the aliases listed in the app options)

Something like this would be useful for CI/CD also, since we could use affected builds to deploy specific targets (since predeploy performs necessary builds) eg:

nx affected:build && nx affected:deploy:prod

simondotm commented 3 years ago

Note: look into configurations support in the executors, seems like a more Nx built-in way to override options

eg.

                "deploy": {
                    "builder": "@nrwl/workspace:run-commands",
                    "options": {
                        "command": "firebase deploy --project fbproject-dev --config firebase.fbproject.json"
                    },
                    "configurations": {
                        "production": {
                            "command": "firebase deploy --project fbproject-prod --config firebase.fbproject.json"
                        }
                    }

                },
simondotm commented 3 years ago

Not going to support this. I want to keep targets simple in their functions, and let users customize. I've happily customized deploy target for my own apps to set the --project and --config options as above and it works pretty intuitively.