{"action":"created","comment":{"url":"https://api.github.com/repos/yarnpkg/yarn/pulls/comments/87394030","pull_request_review_id":8007717,"id":87394030,"diff_hunk":"@@ -51,16 +51,46 @@ export class Add extends Install {\n         optional: false,\n       });\n     }\n+    return requestsWithArgs;\n+  }\n \n-    return Promise.resolve({\n-      patterns: patterns.concat(this.args),\n-      requests: requestsWithArgs,\n-    });\n+  preparePatterns(\n+    patterns: Array<string>,\n+  ): Array<string> {\n+    const {exact, tilde} = this.flags;\n+    const preparedPatterns = patterns.slice();\n+    for (const pattern of this.resolver.dedupePatterns(this.args)) {\n+      const pkg = this.resolver.getResolvedPattern(pattern);\n+      invariant(pkg, `missing package ${pattern}`);\n+\n+      const parts = PackageRequest.normalizePattern(pattern);","path":"src/cli/commands/add.js","position":44,"original_position":44,"commit_id":"1a8e46bd24e49d576b29c966b767c44e2c807d48","original_commit_id":"1a8e46bd24e49d576b29c966b767c44e2c807d48","user":{"login":"kittens","id":853712,"avatar_url":"https://avatars.githubusercontent.com/u/853712?v=3","gravatar_id":"","url":"https://api.github.com/users/kittens","html_url":"https://github.com/kittens","followers_url":"https://api.github.com/users/kittens/followers","following_url":"https://api.github.com/users/kittens/following{/other_user}","gists_url":"https://api.github.com/users/kittens/gists{/gist_id}","starred_url":"https://api.github.com/users/kittens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kittens/subscriptions","organizations_url":"https://api.github.com/users/kittens/orgs","repos_url":"https://api.github.com/users/kittens/repos","events_url":"https://api.github.com/users/kittens/events{/privacy}","received_events_url":"https://api.github.com/users/kittens/received_events","type":"User","site_admin":false},"body":"A lot of this code is copied from this same file, can we colocate this into a method that's shared?","created_at":"2016-11-10T13:34:03Z","updated_at":"2016-11-10T13:34:03Z","html_url":"https://github.com/yarnpkg/yarn/pull/1757#discussion_r87394030","pull_request_url":"https://api.github.com/repos/yarnpkg/yarn/pulls/1757","_links":{"self":{"href":"https://api.github.com/repos/yarnpkg/yarn/pulls/comments/87394030"},"html":{"href":"https://github.com/yarnpkg/yarn/pull/1757#discussion_r87394030"},"pull_request":{"href":"https://api.github.com/repos/yarnpkg/yarn/pulls/1757"}}},"pull_request":{"url":"https://api.github.com/repos/yarnpkg/yarn/pulls/1757","id":93024398,"html_url":"https://github.com/yarnpkg/yarn/pull/1757","diff_url":"https://github.com/yarnpkg/yarn/pull/1757.diff","patch_url":"https://github.com/yarnpkg/yarn/pull/1757.patch","issue_url":"https://api.github.com/repos/yarnpkg/yarn/issues/1757","number":1757,"state":"open","locked":false,"title":"Add integrity refactor","user":{"login":"bestander","id":2121048,"avatar_url":"https://avatars.githubusercontent.com/u/2121048?v=3","gravatar_id":"","url":"https://api.github.com/users/bestander","html_url":"https://github.com/bestander","followers_url":"https://api.github.com/users/bestander/followers","following_url":"https://api.github.com/users/bestander/following{/other_user}","gists_url":"https://api.github.com/users/bestander/gists{/gist_id}","starred_url":"https://api.github.com/users/bestander/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bestander/subscriptions","organizations_url":"https://api.github.com/users/bestander/orgs","repos_url":"https://api.github.com/users/bestander/repos","events_url":"https://api.github.com/users/bestander/events{/privacy}","received_events_url":"https://api.github.com/users/bestander/received_events","type":"User","site_admin":false},"body":"Fixes #1733\r\n\r\n**Summary**\r\n\r\n`add` command now generates integrity hash and has correct package.js and yarn.lock \r\n\r\n**Test plan**\r\n```\r\nbestander@DESKTOP-9BB67ID:/mnt/c/Users/besta/work/temp$ ../yarn/bin/yarn add left-pad\r\nyarn add v0.17.0-0\r\nwarning No license field\r\n[1/4] Resolving packages...\r\n[2/4] Fetching packages...\r\n[3/4] Linking dependencies...\r\n[4/4] Building fresh packages...\r\nsuccess Saved lockfile.\r\nsuccess Saved 1 new dependency.\r\n└─ left-pad@1.1.3\r\nwarning No license field\r\nDone in 0.52s.\r\nbestander@DESKTOP-9BB67ID:/mnt/c/Users/besta/work/temp$ ../yarn/bin/yarn install\r\nyarn install v0.17.0-0\r\nwarning No license field\r\n[1/4] Resolving packages...\r\nsuccess Already up-to-date.\r\nDone in 0.14s.\r\n```\r\n","created_at":"2016-11-09T19:33:09Z","updated_at":"2016-11-10T13:34:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"44ad6d7c05786ecc87094d38d736d895c2b44ea9","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/yarnpkg/yarn/pulls/1757/commits","review_comments_url":"https://api.github.com/repos/yarnpkg/yarn/pulls/1757/comments","review_comment_url":"https://api.github.com/repos/yarnpkg/yarn/pulls/comments{/number}","comments_url":"https://api.github.com/repos/yarnpkg/yarn/issues/1757/comments","statuses_url":"https://api.github.com/repos/yarnpkg/yarn/statuses/1a8e46bd24e49d576b29c966b767c44e2c807d48","head":{"label":"bestander:add-integrity-refactor","ref":"add-integrity-refactor","sha":"1a8e46bd24e49d576b29c966b767c44e2c807d48","user":{"login":"bestander","id":2121048,"avatar_url":"https://avatars.githubusercontent.com/u/2121048?v=3","gravatar_id":"","url":"https://api.github.com/users/bestander","html_url":"https://github.com/bestander","followers_url":"https://api.github.com/users/bestander/followers","following_url":"https://api.github.com/users/bestander/following{/other_user}","gists_url":"https://api.github.com/users/bestander/gists{/gist_id}","starred_url":"https://api.github.com/users/bestander/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bestander/subscriptions","organizations_url":"https://api.github.com/users/bestander/orgs","repos_url":"https://api.github.com/users/bestander/repos","events_url":"https://api.github.com/users/bestander/events{/privacy}","received_events_url":"https://api.github.com/users/bestander/received_events","type":"User","site_admin":false},"repo":{"id":71127397,"name":"yarn","full_name":"bestander/yarn","owner":{"login":"bestander","id":2121048,"avatar_url":"https://avatars.githubusercontent.com/u/2121048?v=3","gravatar_id":"","url":"https://api.github.com/users/bestander","html_url":"https://github.com/bestander","followers_url":"https://api.github.com/users/bestander/followers","following_url":"https://api.github.com/users/bestander/following{/other_user}","gists_url":"https://api.github.com/users/bestander/gists{/gist_id}","starred_url":"https://api.github.com/users/bestander/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bestander/subscriptions","organizations_url":"https://api.github.com/users/bestander/orgs","repos_url":"https://api.github.com/users/bestander/repos","events_url":"https://api.github.com/users/bestander/events{/privacy}","received_events_url":"https://api.github.com/users/bestander/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bestander/yarn","description":"📦🐈 Fast, reliable, and secure dependency management.","fork":true,"url":"https://api.github.com/repos/bestander/yarn","forks_url":"https://api.github.com/repos/bestander/yarn/forks","keys_url":"https://api.github.com/repos/bestander/yarn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bestander/yarn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bestander/yarn/teams","hooks_url":"https://api.github.com/repos/bestander/yarn/hooks","issue_events_url":"https://api.github.com/repos/bestander/yarn/issues/events{/number}","events_url":"https://api.github.com/repos/bestander/yarn/events","assignees_url":"https://api.github.com/repos/bestander/yarn/assignees{/user}","branches_url":"https://api.github.com/repos/bestander/yarn/branches{/branch}","tags_url":"https://api.github.com/repos/bestander/yarn/tags","blobs_url":"https://api.github.com/repos/bestander/yarn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bestander/yarn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bestander/yarn/git/refs{/sha}","trees_url":"https://api.github.com/repos/bestander/yarn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bestander/yarn/statuses/{sha}","languages_url":"https://api.github.com/repos/bestander/yarn/languages","stargazers_url":"https://api.github.com/repos/bestander/yarn/stargazers","contributors_url":"https://api.github.com/repos/bestander/yarn/contributors","subscribers_url":"https://api.github.com/repos/bestander/yarn/subscribers","subscription_url":"https://api.github.com/repos/bestander/yarn/subscription","commits_url":"https://api.github.com/repos/bestander/yarn/commits{/sha}","git_commits_url":"https://api.github.com/repos/bestander/yarn/git/commits{/sha}","comments_url":"https://api.github.com/repos/bestander/yarn/comments{/number}","issue_comment_url":"https://api.github.com/repos/bestander/yarn/issues/comments{/number}","contents_url":"https://api.github.com/repos/bestander/yarn/contents/{+path}","compare_url":"https://api.github.com/repos/bestander/yarn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bestander/yarn/merges","archive_url":"https://api.github.com/repos/bestander/yarn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bestander/yarn/downloads","issues_url":"https://api.github.com/repos/bestander/yarn/issues{/number}","pulls_url":"https://api.github.com/repos/bestander/yarn/pulls{/number}","milestones_url":"https://api.github.com/repos/bestander/yarn/milestones{/number}","notifications_url":"https://api.github.com/repos/bestander/yarn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bestander/yarn/labels{/name}","releases_url":"https://api.github.com/repos/bestander/yarn/releases{/id}","deployments_url":"https://api.github.com/repos/bestander/yarn/deployments","created_at":"2016-10-17T10:38:28Z","updated_at":"2016-10-17T10:38:36Z","pushed_at":"2016-11-10T11:56:07Z","git_url":"git://github.com/bestander/yarn.git","ssh_url":"git@github.com:bestander/yarn.git","clone_url":"https://github.com/bestander/yarn.git","svn_url":"https://github.com/bestander/yarn","homepage":"https://yarnpkg.com","size":41711,"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":"e089081680cd84538adde9dcafa6df3a4e7c32ac","user":{"login":"yarnpkg","id":22247014,"avatar_url":"https://avatars.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://avatars.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":"2016-11-10T13:08:30Z","pushed_at":"2016-11-10T13:32:35Z","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":52224,"stargazers_count":18883,"watchers_count":18883,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":621,"mirror_url":null,"open_issues_count":407,"forks":621,"open_issues":407,"watchers":18883,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/yarnpkg/yarn/pulls/1757"},"html":{"href":"https://github.com/yarnpkg/yarn/pull/1757"},"issue":{"href":"https://api.github.com/repos/yarnpkg/yarn/issues/1757"},"comments":{"href":"https://api.github.com/repos/yarnpkg/yarn/issues/1757/comments"},"review_comments":{"href":"https://api.github.com/repos/yarnpkg/yarn/pulls/1757/comments"},"review_comment":{"href":"https://api.github.com/repos/yarnpkg/yarn/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/yarnpkg/yarn/pulls/1757/commits"},"statuses":{"href":"https://api.github.com/repos/yarnpkg/yarn/statuses/1a8e46bd24e49d576b29c966b767c44e2c807d48"}}}}
{"actor":{"display_login":"kittens"}}