Skip to content

Default projects and configurations #11233

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
listepo-alterpost opened this issue Jun 13, 2018 · 7 comments
Closed

Default projects and configurations #11233

listepo-alterpost opened this issue Jun 13, 2018 · 7 comments
Labels
feature Issue that requests a new feature

Comments

@listepo-alterpost
Copy link

Bug Report or Feature Request (mark with an x)

- [ ] bug report -> please search issues before submitting
- [x] feature request

Area

- [x] devkit
- [ ] schematics

We have many projects in the repository and now there is a lot of copy-paste in the angular.json

There is a proposal to add defaultConfigurations, defaultProjects and be able to inherit that.

Example

{
  "defaultProjects": {
    "defaultApp": {
      "root": "apps/$appName",
      "sourceRoot": "apps/$appName/src",
      "projectType": "application"
    }
  },
  "defaultConfigurations": {
    "defaultProd": {
      "aot": true,
      "optimization": true,
      "sourceMap": true,
      "outputHashing": "all",
      "namedChunks": false,
      "commonChunk": true,
      "buildOptimizer": true
    }
  },
  "projects": {
    "app": {
      "extend": "defaultApp",
      "configurations": {
        "prod": {
          "extend": "defaultProd",
          "extractCss": true,
          "extractLicenses": true,
          "vendorChunk": false
        }
      }
    }
  }
}
@MickL
Copy link

MickL commented Jun 14, 2018

Would love to see that, too! I have two apps already that need exactly this:

The app is the same but depending on the build the assets, styles or even some components need to change. This is already possible by use of the projects or configuration and then ng build customer1, ng build customer1 OR ng build configuration=customer1 and ng build configuration=customer2. But without extend functionality this creates TONS of duplicate configration code.

Btw. file replacement for all file types is already implemented in upcoming release 6.1.0. E.g. you can then replace component-a.ts with component-b.ts for one build. Anyway, without the extend functionality, we have to create tons of duplicate code as you mentioned.

@mdbootstrap
Copy link

Dear Angular Team, do you consider adding this anytime soon?

@fetis
Copy link

fetis commented Oct 19, 2018

Do you think it's possible to achieve with schematics? I'm thinking about having a template config and expand it to many variations into angular.json with some schematic or NodeJS script. What do you think?

@wulfsberg
Copy link

I am generally wary of the "autogenerate lots of clunky configuration" idea.
It tends to be brittle, in particular between updates, and makes things hard to debug as we essentially invent yet another language. This was the "Turing-complete XML configuration" hell Java went through, with the same vision of "you just need to right-click in your IDE and not worry about the 400Kb XML which suddenly appeared. (Except when something did go wrong, as it inevitably will)".

@fetis
Copy link

fetis commented Oct 19, 2018

But other option is only a lot of error-prone and tedious manual updates.

@filipesilva
Copy link
Contributor

Heya, this request looks to be very similar to #10612. I'm closing in favor of that one to keep the discussion in one place.

@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 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature Issue that requests a new feature
Projects
None yet
Development

No branches or pull requests

6 participants