feat(@schematics/angular): add environments generation schematic#24409
Conversation
alan-agius4
left a comment
There was a problem hiding this comment.
Couple of comments. Otherwise this looks good.
b5031cd to
fb46369
Compare
A schematic has been added that will allow the generation of environment files for all existing configurations within a project. The `fileReplacements` option will also be setup to allow the replacement of the appropriate environment file. Environment files themselves do not provide any special behavior beyond that of other application TypeScript files and rely on the `fileReplacements` option for build-time behavior. The schematic will skip generating environment files for configurations that already have an appropriately named environment file. The `fileReplacements` option addition will also be skipped if an appropriate entry is already present.
fb46369 to
32526d5
Compare
|
@clydin Could you please share on how to use your schematics to add env files. thank you in advance |
|
Description updated with an example usage. |
Your example does not work. "ng generate environments". I guess I will be using a service. |
|
It will be available in 15.1.0 which is currently in prerelease (available via the |
|
@clydin Great job … For simpler apps environment.ts and *.prod.ts was a good & simple solution to provide global vars like api url, … thanks a lot 👍 |
|
Somewhere along the line whole environments thing stopped working. In angular 8 I used to have one for development, staging and production. And had corresponding fileReplacements in angular.json. Doing ng build --configuration=staging would copy the environment.staging.ts into the dist/environments/environment.ts file. That no longer works in Angular 14. How do I accomplish the same thing with Angular 14? |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
A schematic has been added that will allow the generation of environment files for all existing build configurations within a project. The
fileReplacementsoption will also be setup to allow the replacement of the appropriate environment file. Environment files themselves do not provide any special behavior beyond that of other application TypeScript files and rely on thefileReplacementsoption for build-time behavior. The schematic will skip generating environment files for configurations that already have an appropriately named environment file. ThefileReplacementsoption addition will also be skipped if an appropriate entry is already present.Example usage:
ng generate environmentsCloses #24381