Closed FrozenPandaz closed 3 years ago
cc @kirjs + @mgechev
This makes sense. Maybe call the option environment?
The advanced use case in the More Thoughts section we can plan in the future.
I have started a discussion here about this topic. It would be great if we could find a common approach so that the expected behaviour and usability of the different builders are consistent.
Currently, there could be a majority for the following options:
--configuration
(alias -c
): A named build target, as specified in the "configurations" section of angular.json--no-build
: Skip build process during deployment--configuration
sounds good. I also find it coherent with the other CLI commands.
--no-build
makes sense as well for advanced use cases.
In the CLI, this same option is called browserTarget
/ serverTarget
.
configuration
is misleading as it might be confused with configurations
, I opt for buildTarget
.
"deploy": {
"builder": "@deploy:deploy-builder",
"options": {
"buildTarget": "project:browser"
},
"configurations": {
"staging": {
"buildTarget": "project:browser:staging"
}
}
},
Example
ng deploy --configurations staging
@alan-agius4 safe to close this?
Looks like it was addressed by https://github.com/angular/angularfire/issues/2063.
So this can be closed.
When I do a deployment to staging, I need two things to happen
.firebaserc
PR https://github.com/angular/angularfire/issues/2063 only covers 1 as far as I can tell. Is there any solution for 2?
The deploy docs are out dated and low on details.
For now, it seems to always pick the first entry in the .firebaserc
"targets": {}
node. So you can swap those each time you want to change between production/staging.
But that's too fragile, so I'm just going to use something like the following and avoid ng deploy
for now
"deploy": "npm run build:staging && firebase use staging && firebase deploy --only hosting",
"deploy:prod": "npm run build:prod && firebase use production && firebase deploy --only hosting",
Just a heads up - I submitted a PR to allow configuring the firebase project deploy target as well. These can be actual projects or aliases you set up via the CLI or .firebaserc
. There's an issue preventing the use of multiple configurations at the moment, so ng deploy myApp --configuration production
does not yet work.
When I do a deployment to staging, I need two things to happen
- Build my "staging" configuration in `projectname:build:staging"
- Deploy to my staging target in
.firebaserc
PR #2063 only covers 1 as far as I can tell. Is there any solution for 2?
The deploy docs are out dated and low on details.
And to finally make this possible, I've made a bug/feature request at the CLI end: https://github.com/angular/angular-cli/issues/17332
This is to enable using the --configuration=production
flag, or any environment you wish, that will set the buildTarget and firebaseProject options respectively.
Seems like this is now implemented? https://github.com/angular/angularfire/blob/c57cef4a0d08f7df43754a30c18d707d1806cbd0/src/schematics/deploy/schema.json#L7
More options dropped in 6.1.0-rc.1
, we should have this covered now.
Current Behavior
Right now, the
@angular/fire:deploy
builder infers the build target to betargetProject:build:production
. This makes it impossible to deploytargetProject:build:staging
which may have different environment variables etc.Expected Behavior
Option 1
Add an option for
buildTarget
so that the fulltargetProject:build:staging
can be passed in and scheduled.Personally, since schematics can generate the config via
ng add
orng generate
, I would opt for this one.Option 2
Add an option for
configuration
so thatstaging
can be passed in andtargetProject:build:staging
can be scheduled.More Thoughts
Inferring the build target is okay, but I would rather not schedule anything at all if I leave it blank so a user can build separately ahead of time in the case Firebase Functions are someday supported. :)
Caveat
This configuration information might be important for knowing which Firebase project/ target to deploy to. This might be better done in a separate option.