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

fix(misc): ensure workspace directory is normalized correctly #16855

Merged
merged 1 commit into from
May 8, 2023

Conversation

leosvelperez
Copy link
Member

@leosvelperez leosvelperez commented May 8, 2023

Current Behavior

When creating a new workspace a providing a repo name with _ in it, an error is thrown due to a mismatch in the directory name used by the new generator vs the create-nx-workspace functionality. This mainly happens because the new generator is invoked with the non-normalized name and this generator wrongly sets the directory to that value instead of setting it with the normalized name.

Expected Behavior

Creating a new workspace providing a repo name with _ should not throw an error.

Related Issue(s)

Fixes #16841

@leosvelperez leosvelperez self-assigned this May 8, 2023
@vercel
Copy link

vercel bot commented May 8, 2023

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

Name Status Preview Comments Updated (UTC)
nx-dev ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 8, 2023 10:25am


const args = unparse({
...options,
}).join(' ');

const pmc = getPackageManagerCommand(packageManager);

const command = `new ${directory} ${args}`;
const command = `new ${args}`;
Copy link
Member Author

@leosvelperez leosvelperez May 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ${directory} here was useless. The name arg takes precedence over the positional arg and overwrites it.

I'm normalizing the name option above, which is a known and required option, so we don't rely on the new generator rederiving it. We could also pass the directory option directly so it's more deterministic and we don't rely on some behavior in the new generator, but that option is not in the new generator schema for some reason. If someone can confirm whether it's intentional or just something we missed, I can add it and pass the option directly.

@leosvelperez leosvelperez marked this pull request as ready for review May 8, 2023 11:19
@AgentEnder AgentEnder merged commit cc9e650 into nrwl:master May 8, 2023
@leosvelperez leosvelperez deleted the misc/cnw-normalize-name branch May 9, 2023 07:21
@github-actions
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 May 15, 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.

Creating a workspace with '_' underscore character fails
2 participants