[英]How to avoid changing the import name of the Library using NRWL move command?
I am using the NRWL move command to move lib into the parent folder to achieve a well-organized project structure.我正在使用 NRWL move 命令将 lib 移动到父文件夹中,以实现组织良好的项目结构。
for example the command: nx g @nrwl/angular:move --project graphql core/graphql例如命令: nx g @nrwl/angular:move --project graphql core/graphql
It moves lib into the parent folder but it changes the name of the library too as You can see on the following output of the angular.json file.它将 lib 移动到父文件夹中,但它也更改了库的名称,如您在 angular.json 文件的以下 output 中所见。
"graphql": {
"projectType": "library",
"root": "libs/graphql",
"sourceRoot": "libs/graphql/src",
changes to:更改为:
"core-graphql": { // I dont want to change this name only the path to module
"projectType": "library",
"root": "libs/core/graphql",
"sourceRoot": "libs/core/graphql/src",
I have to find all occurrences of the new library name and change them back after each move command.我必须找到所有出现的新库名称,并在每次移动命令后将它们改回来。
Is possible to avoid this by some flag in command?是否可以通过命令中的某些标志来避免这种情况? I tried to use params that are mentioned in docs but without luck, the name is changed every time.
我尝试使用文档中提到的参数,但没有运气,每次都会更改名称。
Thanks for any advice.感谢您的任何建议。
Project name and the project path stays in sync in nrwl workspace and hence it makes sense on why the project name is getting updated from graphql
to core-graphql
.项目名称和项目路径在 nrwl 工作区中保持同步,因此为什么项目名称从
graphql
更新为core-graphql
是有意义的。
Also, the move command by default updates all occurrences of the import path of the moved project to the new location ( https://nx.dev/packages/angular/generators/move#updateimportpath ), so I don't think one would want the same project name even after moving it to a new location.此外,默认情况下,移动命令会将所有出现的已移动项目的导入路径更新到新位置( https://nx.dev/packages/angular/generators/move#updateimportpath ),所以我认为不会即使在将其移动到新位置后也想要相同的项目名称。 You can avoid the import path update by setting
updateimportpath
to false while running the command but that would only cause more confusion in the workspace.您可以通过在运行命令时将
updateimportpath
设置为 false 来避免导入路径更新,但这只会在工作区中造成更多混乱。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.