-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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: ignore implict workspace for some commands #4479
Conversation
no statistically significant performance changes detected timing results
|
Shouldn't |
What if a workspace has an alternate registry or auth config? |
// only call execWorkspaces when we have workspaces explicitly set | ||
// or when it is implicit and not in our ignore list | ||
const filterByWorkspaces = | ||
(workspacesEnabled || workspacesFilters.length > 0) | ||
&& (!implicitWorkspace || !command.ignoreImplicitWorkspace) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adjust the comment:
// only call execWorkspaces when we have workspaces explicitly set | |
// or when it is implicit and not in our ignore list | |
const filterByWorkspaces = | |
(workspacesEnabled || workspacesFilters.length > 0) | |
&& (!implicitWorkspace || !command.ignoreImplicitWorkspace) | |
// only call execWorkspaces when we have workspaces explicitly set | |
// and when it is not implicit or not marked as ignore implicit workspace | |
const filterByWorkspaces = | |
(workspacesEnabled || workspacesFilters.length > 0) | |
&& (!implicitWorkspace || !command.ignoreImplicitWorkspace) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And implicitWorkspace
shouldn't conflict with explicit workspace? Or explicit shouldn't take precedence?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a lot of ways we could slice it. Right now, if your cwd is a workspace, it'll run the command and ignore any explicit workspace you specify. This makes sense for something like bin
, which has always worked on cwd, but it could be confusing for other commands. If you're not in a workspace and and you specify one, many commands will still fail.
We could go back and forth on the best way to handle these edge cases, but ultimately, I'd rather ship and iterate. If there are cases and commands that need more tweaking, we could patch the behavior again. But for now, this gets us back to running commands that don't really care about workspaces, but generally still errors if you try to explicitly set a workspace on a command that doesn't support them.
What would such a config look like? I'm having trouble finding anything about it in the npm docs And also if so, I must fundamentally misunderstand something:
|
For some commands, ignore implicit cwd workspace config and run as if no workspace filter is set.
'adduser', 'access', 'login', 'bin', 'birthday', 'bugs', 'cache', 'help-search', 'help', 'hook', 'logout', 'org', 'ping', 'prefix', 'profile', 'root', 'search', 'token'
closes #4404
Special thanks to @mshima for submitting a similar PR #4439