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

detectPackageManager thinks yarn package is being used due to findWorkspaceRoot() #4

Closed
caschbre opened this issue Apr 8, 2022 · 1 comment

Comments

@caschbre
Copy link

caschbre commented Apr 8, 2022

First of all, thanks for adding the pnpm workspace support so quickly! I've been beating my head trying to patch packages in pnpm workspaces for quite a while now.

I did come across a minor issue with the package detection logic. The following code is causing the pnpm workspace detection to never get executed.

  } else if (yarnLockExists || findWorkspaceRoot()) {
    return "yarn"
  } else if (isFileInPnpmRoot(appRootPath, "pnpm-lock.yaml")) {
    // (fs.existsSync(join(appRootPath, "pnpm-lock.yaml"))) {
    return "pnpm"

What is interesting is I do not even have yarn installed on my machine. It looks like findWorkspaceRoot() (from the find-yarn-workspace-root package) doesn't test if you have yarn, it just returns what it thinks is the workspace root. So that always seems to return a string if you're using workspaces, regardless of yarn being used or even installed.

I'm not sure if that needs to be changed to yarnLockExists && findWorkspaceRoot() or just swap the order of the else if blocks so that it has a chance to detect pnpm first.

I simply commented out the logic block that uses findWorkspaceRoot() and the pnpm workspace was detected.

@milahu
Copy link
Owner

milahu commented Apr 14, 2022

could reproduce ... should be fixed in 3545f96

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

No branches or pull requests

2 participants