ngx-rocket / generator-ngx-rocket

:rocket: Extensible Angular 14+ enterprise-grade project generator
https://ngx-rocket.github.io/
MIT License
1.53k stars 218 forks source link

feat: add environment options (DTAP) #552

Open fabiomartino opened 4 years ago

fabiomartino commented 4 years ago

Added ability to generate common environments architecture for deploy.

D development : environment.ts (already by default) T testing: environment.testing.ts (script generated) A acceptance: environment.acceptance.ts (script generated) P production: environment.prod.ts (already by default)

We can choose via script prompt if add or not those environments (default to ### NO) image

Cordially Fabio

sinedied commented 4 years ago

Thanks @fabiomartino for this proposition!

Though I'm not sure this is something we want to push in the main generator, as this is something that gets very different depending of the team/project from my own experience. Sometimes you only want an additional staging environment, sometimes the environment have different names, sometines DTAP is completely disregarded as an outdated approach.

That said, I'm not necessarily against merging this, but I would love to hear what other folks thinks about this? @creal73 @captaincaius @bursauxa any opinions?

Also if we're going to merge this, I think we should later group this question with other "architecture" related questions like lazy-loading & PWA to reduce the total number of prompts.

creal73 commented 4 years ago

I do agree with you @sinedied.

What about creating it as an addon instead ?

isaax2 commented 4 years ago

I had already to do that in another project, because when you work, for example with firebase/ firebase-functions, you need at least 3 environments.

environment.ts -> local firebase emulator (development) environment.qa.ts -> firebase config to test the entire app in the cloud.(QA) environment.prod.ts -> firebase config production. (Prod)

image

local image

QA image

Prod image

ToFab commented 3 years ago

This would solve a major pain point for us as our release cycle has the DTAP setup. Currently, our build script modifies the environment.ts file before deployment to each environment. This would remove the need for that work around.

sinedied commented 3 years ago

@ToFab you can always add as many environments as you need in a project, there's no need for such a script: https://angular.io/guide/build#configuring-application-environments

To be clear, this PR would do this by default for new project, but you always had the option to add more environments after the project is generated.