Closed erunion closed 8 months ago
I think the only correct answer here is to not check for the existence of the workspaces
key as an indicator of yarn usage. I think what needs to happen is to find the "root" and then look for the lockfile there. Since yarn does not allow turning off lockfiles, you can assume that if there is no yarn.lock
there but you have a workspaces key then it is an npm
project.
If you run the following code snippet from inside of a workspace directory in an NPM package (like
packages/<pkgname>
), the call tofindYarnWorkspaceRoot()
inpreferred-pm
ends up thinking that we're using Yarn.I'm not exactly sure how to fix this because you can't easily know if you're in an NPM workspace without recursively parsing the parent directories until you find a
package.json
and see theworkspaces
key.