-
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
Nested executables fix #2053
Nested executables fix #2053
Conversation
@onemen I have re-ran you test. It's passing now 👍 This is quite a big PR. Might take some time to review. |
yarn doesnt hoist nested bins as of now. probably fine to make that peer anyway? yarnpkg/yarn#2053 yarnpkg/yarn#1210
@onemen, thanks for the effort to add all those tests! 👍 |
I will do the rebase later this week. Where can i found simple example for this? |
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.
Great work on tests!
Just need to make sure that we deal with conflicts correctly
const binLoc = path.dirname(location) === pkgLoc ? parentBinLoc : pkgBinLoc; | ||
const binLinks = await getBinLinks(binLoc); | ||
// Remove Duplicates | ||
if (!binLinks.has(location)) { |
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 think top level dependencies should have a priority over nested ones
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 can fix the sort at the top of copyModules function, let me know if it ok with you.
After this sort, we populate binLinks with top level dependencies first.
// sorted tree makes file creation and copying not to interfere with each other
+ // prioritize top level dependencies
flatTree = flatTree.sort(function(dep1, dep2): number {
- return dep1[0].localeCompare(dep2[0]);
+ const [len1, len2] = [dep1[0].split(path.sep).length, dep2[0].split(path.sep).length];
+ return len1 === len2 ? dep1[0].localeCompare(dep2[0]) : len1 - len2;
});
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.
If that works then sure.
I thought it would be easier though if you iterate over the top dependencies first to generate a set of bins and then go through deeper dependencies discarding bins that are already in the set.
}); | ||
await install.init(); | ||
await check(config, reporter, {}, []); | ||
return install; |
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.
this test needs to verify that bin dependencies were flattened properly.
Especially for a case of conflicting bins
@onemen any updates on finishing up this PR? |
I hope to find the time later this month. I need to re-base the code and create new branch, since my old branch was corrupted |
@onemen any update? |
ping. |
I'll close this PR for now. |
Implementing 'Nested executables fix' as suggested by #1210
(prevents [0.17.0] Error chmod-ing .bin files on 'yarn install' #1823)
folder