Skip to content

Support multiple configurations in commands and target strings #15819

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 14, 2019

Conversation

filipesilva
Copy link
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(',');
Copy link
Member

@clydin clydin Oct 11, 2019

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
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
Copy link
Contributor

ocombe commented Oct 14, 2019

Omg that is amazing! Thanks a lot!

@robertjk
Copy link

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

@filipesilva
Copy link
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

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