Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(misc): allow providing a path in the name option of project generators #20274

Merged

Conversation

leosvelperez
Copy link
Member

@leosvelperez leosvelperez commented Nov 16, 2023

Current Behavior

Providing a path in the name option of project generators is not handled for the as-provided project name and root format. The path is used as-is as the name and that causes issues with the path separators.

Expected Behavior

Providing the path in the name option of project generators is handled when using the as-provided project name and root format. When a path is provided, the generators will perform the following:

  • The last segment of the path will be the project name, or if the path includes a @, the generator will assume a scoped package name was provided and the name will be scoped package name
  • The full provided path will be the project root

Examples:

nx g lib libs/lib1
# generates a project with name "lib1" at "libs/lib1"

nx g lib libs/@acme/lib1
# generates a project with name "@acme/lib1" at "libs/@acme/lib1"

Related Issue(s)

Fixes #

@leosvelperez leosvelperez self-assigned this Nov 16, 2023
Copy link

vercel bot commented Nov 16, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Visit Preview Nov 17, 2023 8:19am

@leosvelperez leosvelperez force-pushed the misc/project-generators-path-as-name branch from a93d3a5 to 5c8ce32 Compare November 17, 2023 08:18
@leosvelperez leosvelperez marked this pull request as ready for review November 17, 2023 11:28
@leosvelperez leosvelperez requested review from a team as code owners November 17, 2023 11:28
@FrozenPandaz FrozenPandaz merged commit a672cbb into nrwl:master Nov 21, 2023
6 checks passed
@leosvelperez leosvelperez deleted the misc/project-generators-path-as-name branch November 21, 2023 16:53
Copy link

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants