-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
feat(plugin-nm): support configuring link mode #4981
feat(plugin-nm): support configuring link mode #4981
Conversation
Add `nmFolderLinkMode` to schema modified: packages/plugin-nm/sources/NodeModulesLinker.ts remove debug console.log
version incremenets for plugin-nm and cli
modified: packages/gatsby/static/configuration/yarnrc.json modified: packages/plugin-nm/sources/index.ts
There seems to be an issue with the |
Indeed, they have some custom plugins that aren't compatible with Yarn v4 ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also do this in the pnpm linker, should the same logic be applied there?
await xfs.symlinkPromise(depSrcPaths.packageLocation, depDstPath, `junction`); |
Remove duplicative platform check
That probably would make sense, but I'm not familiar with If the It looks like you are one of the maintainers of I'm happy to make a similar PR for that plugin. |
The integration test for this feature is missing, we typically have integration tests for all the features in Yarn, that make sure they will not become broken in the future. Please add a test. The nm linker integration tests should be added here: |
…les.test.ts Added integration tests for nmFolderLinkMode
…ishnie/berry into implement-nmFolderLinkMode-option
…les.test.ts Add relative and absolute path checks to nmFolderLinkMode tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thank you!
I think this is ready for merge. @merceyz would you like me to propose a similar PR for the pnpm linker? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[...], what would you like to do?
would you like me to propose a similar PR for the pnpm linker?
I was thinking there should be a single setting controlling all symlink/junction creation in Yarn instead of one for each individual case, however I wont block this PR on that.
I'd be happy to work on that as a follow-up PR:
I don't see junctions used elsewhere in the code base, but wonder if there are any contrib plugins that do that would want to update as well? |
@jeff-wishnie Sounds good. I'm not aware about any contrib plugins. I think the |
Will! As noted above, I've never worked with |
What's the problem this PR addresses?
Closes #4979
Currently on Windows
yarn
usesjunctions
to link workspaces intonode_modules
directories. On other platformsyarn
uses symlinks.As a result, workspace links in
node_modules
on Windows are always absolute paths. On other platforms links may be relative paths, leading to inconsistent behavior when usingnodeLinker: node-modules
and runningyarn install
from Windows vs. Linux.A particularly bad side-effect of absolute paths on Windows is that it breaks Docker builds--when a monorepo is mounted into a container, the absolute paths are invalid.
The PR adds an additional configuration option for the
nm-linker
to use symbolic links on Windows as well, thereby supporting relative links, and fixing container builds....
How did you fix it?
added the option
nmFolderLinkMode
with two settiings:classic
(the default) --nm-linker
behaves exactly as today, using junctions on Windows and symlinks on other platforms.symlinks
--nm-linker
uses symlinks on all platforms...
Checklist
[PLEASE CHECK MY WORK HERE!]
[A handful of unit and integration tests are failing when I run against
master
. This same set fails on my branch]