{"action":"created","issue":{"url":"https://api.github.com/repos/yarnpkg/yarn/issues/4105","repository_url":"https://api.github.com/repos/yarnpkg/yarn","labels_url":"https://api.github.com/repos/yarnpkg/yarn/issues/4105/labels{/name}","comments_url":"https://api.github.com/repos/yarnpkg/yarn/issues/4105/comments","events_url":"https://api.github.com/repos/yarnpkg/yarn/issues/4105/events","html_url":"https://github.com/yarnpkg/yarn/pull/4105","id":248271256,"number":4105,"title":"[WIP] Selective version resolution feature","user":{"login":"kaylieEB","id":18429494,"avatar_url":"https://avatars2.githubusercontent.com/u/18429494?v=4","gravatar_id":"","url":"https://api.github.com/users/kaylieEB","html_url":"https://github.com/kaylieEB","followers_url":"https://api.github.com/users/kaylieEB/followers","following_url":"https://api.github.com/users/kaylieEB/following{/other_user}","gists_url":"https://api.github.com/users/kaylieEB/gists{/gist_id}","starred_url":"https://api.github.com/users/kaylieEB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaylieEB/subscriptions","organizations_url":"https://api.github.com/users/kaylieEB/orgs","repos_url":"https://api.github.com/users/kaylieEB/repos","events_url":"https://api.github.com/users/kaylieEB/events{/privacy}","received_events_url":"https://api.github.com/users/kaylieEB/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-08-06T20:50:57Z","updated_at":"2017-08-09T15:58:35Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/yarnpkg/yarn/pulls/4105","html_url":"https://github.com/yarnpkg/yarn/pull/4105","diff_url":"https://github.com/yarnpkg/yarn/pull/4105.diff","patch_url":"https://github.com/yarnpkg/yarn/pull/4105.patch"},"body":"<!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. The two fields below are mandatory. -->\r\n\r\n**Summary**\r\n\r\n<!-- Is the feature a substantial feature request? Please use https://github.com/yarnpkg/rfcs -->\r\n\r\nAn implementation of https://github.com/yarnpkg/rfcs/pull/68\r\n\r\n1. Based on a glob pattern specified in the `resolutions` field of package.json, yarn will override specific versions of packages. \r\n2.  Warnings are generated when\r\n- The glob pattern doesn't end with a valid package name (currently it only checks if it's empty after the last slash, since it's difficult to know what sub-dependencies exist at the time of install)\r\n- When the given resolution version is incompatible with the version specified in the request package.json (see screenshot)\r\n- When the given resolution version is an invalid semver (currently doesn't support exotic versions)\r\n3. Edge cases that won't be supported yet\r\n- Exotic resolutions such as git respositories, basically any version that won't return a valid`${name}@${version}`\r\n- Yarn's resolution method `getResolvedPattern` has no idea about the parent requests, so this means if one nested dependency _happens_ to have the same semver (say, package a has `left-pad~1.0.0` and package b also has `left-pad~1.0.0`), then they can end up being resolved to the same version defined in resolutions. However if they are different by any one character, such as semver range or version number, then they can individually be resolved. Imho I don't think it's too negative given that under normal circumstances, yarn will resolve both requests to the same package anyways.\r\n- I have not yet implemented '**' case where all nested dependencies would resolve to particular version. I can't find any good use case for this. \r\n\r\n//TODO: Need to implement checking version integrity, i.e. to detect the mismatch in the installed modules if the glob pattern changes for the same package. Current implementation only works while doing `rm -rf node_modules`,  so we need some way to match resolved versions to initially requested versions or read versions of the installed node_modules in the fs)\r\n\r\n<!-- Explain the **motivation** for making this change. What existing problem does the pull request solve? -->\r\n\r\n**Test plan**\r\nI've modified / added scenarios to @victornoel's existing tests, and it didn't break existing functionalities. More tests coming soon!\r\n\r\n**(Directly nested dependencies pattern)**\r\n<img width=\"763\" alt=\"screen shot 2017-08-06 at 10 17 20 pm\" src=\"https://user-images.githubusercontent.com/18429494/29013084-671e5aee-7af5-11e7-8102-02a89c92ba77.png\">\r\n\r\n**(All nested dependencies pattern)**\r\n<img width=\"761\" alt=\"screen shot 2017-08-06 at 10 19 16 pm\" src=\"https://user-images.githubusercontent.com/18429494/29013081-620de9fc-7af5-11e7-939d-9c34844b0592.png\">\r\n\r\n\r\n<!-- Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI. -->\r\n"},"comment":{"url":"https://api.github.com/repos/yarnpkg/yarn/issues/comments/321299938","html_url":"https://github.com/yarnpkg/yarn/pull/4105#issuecomment-321299938","issue_url":"https://api.github.com/repos/yarnpkg/yarn/issues/4105","id":321299938,"user":{"login":"kaylieEB","id":18429494,"avatar_url":"https://avatars2.githubusercontent.com/u/18429494?v=4","gravatar_id":"","url":"https://api.github.com/users/kaylieEB","html_url":"https://github.com/kaylieEB","followers_url":"https://api.github.com/users/kaylieEB/followers","following_url":"https://api.github.com/users/kaylieEB/following{/other_user}","gists_url":"https://api.github.com/users/kaylieEB/gists{/gist_id}","starred_url":"https://api.github.com/users/kaylieEB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaylieEB/subscriptions","organizations_url":"https://api.github.com/users/kaylieEB/orgs","repos_url":"https://api.github.com/users/kaylieEB/repos","events_url":"https://api.github.com/users/kaylieEB/events{/privacy}","received_events_url":"https://api.github.com/users/kaylieEB/received_events","type":"User","site_admin":false},"created_at":"2017-08-09T15:58:35Z","updated_at":"2017-08-09T15:58:35Z","body":"I've resolved the TODO item above and been working on supporting exotic ranges -- will try to post the revision and merge this weekend :)"}}
{"actor":{"display_login":"kaylieEB"}}