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: some commands should ignore workspaces #4439

Closed
wants to merge 2 commits into from
Closed

Conversation

mshima
Copy link

@mshima mshima commented Feb 18, 2022

Add condition so commands like npm prefix and npm whoami succeed inside a workspace.

References

Add condition so commands like `npm prefix -g` and `npm whoami -g` succeed inside a workspace.
@mshima mshima requested a review from a team as a code owner February 18, 2022 11:48
lib/npm.js Outdated Show resolved Hide resolved
@ruyadorno
Copy link
Contributor

cc @fritzy

@antongolub
Copy link

antongolub commented Feb 25, 2022

@mshima

let's swap conditions to avoid array traversing if workspaces are not enabled.

(workspacesEnabled || workspacesFilters.length > 0) && !['bin', 'cache', ...].includes(this.command)

Seems related to #4404, so maybe login/adduser cmd should be whitelisted here too.

@mshima
Copy link
Author

mshima commented Feb 25, 2022

@antongolub thanks for the review.
According to #4404 (comment), @fritzy is working on a fix.
This PR is kind of a workaround, and a proper fix probably is to rework https://github.com/npm/cli/blob/latest/lib/base-command.js predicting this kind of commands.
So I will wait a review from the team for now.

@fritzy
Copy link
Contributor

fritzy commented Feb 28, 2022

#4479 is a bit different in that we follow our static property pattern for commands (including tests to ensure each command has it), and we check for implicit vs. explicitly set workspaces.

Thanks for your submission!

@fritzy fritzy closed this Feb 28, 2022
wraithgar pushed a commit that referenced this pull request Mar 2, 2022
Closes #4404

Special thanks to @mshima for submitting a similar PR #4439
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants