-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Yarn 4: Respect enableTransparentWorkspaces: false
when resolving workspace dependencies
#8989
Comments
npm:
protocol dependency of the same name is presentenableTransparentWorkspaces: false
when resolving workspace dependencies
Thanks for the report. Just documenting for myself that we're doing the correct behavior for default Yarn 4 settings, but if |
I had a look at this out of curiosity. If I'm not mistaken the fix is likely addressing the TODO in fn is_external(&self) -> bool {
// The npm protocol for yarn by default still uses the workspace package if the
// workspace version is in a compatible semver range. See https://github.com/yarnpkg/berry/discussions/4015
// For now, we will just assume if the npm protocol is being used and the
// version matches its an internal dependency which matches the existing
// behavior before this additional logic was added.
// TODO: extend this to support the `enableTransparentWorkspaces` yarn option
self.protocol.map_or(false, |p| p != "npm")
} |
@chris-olszewski I've hacked on this in a branch here romanofski@8b7166d If I did find the right locations to change, I wonder whether the config file representation for the package managers is not already a bottle neck. Currently the npmrc and yarnrc configs are exposed as simple booleans, but perhaps should actually be represented more abstractly? Like instead of passing in the *rc instances in the Anyway, guess if there is 5 mins to have a quick look at the branch/patch I'd appreciate some pointers in the right direction. I'll continue having a look at the integration tests since that's needed too. |
…erry (#9626) ### Description This implements a fix for #8989 to honour `enableTransparentWorkspaces` in a yarn config. The patch folds the config setting into the existing `link_workspace_packages` npm settings as they're equivalent. Massive Kudos to @me4502 as she helped throughout the implementation process with testing and figuring things out. ### Testing Instructions * Use https://github.com/me4502/turborepo-reproduction reproducer * Run compiled turbo build against workspace `a`: `turborepo/target/debug/turbo build --force --skip-infer --no-daemon --filter a` --------- Co-authored-by: Chris Olszewski <chris.olszewski@vercel.com>
Verify canary release
Link to code that reproduces this issue
https://github.com/me4502/turborepo-reproduction
What package manager are you using / does the bug impact?
Yarn v2/v3/v4 (node_modules linker only)
What operating system are you using?
Mac
Which canary version will you have in your reproduction?
2.0.12-canary.3
Describe the Bug
When a dependency using Yarn's
npm:
protocol exists that has the same name as a workspace in the repo, turborepo incorrectly builds the repo with that name. This causes issues in cases where FFI-requiring packages are built on CI and used purely via NPM rather than local workspaces.Expected Behavior
As these dependencies come from npm, and not the workspace of the same name, the workspace should not be built nor considered part of turborepo's dependency graph.
To Reproduce
yarn
in the root of the repocd
toworkspaces/a
yarn build:turbo
As can be seen in the output, the buffer workspace's
build
script has been incorrectly run, despite it not being a dependency of thea
workspace.Additional context
The important parts of this setup are that there's a package called
buffer
being used by workspacea
, and a workspace also namedbuffer
. The repro is setup to specifically use the dependency from npm, so it should not be building the workspace copy as it's redundant (and in the case of FFI dependencies, potentially impossible from local development machines).The text was updated successfully, but these errors were encountered: