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
I am trying to create an Angular library named service/auth in directory libs/service/auth.
This gives me the following error
You can't specify both a directory (libs/service/auth) and a name with a
directory path (service/auth).
Please specify either a directory or a name with a directory path.
I then change the name of the library to service-auth as well as the directory to libs/service-auth. And that works with no problem.
But then I can bypass the initial validation error above by moving the newly created library. Using both the directory and name that I wanted originally. And I get no errors.
urielzen
changed the title
Bypass nx generate @nx/angular:library "
Bypass nx generate @nx/angular:library "You can't specify both a directory and a name with a directory path"
Dec 14, 2023
Please note that a name of service/auth won't be allowed for the logical name of a project. Path segments are only allowed if you have scoped package names (e.g. @acme/my-project-name). When providing a path in the name (like service/auth), Nx project generators treat it as the directory and use the last segment (or anything after a @) as the project name. That's why you can't provide both a directory and a project name containing path segments.
As you pointed out, there's a bug in the move generator that's allowing that, which it's not consistent with the project generation. In the case of the move generator, the --newProjectName option won't allow providing path segments (unless it's a scoped package name) because the destination is a required option and will already contain the directory.
Current Behavior
I am trying to create an Angular library named
service/auth
in directorylibs/service/auth
.This gives me the following error
I then change the name of the library to
service-auth
as well as the directory tolibs/service-auth
. And that works with no problem.But then I can bypass the initial validation error above by moving the newly created library. Using both the directory and name that I wanted originally. And I get no errors.
I end up with this in the tsconfig.base.json
Expected Behavior
I would expect the validation error to be consistent between creating a library and moving it.
GitHub Repo
No response
Steps to Reproduce
See above
Nx Report
Failure Logs
No response
Package Manager Version
No response
Operating System
Additional Information
No response
The text was updated successfully, but these errors were encountered: