-
Notifications
You must be signed in to change notification settings - Fork 249
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
Issue: using workspace:
to implement nohoist in a package.json while using pnpm throws an error
#919
Comments
Hi @danroberts thanks for raising this (clear & well documented) bug report. I've created a fix (see linked PR) and published Let me know whether or not that fixes the issue on your side as well! |
Hi @sverweij! Thanks for the quick response. It does solve my problem, however, it is possible that your fix might regress the following example which is valid for yarn:
I'm not really sure how the cruiser would handle that but it's possible it might miss the workspaces defined in the packages property. |
Hi @danroberts thanks for checking! That yarn (1) shape of workspaces indeed won't work. It didn't in the previous version either b.t.w., so that'll be a good addition. It won't (and didn't) lead to missing workspace dependencies (determining that happens elsewhere), only thing that'll happen is that these specific workspace aliases will not get classified as such. Anyway - PR updated, & published as dependency-cruiser@16.2.4-beta-2 (since a few minutes). |
… 'workspaces' type alias field (#920) ## Description - ignores 'workspaces' field when it isn't an array _and_ it doesn't contain a yarn1 workspaces.packages field - also classifies dependencies resolving via yarn1 workspaces.packages fields as _aliased_, _aliased-workspace_ ## Motivation and Context fixes #919 ## How Has This Been Tested? - [x] green ci - [x] additional automated non-regression test Note: a version with this fix has been published as `dependency-cruiser@16.2.4-beta-1` - once the PR is merged it'll be part of dependency-cruiser@16.2.4. ## Types of changes - [x] Bug fix (non-breaking change which fixes an issue)
FYI @danroberts - I've just released dependency-cruiser@16.2.4 that contains the fix for this issue as well. |
If you are using pnpm to do workspace manage, you don't define your workspaces in package.json -
workspaces
property, instead, separately in a pnpm-workspaces.yaml file.One of our packages had a leftover workspaces nohoist property from when we used to use yarn, like this:
but doesn't specify any workspaces.
When analyzed with `pnpm depcruise packages/package-name -T json -c > results.json
it throws an error:
Removing the nohoist makes it work as expected.
Expected Behavior
If the workspaces property of the package.json is an object with only a nohoist property, ignore it.
Current Behavior
Possible Solution
If the workspaces property of the package.json is an object with only a nohoist property, ignore it in
Steps to Reproduce (for bugs)
Context
Your Environment
The text was updated successfully, but these errors were encountered: