fix(misc): allow create-nx-workspace . --no-interactive in empty directory#35281
Open
cogwirrel wants to merge 2 commits intonrwl:masterfrom
Open
fix(misc): allow create-nx-workspace . --no-interactive in empty directory#35281cogwirrel wants to merge 2 commits intonrwl:masterfrom
cogwirrel wants to merge 2 commits intonrwl:masterfrom
Conversation
👷 Deploy request for nx-docs pending review.Visit the deploys page to approve it
|
👷 Deploy request for nx-dev pending review.Visit the deploys page to approve it
|
67f29d2 to
12aa858
Compare
…ctory When using "." or "./" as the workspace name, resolveSpecialFolderName already validates the directory is empty. Skip the subsequent existsSync check that always returns true (since the target IS the current directory), which previously caused a spurious "directory already exists" error in non-interactive mode. Also defaults the workspace name to basename(cwd) when --no-interactive is passed without an explicit name. Fixes nrwl#35278 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
12aa858 to
9f4a941
Compare
AgentEnder
approved these changes
Apr 15, 2026
Contributor
|
View your CI Pipeline Execution ↗ for commit 9f4a941
☁️ Nx Cloud last updated this comment at |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Current Behavior
Running
create-nx-workspace . --no-interactiveinside an empty directory fails with:This happens because
resolveSpecialFolderName(".")resolves to{ name: basename(cwd), workingDir: dirname(cwd) }, and thendetermineFolder()checksexistsSync(join(workingDir, name))— which is the current directory itself, so it always exists. In interactive mode, this triggers a re-prompt that happens to work. In non-interactive mode, it throws the error.Additionally, running
create-nx-workspace --no-interactivewithout any name falls through topromptForFolderwhich silently uses'org'as the default name rather than the current directory name.Expected Behavior
create-nx-workspace . --no-interactiveshould work in an empty directory, creating the workspace in-place (the same way it works in interactive mode).create-nx-workspace --no-interactivewithout a name should default to the current directory name.Related Issue(s)
Fixes #35278