You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When generating a library with the "@nx/angular:library" generator and using a directory together with simpleName=false the Library Name remains simple, although the documentation suggests the opposite: https://nx.dev/nx-api/angular/generators/library#simplename
nx g @nx/angular:library --directory=libs/path --name=test --standalone=false --simpleName=false --dry-run
I would expect the module to have the name "path-test.module.ts". nx g @nx/angular:library --directory=libs/path --name=test --standalone=false --simpleName=false --dry-run
This gets the fileName using a method called determineProjectNameAndRootOptions to determine the the fileName based on the option passed to the schematic:
This seems to be the root cause, but I don't understand if this is working as designed and I need to change my parameters, but trying different variations (like adding an @ to the name or directory) of the generator did not vary anything.
The text was updated successfully, but these errors were encountered:
Digging further, I discovered that the following combination of name, directory and importPath works for me: nx g @nx/angular:library --directory=libs/path/test --name=path-test --importPath=@nw/path/test --standalone=false --simpleName=false.
Current Behavior
When generating a library with the "@nx/angular:library" generator and using a directory together with simpleName=false the Library Name remains simple, although the documentation suggests the opposite: https://nx.dev/nx-api/angular/generators/library#simplename
nx g @nx/angular:library --directory=libs/path --name=test --standalone=false --simpleName=false --dry-run
Result
Expected Behavior
I would expect the module to have the name "path-test.module.ts".
nx g @nx/angular:library --directory=libs/path --name=test --standalone=false --simpleName=false --dry-run
Result
GitHub Repo
No response
Steps to Reproduce
nx g @nx/angular:library --directory=libs/path --name=test --standalone=false --simpleName=false --dry-run
Nx Report
Failure Logs
Package Manager Version
yarn version 1.22.19
Operating System
Additional Information
I debugged the issue and the name is passed to the generator as
libFileName
:https://github.com/nrwl/nx/blob/master/packages/angular/src/generators/library/files/ng-module/src/lib/libFileName.module.ts__tpl__
This is passed from createFiles-Method called here:
https://github.com/nrwl/nx/blob/master/packages/angular/src/generators/library/library.ts#L78
The methods utilizes
options.libraryOptions.fileName
https://github.com/nrwl/nx/blob/master/packages/angular/src/generators/library/lib/create-files.ts#L35
This is created in the normalizeOptions Method called here
https://github.com/nrwl/nx/blob/master/packages/angular/src/generators/library/lib/create-files.ts#L35
This gets the fileName using a method called
determineProjectNameAndRootOptions
to determine the the fileName based on the option passed to the schematic:https://github.com/nrwl/nx/blob/master/packages/angular/src/generators/library/lib/normalize-options.ts#L45
However, this methods only returns a differing projectFileName when the name starts with an
@
.https://github.com/nrwl/nx/blob/master/packages/devkit/src/generators/project-name-and-root-utils.ts#L62
This seems to be the root cause, but I don't understand if this is working as designed and I need to change my parameters, but trying different variations (like adding an
@
to the name or directory) of the generator did not vary anything.The text was updated successfully, but these errors were encountered: