-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Fix: nested relative link: protocal dependency symlinks #3605
Conversation
I'm not sure I totally understand what you mean - the |
'resolves the symlinks of other symlinked packages relative to the package using the link: protocol', | ||
async () => { | ||
await runInstall({}, 'install-link-nested', async (config): Promise<void> => { | ||
const expectPath = path.join(config.cwd, 'node_modules', 'b'); |
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.
So do I understand it right?
root
-- > link: a --> link: b
Gets installed
node_modules
a (symlink) -> ../a
b (symlink) -> ../a/b
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.
I am worried that we touch what is inside a, probably a symlinked dependency should not participate in deduping?
And be like
node_modules/
a (symlink) -> ../a
a/
b/
node_modules/
b (symlink) -> ../b
I wonder if several projects will link to a
, would they be modifying their contents
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.
Yes the following is what gets installed:
node_modules
a (symlink) -> ../a
b (symlink) -> ../a/b
This is however what is getting installed on develop currently:
node_modules
a (symlink) -> ../a
b (symlink) -> ../b
And that means the b
symlink is going nowhere. I can't comment on deduping and that behavior as I'm new to the yarn codebase and have only basic understanding on resolvers in general and ExoticResolver
logic specifically 😕
I can dig into it though and add a test case regarding:
I wonder if several projects will link to a, would they be modifying their contents
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.
Ah, yeah, looks like it is fine then.
We'll probably be discovering more issues with transitive link: and file: dependencies, we'll deal with them as they come.
Feel free to investigate a bit more.
Thanks, @stipsan, good fix! |
When a
link:a
dependency also contain alink:b
the symlink tolink:b
is broken.I'm not sure how to fix it yet as I've never looked at Yarn's sourcecode before but at least I got a proper test case that reproduces the problem to get the ball rolling 😄
Expected test output in this PR (until the bug is fixed):
Edit
Seems like file-resolver have a solution for this already so I've pushed a patch to link-resolver that use the same logic. Hopefully it solves the problem 😃