简体   繁体   中英

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.

for example the command: 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.

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

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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM