gpt4 book ai didi

angular - 将 angular.json 配置拆分为多个文件

转载 作者:行者123 更新时间:2023-12-05 04:49:09 27 4
gpt4 key购买 nike

现状:我正在做一个项目,它有不同的子项目,分配给不同的团队。所以我的 angular.json 看起来像这样:

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

有没有办法将 project-1 的配置移动到它自己的文件中。

原因:这将使我们能够改进审批流程,我们可以为每个文件定义 CODEOWNERS,而不是每个文件部分。由于 angular.json 覆盖所有项目,它需要最多的批准,通常最终结果是负责的团队要求我们批准更改,因为他们更改了对他们负责的配置。

最佳答案

据我所知,这在 Angular 中不直接支持。

有一个名为 Nx 的构建框架支持这种解构。您可以创建一个支持扩展语法的 workspace.json 而不是 angular.json:

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" } }

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

关于angular - 将 angular.json 配置拆分为多个文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67700808/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com