Skip to content

Documentation missing for new angular.json schema #10972

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

Closed
narthur157 opened this issue May 23, 2018 · 8 comments
Closed

Documentation missing for new angular.json schema #10972

narthur157 opened this issue May 23, 2018 · 8 comments

Comments

@narthur157
Copy link

Versions

$ ng --version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 6.0.3
Node: 8.9.4
OS: win32 x64
Angular: 6.0.3
... animations, cli, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.6.3
@angular-devkit/build-angular      0.6.3
@angular-devkit/build-optimizer    0.6.3
@angular-devkit/core               0.6.3
@angular-devkit/schematics         0.6.3
@angular/cdk                       5.2.5
@angular/material                  5.2.5
@angular/material-moment-adapter   5.2.5
@ngtools/webpack                   6.0.3
@schematics/angular                0.6.3
@schematics/update                 0.6.3
rxjs                               6.2.0
typescript                         2.7.2
webpack                            4.8.3

Documentation is generally missing for the 5.0 -> 6.0 upgrade, specifically regarding the schema of the new angular.json. Some more info on https://update.angular.io/ would be helpful

I'm particularly struggling to re-create build/serve options for prod/dev in different languages. I don't want to make full configs for prod-en prod-de serve-en serve-de prod-with-x-en prod-with-x-de etc. So far I've found some info at https://blog.ninja-squad.com/2018/05/04/angular-cli-6.0/ but my google fu has not yielded any actual specification of what a browserTarget is exactly, for example. I sort of assume I will need to dig into @Angular-devkit, which seems like a rabbit hole

@filipesilva
Copy link
Contributor

We have some documentation here: https://github.com/angular/angular-cli/wiki/angular-workspace.

You probably want to use a configuration for each language in build, then reference it with `"browserTarget": "project-name:build:configuration-name".

      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            // ...
          },
          "configurations": {
            "production": {
              // ...
            },
            "en": {
              "i18nLocale": "fr"
            }
          }
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "latest-project:build"
          },
          "configurations": {
            "production": {
              "browserTarget": "latest-project:build:production"
            },
            "en": {
              "browserTarget": "latest-project:build:en"
            }
          }
        },

This can lead to some repetition as there is no way to compose configurations. There's a feature request for it in #10612.

Hope this helps.

@narthur157
Copy link
Author

The documentation does not reference browserTarget at all. Isn't this the most important option?

@filipesilva
Copy link
Contributor

In the link I gave you there is a link to the schema of the dev-server: https://github.com/angular/angular-cli/blob/v6.0.0-rc.8/packages/%40angular/cli/lib/config/schema.json#L907-L1028

Here you find the description of browserTarget:

            "browserTarget": {
              "type": "string",
              "description": "Target to serve."
            },

Admittedly, it is rather sparse. But it is there. It refers to a target that is using the @angular-devkit/build-angular:browser builder.

@MickL
Copy link

MickL commented Jun 14, 2018

@filipesilva It seems like it is not possible to use "browserTarget" AND overwrite some of its values. E.g. for serve i can use "browserTarget": "myapp:build" and set or overwrite aot, but if i want to set assets:

"configurations": {
            "target1": {
                  assets: [ ... ]
            }
}

I cant: Data path "" should NOT have additional properties(assets). Neither in options nor in configurations i am able to set most values for serve.

Is this a bug? I am really confused by all this and also missing better documentation.

@srikanthps
Copy link

Angular is becoming unusable for new developers due to these kind of black magic happening in background.

@filipesilva
Copy link
Contributor

@MickL you can't overwrite browserTarget values in the dev server, but you can reference a browserTarget that has the overwritten values instead.

@ps2goat
Copy link

ps2goat commented Nov 15, 2018

Angular is becoming unusable for new developers due to these kind of black magic happening in background.

Or for those of us trying to upgrade to newer versions.

@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 Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants