3

Status quo: I'm working on a project, which has different sub projects, which are assigned to different teams. So my angular.json looks something like this:

{
  ....
  "projects": {
    "project-1": { ... }
    "project-2": { ... }
  ....

Is there a way to move the configuration for project-1 into it's own file.

Reason: This would allow us to make the approval process better, where we can define CODEOWNERS per file, but not per file part. Since angular.json is over all projects, it needs the most approvals, which usually just ends up with the responsible team asking us to approve the change, because they changed the configuration responsible for them.

1 Answer 1

2

As far as I am aware, this is not supported in Angular directly.

There is a build framework called Nx that does support this kind of destructuring. Instead of angular.json, you can create a workspace.json that supports an extended syntax:

angular.json

Your angular.json file can be renamed to workspace.json and Nx will process it in the same way. The workspace.json has one additional top level property version. Setting version to 1 means the workspace.json file syntax is identical to angular.json When the version of workspace.json is set to 2, targets, generators and executor properties are used instead of the version 1 properties architect, schematics and builder.

project.json

In version 2 workspaces, project configurations can also be independent files, referenced by angular.json. For instance, an angular.json may contain projects configured as below.

json { "projects": { "mylib": "libs/mylib" } }

Reference: https://nx.dev/l/a/core-concepts/configuration

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.