Skip to content

Support multiple configurations in commands and target strings - #15819

Merged
vikerman merged 2 commits into
angular:masterfrom
filipesilva:multiple-configs
Oct 14, 2019
Merged

vikerman merged 2 commits into
angular:masterfrom
filipesilva:multiple-configs

Conversation

@filipesilva

Copy link
Copy Markdown
Contributor

It's now possible to use multiple configurations by separating them with a comma:

ng build --configuration=one,two,three

They will be applied from left to right. If --prod is also present, it will be considered to be the first configuration and thus able to be overriden.

You can also use it in target strings:

        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "latest-project:build:one,two"
          },
          "configurations": {
            "production": {
              "browserTarget": "latest-project:build:production,one,two"
            }
          }

Fix #10612

@filipesilva
filipesilva requested a review from clydin October 11, 2019 15:15
@filipesilva filipesilva added the target: major This PR is targeted for the next major release label Oct 11, 2019
@filipesilva
filipesilva force-pushed the multiple-configs branch 3 times, most recently from c67eb81 to 56e654a Compare October 11, 2019 16:02
let additionalOptions = {};

if (target.configuration) {
const configurations = target.configuration.split(',');

@clydin clydin Oct 11, 2019 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should trim the elements here in case someone does something like -c "one, two, three"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good idea. Added.

…eNodeModulesArchitectHost

Add support for parsing multiple configurations in a single string using comma as a separator.

This support is only at the host level (`WorkspaceNodeModulesArchitectHost` in this case) and does not change the underlying Architect API.

Different hosts are able to compose target options in different ways.
It's now possible to use multiple configurations by separating them with a comma:
```
ng build --configuration=one,two,three
```

They will be applied from left to right. If `--prod` is also present, it will be considered to be the first configuration and thus able to be overriden.

You can also use it in target strings:
```
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "latest-project:build:one,two"
          },
          "configurations": {
            "production": {
              "browserTarget": "latest-project:build:production,one,two"
            }
          }
```

Fix angular#10612
@vikerman
vikerman merged commit 65c2a19 into angular:master Oct 14, 2019
@ocombe

ocombe commented Oct 14, 2019

Copy link
Copy Markdown
Contributor

Omg that is amazing! Thanks a lot!

@robertjk

Copy link
Copy Markdown

Would be good to also update the documentation to mention that you can specify multiple configurations: https://angular.io/cli/build

@filipesilva

Copy link
Copy Markdown
Contributor Author

@robertjk PR for that up in angular/angular#33229

kara pushed a commit to angular/angular that referenced this pull request Nov 12, 2019
kara pushed a commit to angular/angular that referenced this pull request Nov 12, 2019
@angular-automatic-lock-bot

Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Nov 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

target: major This PR is targeted for the next major release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mixing configurations

6 participants