{"action":"created","comment":{"url":"https://api.github.com/repos/yarnpkg/yarn/pulls/comments/104303441","pull_request_review_id":25138129,"id":104303441,"diff_hunk":"@@ -572,14 +572,44 @@ export class Install {\n   }\n \n   /**\n+   * Remove offline tarballs that are no longer required\n+   */\n+\n+  async pruneOfflineMirror(lockfile: Object): Promise<void> {\n+    const mirror = this.config.getOfflineMirrorPath();\n+    if (!mirror) {\n+      return;\n+    }\n+\n+    const requiredTarballs = new Set();\n+    for (const dependency in lockfile) {\n+      const resolved = lockfile[dependency].resolved;\n+      if (resolved) {\n+        requiredTarballs.add(resolved.split('#')[0]);","path":"src/cli/commands/install.js","position":17,"original_position":17,"commit_id":"316b91400401cddc675b246bfe9ec8652e3029a8","original_commit_id":"316b91400401cddc675b246bfe9ec8652e3029a8","user":{"login":"dguo","id":2763135,"avatar_url":"https://avatars3.githubusercontent.com/u/2763135?v=3","gravatar_id":"","url":"https://api.github.com/users/dguo","html_url":"https://github.com/dguo","followers_url":"https://api.github.com/users/dguo/followers","following_url":"https://api.github.com/users/dguo/following{/other_user}","gists_url":"https://api.github.com/users/dguo/gists{/gist_id}","starred_url":"https://api.github.com/users/dguo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dguo/subscriptions","organizations_url":"https://api.github.com/users/dguo/orgs","repos_url":"https://api.github.com/users/dguo/repos","events_url":"https://api.github.com/users/dguo/events{/privacy}","received_events_url":"https://api.github.com/users/dguo/received_events","type":"User","site_admin":false},"body":"I'm not sure if it is okay to depend on the format of `resolved` like this.","created_at":"2017-03-05T04:02:33Z","updated_at":"2017-03-05T04:02:33Z","html_url":"https://github.com/yarnpkg/yarn/pull/2836#discussion_r104303441","pull_request_url":"https://api.github.com/repos/yarnpkg/yarn/pulls/2836","_links":{"self":{"href":"https://api.github.com/repos/yarnpkg/yarn/pulls/comments/104303441"},"html":{"href":"https://github.com/yarnpkg/yarn/pull/2836#discussion_r104303441"},"pull_request":{"href":"https://api.github.com/repos/yarnpkg/yarn/pulls/2836"}}},"pull_request":{"url":"https://api.github.com/repos/yarnpkg/yarn/pulls/2836","id":109134451,"html_url":"https://github.com/yarnpkg/yarn/pull/2836","diff_url":"https://github.com/yarnpkg/yarn/pull/2836.diff","patch_url":"https://github.com/yarnpkg/yarn/pull/2836.patch","issue_url":"https://api.github.com/repos/yarnpkg/yarn/issues/2836","number":2836,"state":"open","locked":false,"title":"Add optional offline mirror pruning","user":{"login":"dguo","id":2763135,"avatar_url":"https://avatars3.githubusercontent.com/u/2763135?v=3","gravatar_id":"","url":"https://api.github.com/users/dguo","html_url":"https://github.com/dguo","followers_url":"https://api.github.com/users/dguo/followers","following_url":"https://api.github.com/users/dguo/following{/other_user}","gists_url":"https://api.github.com/users/dguo/gists{/gist_id}","starred_url":"https://api.github.com/users/dguo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dguo/subscriptions","organizations_url":"https://api.github.com/users/dguo/orgs","repos_url":"https://api.github.com/users/dguo/repos","events_url":"https://api.github.com/users/dguo/events{/privacy}","received_events_url":"https://api.github.com/users/dguo/received_events","type":"User","site_admin":false},"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\nThis change is an implementation of yarnpkg/rfcs#49, which stems from #2109.\r\n\r\n<!-- Is the feature a substantial feature request? Please use https://github.com/yarnpkg/rfcs -->\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\n\r\nI tested the feature locally with two scenarios where `.yarnrc` has `yarn-offline-mirror-pruning` set to `true`:\r\n\r\n* Upgrading a package:\r\n    * `$ yarn add is-positive-integer@1.0.0`\r\n    * Check that the offline mirror has the `is-positive-integer` tarball, along with all its dependencies\r\n    * `$ yarn upgrade is-positive-integer@1.1.1`\r\n    * Check that the offline mirror only has the new version of `is-positive-integer`, which doesn't have any dependencies\r\n* Removing a package:\r\n    * `$ yarn add left-pad right-pad`\r\n    * Check that the offline mirror has both the `left-pad` and `right-pad` tarballs\r\n    * `$ yarn remove left-pad`\r\n    * Check that the offline mirror only has `right-pad`\r\n\r\nI also added two Jest test cases, one for upgrade and one for remove. They verify that sub-dependencies are also pruned.\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","created_at":"2017-03-05T03:58:31Z","updated_at":"2017-03-05T04:02:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b16b0dafb3b048fa404ec10633538708b1803251","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/yarnpkg/yarn/pulls/2836/commits","review_comments_url":"https://api.github.com/repos/yarnpkg/yarn/pulls/2836/comments","review_comment_url":"https://api.github.com/repos/yarnpkg/yarn/pulls/comments{/number}","comments_url":"https://api.github.com/repos/yarnpkg/yarn/issues/2836/comments","statuses_url":"https://api.github.com/repos/yarnpkg/yarn/statuses/316b91400401cddc675b246bfe9ec8652e3029a8","head":{"label":"dguo:prune-offline-mirror","ref":"prune-offline-mirror","sha":"316b91400401cddc675b246bfe9ec8652e3029a8","user":{"login":"dguo","id":2763135,"avatar_url":"https://avatars3.githubusercontent.com/u/2763135?v=3","gravatar_id":"","url":"https://api.github.com/users/dguo","html_url":"https://github.com/dguo","followers_url":"https://api.github.com/users/dguo/followers","following_url":"https://api.github.com/users/dguo/following{/other_user}","gists_url":"https://api.github.com/users/dguo/gists{/gist_id}","starred_url":"https://api.github.com/users/dguo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dguo/subscriptions","organizations_url":"https://api.github.com/users/dguo/orgs","repos_url":"https://api.github.com/users/dguo/repos","events_url":"https://api.github.com/users/dguo/events{/privacy}","received_events_url":"https://api.github.com/users/dguo/received_events","type":"User","site_admin":false},"repo":{"id":76118400,"name":"yarn","full_name":"dguo/yarn","owner":{"login":"dguo","id":2763135,"avatar_url":"https://avatars3.githubusercontent.com/u/2763135?v=3","gravatar_id":"","url":"https://api.github.com/users/dguo","html_url":"https://github.com/dguo","followers_url":"https://api.github.com/users/dguo/followers","following_url":"https://api.github.com/users/dguo/following{/other_user}","gists_url":"https://api.github.com/users/dguo/gists{/gist_id}","starred_url":"https://api.github.com/users/dguo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dguo/subscriptions","organizations_url":"https://api.github.com/users/dguo/orgs","repos_url":"https://api.github.com/users/dguo/repos","events_url":"https://api.github.com/users/dguo/events{/privacy}","received_events_url":"https://api.github.com/users/dguo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dguo/yarn","description":"📦🐈 Fast, reliable, and secure dependency management.","fork":true,"url":"https://api.github.com/repos/dguo/yarn","forks_url":"https://api.github.com/repos/dguo/yarn/forks","keys_url":"https://api.github.com/repos/dguo/yarn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dguo/yarn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dguo/yarn/teams","hooks_url":"https://api.github.com/repos/dguo/yarn/hooks","issue_events_url":"https://api.github.com/repos/dguo/yarn/issues/events{/number}","events_url":"https://api.github.com/repos/dguo/yarn/events","assignees_url":"https://api.github.com/repos/dguo/yarn/assignees{/user}","branches_url":"https://api.github.com/repos/dguo/yarn/branches{/branch}","tags_url":"https://api.github.com/repos/dguo/yarn/tags","blobs_url":"https://api.github.com/repos/dguo/yarn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dguo/yarn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dguo/yarn/git/refs{/sha}","trees_url":"https://api.github.com/repos/dguo/yarn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dguo/yarn/statuses/{sha}","languages_url":"https://api.github.com/repos/dguo/yarn/languages","stargazers_url":"https://api.github.com/repos/dguo/yarn/stargazers","contributors_url":"https://api.github.com/repos/dguo/yarn/contributors","subscribers_url":"https://api.github.com/repos/dguo/yarn/subscribers","subscription_url":"https://api.github.com/repos/dguo/yarn/subscription","commits_url":"https://api.github.com/repos/dguo/yarn/commits{/sha}","git_commits_url":"https://api.github.com/repos/dguo/yarn/git/commits{/sha}","comments_url":"https://api.github.com/repos/dguo/yarn/comments{/number}","issue_comment_url":"https://api.github.com/repos/dguo/yarn/issues/comments{/number}","contents_url":"https://api.github.com/repos/dguo/yarn/contents/{+path}","compare_url":"https://api.github.com/repos/dguo/yarn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dguo/yarn/merges","archive_url":"https://api.github.com/repos/dguo/yarn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dguo/yarn/downloads","issues_url":"https://api.github.com/repos/dguo/yarn/issues{/number}","pulls_url":"https://api.github.com/repos/dguo/yarn/pulls{/number}","milestones_url":"https://api.github.com/repos/dguo/yarn/milestones{/number}","notifications_url":"https://api.github.com/repos/dguo/yarn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dguo/yarn/labels{/name}","releases_url":"https://api.github.com/repos/dguo/yarn/releases{/id}","deployments_url":"https://api.github.com/repos/dguo/yarn/deployments","created_at":"2016-12-10T14:46:02Z","updated_at":"2016-12-10T14:46:11Z","pushed_at":"2017-03-05T03:42:45Z","git_url":"git://github.com/dguo/yarn.git","ssh_url":"git@github.com:dguo/yarn.git","clone_url":"https://github.com/dguo/yarn.git","svn_url":"https://github.com/dguo/yarn","homepage":"https://yarnpkg.com","size":47534,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"yarnpkg:master","ref":"master","sha":"689c07ddfa6b495b0cdbcefe4bbc29cc7fc7c9c3","user":{"login":"yarnpkg","id":22247014,"avatar_url":"https://avatars0.githubusercontent.com/u/22247014?v=3","gravatar_id":"","url":"https://api.github.com/users/yarnpkg","html_url":"https://github.com/yarnpkg","followers_url":"https://api.github.com/users/yarnpkg/followers","following_url":"https://api.github.com/users/yarnpkg/following{/other_user}","gists_url":"https://api.github.com/users/yarnpkg/gists{/gist_id}","starred_url":"https://api.github.com/users/yarnpkg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yarnpkg/subscriptions","organizations_url":"https://api.github.com/users/yarnpkg/orgs","repos_url":"https://api.github.com/users/yarnpkg/repos","events_url":"https://api.github.com/users/yarnpkg/events{/privacy}","received_events_url":"https://api.github.com/users/yarnpkg/received_events","type":"Organization","site_admin":false},"repo":{"id":49970642,"name":"yarn","full_name":"yarnpkg/yarn","owner":{"login":"yarnpkg","id":22247014,"avatar_url":"https://avatars0.githubusercontent.com/u/22247014?v=3","gravatar_id":"","url":"https://api.github.com/users/yarnpkg","html_url":"https://github.com/yarnpkg","followers_url":"https://api.github.com/users/yarnpkg/followers","following_url":"https://api.github.com/users/yarnpkg/following{/other_user}","gists_url":"https://api.github.com/users/yarnpkg/gists{/gist_id}","starred_url":"https://api.github.com/users/yarnpkg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yarnpkg/subscriptions","organizations_url":"https://api.github.com/users/yarnpkg/orgs","repos_url":"https://api.github.com/users/yarnpkg/repos","events_url":"https://api.github.com/users/yarnpkg/events{/privacy}","received_events_url":"https://api.github.com/users/yarnpkg/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/yarnpkg/yarn","description":"📦🐈 Fast, reliable, and secure dependency management.","fork":false,"url":"https://api.github.com/repos/yarnpkg/yarn","forks_url":"https://api.github.com/repos/yarnpkg/yarn/forks","keys_url":"https://api.github.com/repos/yarnpkg/yarn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yarnpkg/yarn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yarnpkg/yarn/teams","hooks_url":"https://api.github.com/repos/yarnpkg/yarn/hooks","issue_events_url":"https://api.github.com/repos/yarnpkg/yarn/issues/events{/number}","events_url":"https://api.github.com/repos/yarnpkg/yarn/events","assignees_url":"https://api.github.com/repos/yarnpkg/yarn/assignees{/user}","branches_url":"https://api.github.com/repos/yarnpkg/yarn/branches{/branch}","tags_url":"https://api.github.com/repos/yarnpkg/yarn/tags","blobs_url":"https://api.github.com/repos/yarnpkg/yarn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yarnpkg/yarn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yarnpkg/yarn/git/refs{/sha}","trees_url":"https://api.github.com/repos/yarnpkg/yarn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yarnpkg/yarn/statuses/{sha}","languages_url":"https://api.github.com/repos/yarnpkg/yarn/languages","stargazers_url":"https://api.github.com/repos/yarnpkg/yarn/stargazers","contributors_url":"https://api.github.com/repos/yarnpkg/yarn/contributors","subscribers_url":"https://api.github.com/repos/yarnpkg/yarn/subscribers","subscription_url":"https://api.github.com/repos/yarnpkg/yarn/subscription","commits_url":"https://api.github.com/repos/yarnpkg/yarn/commits{/sha}","git_commits_url":"https://api.github.com/repos/yarnpkg/yarn/git/commits{/sha}","comments_url":"https://api.github.com/repos/yarnpkg/yarn/comments{/number}","issue_comment_url":"https://api.github.com/repos/yarnpkg/yarn/issues/comments{/number}","contents_url":"https://api.github.com/repos/yarnpkg/yarn/contents/{+path}","compare_url":"https://api.github.com/repos/yarnpkg/yarn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yarnpkg/yarn/merges","archive_url":"https://api.github.com/repos/yarnpkg/yarn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yarnpkg/yarn/downloads","issues_url":"https://api.github.com/repos/yarnpkg/yarn/issues{/number}","pulls_url":"https://api.github.com/repos/yarnpkg/yarn/pulls{/number}","milestones_url":"https://api.github.com/repos/yarnpkg/yarn/milestones{/number}","notifications_url":"https://api.github.com/repos/yarnpkg/yarn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yarnpkg/yarn/labels{/name}","releases_url":"https://api.github.com/repos/yarnpkg/yarn/releases{/id}","deployments_url":"https://api.github.com/repos/yarnpkg/yarn/deployments","created_at":"2016-01-19T17:39:16Z","updated_at":"2017-03-05T02:28:30Z","pushed_at":"2017-03-05T03:58:31Z","git_url":"git://github.com/yarnpkg/yarn.git","ssh_url":"git@github.com:yarnpkg/yarn.git","clone_url":"https://github.com/yarnpkg/yarn.git","svn_url":"https://github.com/yarnpkg/yarn","homepage":"https://yarnpkg.com","size":49739,"stargazers_count":23181,"watchers_count":23181,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":957,"mirror_url":null,"open_issues_count":715,"forks":957,"open_issues":715,"watchers":23181,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/yarnpkg/yarn/pulls/2836"},"html":{"href":"https://github.com/yarnpkg/yarn/pull/2836"},"issue":{"href":"https://api.github.com/repos/yarnpkg/yarn/issues/2836"},"comments":{"href":"https://api.github.com/repos/yarnpkg/yarn/issues/2836/comments"},"review_comments":{"href":"https://api.github.com/repos/yarnpkg/yarn/pulls/2836/comments"},"review_comment":{"href":"https://api.github.com/repos/yarnpkg/yarn/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/yarnpkg/yarn/pulls/2836/commits"},"statuses":{"href":"https://api.github.com/repos/yarnpkg/yarn/statuses/316b91400401cddc675b246bfe9ec8652e3029a8"}}}}
{"actor":{"display_login":"dguo"}}