{"action":"created","comment":{"url":"https://api.github.com/repos/scalacenter/scalajs-bundler/pulls/comments/91913830","pull_request_review_id":12421437,"id":91913830,"diff_hunk":"@@ -0,0 +1,40 @@\n+package scalajsbundler\n+\n+import java.io.FileReader\n+import org.scalajs.core.tools.json\n+import org.scalajs.core.tools.json.{JSON, JSONDeserializer, JSONObjExtractor}\n+import sbt._\n+\n+case class NpmPackage(version: String) {\n+  def major: Option[Int] = {\n+    val r = \"\"\"^(\\d+)(\\..*|)$\"\"\".r\n+    r findFirstMatchIn version flatMap { case r(v, x) =>\n+      try {\n+        Some(v.toInt)\n+      } catch {\n+        case e: Exception => None\n+      }\n+    }\n+  }\n+}\n+\n+object NpmPackage {\n+  implicit object NpmPackageDeserializer extends JSONDeserializer[NpmPackage] {\n+    def deserialize(x: JSON): NpmPackage = {\n+      val obj = new JSONObjExtractor(x)\n+      NpmPackage(\n+        obj.fld[String](\"version\")\n+      )\n+    }\n+  }\n+\n+  def getForModule(targetDir: File, module: String): Option[NpmPackage] = {\n+    val webpackPackageJsonFilePath = targetDir / \"node_modules\" / module / \"package.json\"\n+\n+    try {\n+      Some(json.fromJSON[NpmPackage](json.readJSON(new FileReader(webpackPackageJsonFilePath))))\n+    } catch {\n+      case e : Exception => None\n+    }","path":"sbt-scalajs-bundler/src/main/scala/scalajsbundler/NpmPackage.scala","position":38,"original_position":38,"commit_id":"d023342624602c921be28461f3c9f4e7f04365bc","original_commit_id":"d023342624602c921be28461f3c9f4e7f04365bc","user":{"login":"julienrf","id":332812,"avatar_url":"https://avatars.githubusercontent.com/u/332812?v=3","gravatar_id":"","url":"https://api.github.com/users/julienrf","html_url":"https://github.com/julienrf","followers_url":"https://api.github.com/users/julienrf/followers","following_url":"https://api.github.com/users/julienrf/following{/other_user}","gists_url":"https://api.github.com/users/julienrf/gists{/gist_id}","starred_url":"https://api.github.com/users/julienrf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/julienrf/subscriptions","organizations_url":"https://api.github.com/users/julienrf/orgs","repos_url":"https://api.github.com/users/julienrf/repos","events_url":"https://api.github.com/users/julienrf/events{/privacy}","received_events_url":"https://api.github.com/users/julienrf/received_events","type":"User","site_admin":false},"body":"I prefer `Try(…).toOption`","created_at":"2016-12-12T09:50:47Z","updated_at":"2016-12-12T09:53:05Z","html_url":"https://github.com/scalacenter/scalajs-bundler/pull/57#discussion_r91913830","pull_request_url":"https://api.github.com/repos/scalacenter/scalajs-bundler/pulls/57","_links":{"self":{"href":"https://api.github.com/repos/scalacenter/scalajs-bundler/pulls/comments/91913830"},"html":{"href":"https://github.com/scalacenter/scalajs-bundler/pull/57#discussion_r91913830"},"pull_request":{"href":"https://api.github.com/repos/scalacenter/scalajs-bundler/pulls/57"}}},"pull_request":{"url":"https://api.github.com/repos/scalacenter/scalajs-bundler/pulls/57","id":97429361,"html_url":"https://github.com/scalacenter/scalajs-bundler/pull/57","diff_url":"https://github.com/scalacenter/scalajs-bundler/pull/57.diff","patch_url":"https://github.com/scalacenter/scalajs-bundler/pull/57.patch","issue_url":"https://api.github.com/repos/scalacenter/scalajs-bundler/issues/57","number":57,"state":"open","locked":false,"title":"Add support for webpack2 #50","user":{"login":"nstojiljkovic","id":2195612,"avatar_url":"https://avatars.githubusercontent.com/u/2195612?v=3","gravatar_id":"","url":"https://api.github.com/users/nstojiljkovic","html_url":"https://github.com/nstojiljkovic","followers_url":"https://api.github.com/users/nstojiljkovic/followers","following_url":"https://api.github.com/users/nstojiljkovic/following{/other_user}","gists_url":"https://api.github.com/users/nstojiljkovic/gists{/gist_id}","starred_url":"https://api.github.com/users/nstojiljkovic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nstojiljkovic/subscriptions","organizations_url":"https://api.github.com/users/nstojiljkovic/orgs","repos_url":"https://api.github.com/users/nstojiljkovic/repos","events_url":"https://api.github.com/users/nstojiljkovic/events{/privacy}","received_events_url":"https://api.github.com/users/nstojiljkovic/received_events","type":"User","site_admin":false},"body":"Please review :)","created_at":"2016-12-10T16:04:28Z","updated_at":"2016-12-12T09:53:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0af404871ebb7fbdea6a9b7d7a8a697f23d2b558","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/scalacenter/scalajs-bundler/pulls/57/commits","review_comments_url":"https://api.github.com/repos/scalacenter/scalajs-bundler/pulls/57/comments","review_comment_url":"https://api.github.com/repos/scalacenter/scalajs-bundler/pulls/comments{/number}","comments_url":"https://api.github.com/repos/scalacenter/scalajs-bundler/issues/57/comments","statuses_url":"https://api.github.com/repos/scalacenter/scalajs-bundler/statuses/d023342624602c921be28461f3c9f4e7f04365bc","head":{"label":"nstojiljkovic:webpack2","ref":"webpack2","sha":"d023342624602c921be28461f3c9f4e7f04365bc","user":{"login":"nstojiljkovic","id":2195612,"avatar_url":"https://avatars.githubusercontent.com/u/2195612?v=3","gravatar_id":"","url":"https://api.github.com/users/nstojiljkovic","html_url":"https://github.com/nstojiljkovic","followers_url":"https://api.github.com/users/nstojiljkovic/followers","following_url":"https://api.github.com/users/nstojiljkovic/following{/other_user}","gists_url":"https://api.github.com/users/nstojiljkovic/gists{/gist_id}","starred_url":"https://api.github.com/users/nstojiljkovic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nstojiljkovic/subscriptions","organizations_url":"https://api.github.com/users/nstojiljkovic/orgs","repos_url":"https://api.github.com/users/nstojiljkovic/repos","events_url":"https://api.github.com/users/nstojiljkovic/events{/privacy}","received_events_url":"https://api.github.com/users/nstojiljkovic/received_events","type":"User","site_admin":false},"repo":{"id":76121354,"name":"scalajs-bundler","full_name":"nstojiljkovic/scalajs-bundler","owner":{"login":"nstojiljkovic","id":2195612,"avatar_url":"https://avatars.githubusercontent.com/u/2195612?v=3","gravatar_id":"","url":"https://api.github.com/users/nstojiljkovic","html_url":"https://github.com/nstojiljkovic","followers_url":"https://api.github.com/users/nstojiljkovic/followers","following_url":"https://api.github.com/users/nstojiljkovic/following{/other_user}","gists_url":"https://api.github.com/users/nstojiljkovic/gists{/gist_id}","starred_url":"https://api.github.com/users/nstojiljkovic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nstojiljkovic/subscriptions","organizations_url":"https://api.github.com/users/nstojiljkovic/orgs","repos_url":"https://api.github.com/users/nstojiljkovic/repos","events_url":"https://api.github.com/users/nstojiljkovic/events{/privacy}","received_events_url":"https://api.github.com/users/nstojiljkovic/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nstojiljkovic/scalajs-bundler","description":null,"fork":true,"url":"https://api.github.com/repos/nstojiljkovic/scalajs-bundler","forks_url":"https://api.github.com/repos/nstojiljkovic/scalajs-bundler/forks","keys_url":"https://api.github.com/repos/nstojiljkovic/scalajs-bundler/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nstojiljkovic/scalajs-bundler/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nstojiljkovic/scalajs-bundler/teams","hooks_url":"https://api.github.com/repos/nstojiljkovic/scalajs-bundler/hooks","issue_events_url":"https://api.github.com/repos/nstojiljkovic/scalajs-bundler/issues/events{/number}","events_url":"https://api.github.com/repos/nstojiljkovic/scalajs-bundler/events","assignees_url":"https://api.github.com/repos/nstojiljkovic/scalajs-bundler/assignees{/user}","branches_url":"https://api.github.com/repos/nstojiljkovic/scalajs-bundler/branches{/branch}","tags_url":"https://api.github.com/repos/nstojiljkovic/scalajs-bundler/tags","blobs_url":"https://api.github.com/repos/nstojiljkovic/scalajs-bundler/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nstojiljkovic/scalajs-bundler/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nstojiljkovic/scalajs-bundler/git/refs{/sha}","trees_url":"https://api.github.com/repos/nstojiljkovic/scalajs-bundler/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nstojiljkovic/scalajs-bundler/statuses/{sha}","languages_url":"https://api.github.com/repos/nstojiljkovic/scalajs-bundler/languages","stargazers_url":"https://api.github.com/repos/nstojiljkovic/scalajs-bundler/stargazers","contributors_url":"https://api.github.com/repos/nstojiljkovic/scalajs-bundler/contributors","subscribers_url":"https://api.github.com/repos/nstojiljkovic/scalajs-bundler/subscribers","subscription_url":"https://api.github.com/repos/nstojiljkovic/scalajs-bundler/subscription","commits_url":"https://api.github.com/repos/nstojiljkovic/scalajs-bundler/commits{/sha}","git_commits_url":"https://api.github.com/repos/nstojiljkovic/scalajs-bundler/git/commits{/sha}","comments_url":"https://api.github.com/repos/nstojiljkovic/scalajs-bundler/comments{/number}","issue_comment_url":"https://api.github.com/repos/nstojiljkovic/scalajs-bundler/issues/comments{/number}","contents_url":"https://api.github.com/repos/nstojiljkovic/scalajs-bundler/contents/{+path}","compare_url":"https://api.github.com/repos/nstojiljkovic/scalajs-bundler/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nstojiljkovic/scalajs-bundler/merges","archive_url":"https://api.github.com/repos/nstojiljkovic/scalajs-bundler/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nstojiljkovic/scalajs-bundler/downloads","issues_url":"https://api.github.com/repos/nstojiljkovic/scalajs-bundler/issues{/number}","pulls_url":"https://api.github.com/repos/nstojiljkovic/scalajs-bundler/pulls{/number}","milestones_url":"https://api.github.com/repos/nstojiljkovic/scalajs-bundler/milestones{/number}","notifications_url":"https://api.github.com/repos/nstojiljkovic/scalajs-bundler/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nstojiljkovic/scalajs-bundler/labels{/name}","releases_url":"https://api.github.com/repos/nstojiljkovic/scalajs-bundler/releases{/id}","deployments_url":"https://api.github.com/repos/nstojiljkovic/scalajs-bundler/deployments","created_at":"2016-12-10T15:37:37Z","updated_at":"2016-12-10T15:37:38Z","pushed_at":"2016-12-10T16:03:47Z","git_url":"git://github.com/nstojiljkovic/scalajs-bundler.git","ssh_url":"git@github.com:nstojiljkovic/scalajs-bundler.git","clone_url":"https://github.com/nstojiljkovic/scalajs-bundler.git","svn_url":"https://github.com/nstojiljkovic/scalajs-bundler","homepage":"https://scalacenter.github.io/scalajs-bundler","size":279,"stargazers_count":0,"watchers_count":0,"language":"Scala","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":"scalacenter:master","ref":"master","sha":"133bab487bb126e3420f7634280004b2b1006c3b","user":{"login":"scalacenter","id":16118980,"avatar_url":"https://avatars.githubusercontent.com/u/16118980?v=3","gravatar_id":"","url":"https://api.github.com/users/scalacenter","html_url":"https://github.com/scalacenter","followers_url":"https://api.github.com/users/scalacenter/followers","following_url":"https://api.github.com/users/scalacenter/following{/other_user}","gists_url":"https://api.github.com/users/scalacenter/gists{/gist_id}","starred_url":"https://api.github.com/users/scalacenter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scalacenter/subscriptions","organizations_url":"https://api.github.com/users/scalacenter/orgs","repos_url":"https://api.github.com/users/scalacenter/repos","events_url":"https://api.github.com/users/scalacenter/events{/privacy}","received_events_url":"https://api.github.com/users/scalacenter/received_events","type":"Organization","site_admin":false},"repo":{"id":68813853,"name":"scalajs-bundler","full_name":"scalacenter/scalajs-bundler","owner":{"login":"scalacenter","id":16118980,"avatar_url":"https://avatars.githubusercontent.com/u/16118980?v=3","gravatar_id":"","url":"https://api.github.com/users/scalacenter","html_url":"https://github.com/scalacenter","followers_url":"https://api.github.com/users/scalacenter/followers","following_url":"https://api.github.com/users/scalacenter/following{/other_user}","gists_url":"https://api.github.com/users/scalacenter/gists{/gist_id}","starred_url":"https://api.github.com/users/scalacenter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scalacenter/subscriptions","organizations_url":"https://api.github.com/users/scalacenter/orgs","repos_url":"https://api.github.com/users/scalacenter/repos","events_url":"https://api.github.com/users/scalacenter/events{/privacy}","received_events_url":"https://api.github.com/users/scalacenter/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/scalacenter/scalajs-bundler","description":null,"fork":false,"url":"https://api.github.com/repos/scalacenter/scalajs-bundler","forks_url":"https://api.github.com/repos/scalacenter/scalajs-bundler/forks","keys_url":"https://api.github.com/repos/scalacenter/scalajs-bundler/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scalacenter/scalajs-bundler/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scalacenter/scalajs-bundler/teams","hooks_url":"https://api.github.com/repos/scalacenter/scalajs-bundler/hooks","issue_events_url":"https://api.github.com/repos/scalacenter/scalajs-bundler/issues/events{/number}","events_url":"https://api.github.com/repos/scalacenter/scalajs-bundler/events","assignees_url":"https://api.github.com/repos/scalacenter/scalajs-bundler/assignees{/user}","branches_url":"https://api.github.com/repos/scalacenter/scalajs-bundler/branches{/branch}","tags_url":"https://api.github.com/repos/scalacenter/scalajs-bundler/tags","blobs_url":"https://api.github.com/repos/scalacenter/scalajs-bundler/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scalacenter/scalajs-bundler/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scalacenter/scalajs-bundler/git/refs{/sha}","trees_url":"https://api.github.com/repos/scalacenter/scalajs-bundler/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scalacenter/scalajs-bundler/statuses/{sha}","languages_url":"https://api.github.com/repos/scalacenter/scalajs-bundler/languages","stargazers_url":"https://api.github.com/repos/scalacenter/scalajs-bundler/stargazers","contributors_url":"https://api.github.com/repos/scalacenter/scalajs-bundler/contributors","subscribers_url":"https://api.github.com/repos/scalacenter/scalajs-bundler/subscribers","subscription_url":"https://api.github.com/repos/scalacenter/scalajs-bundler/subscription","commits_url":"https://api.github.com/repos/scalacenter/scalajs-bundler/commits{/sha}","git_commits_url":"https://api.github.com/repos/scalacenter/scalajs-bundler/git/commits{/sha}","comments_url":"https://api.github.com/repos/scalacenter/scalajs-bundler/comments{/number}","issue_comment_url":"https://api.github.com/repos/scalacenter/scalajs-bundler/issues/comments{/number}","contents_url":"https://api.github.com/repos/scalacenter/scalajs-bundler/contents/{+path}","compare_url":"https://api.github.com/repos/scalacenter/scalajs-bundler/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scalacenter/scalajs-bundler/merges","archive_url":"https://api.github.com/repos/scalacenter/scalajs-bundler/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scalacenter/scalajs-bundler/downloads","issues_url":"https://api.github.com/repos/scalacenter/scalajs-bundler/issues{/number}","pulls_url":"https://api.github.com/repos/scalacenter/scalajs-bundler/pulls{/number}","milestones_url":"https://api.github.com/repos/scalacenter/scalajs-bundler/milestones{/number}","notifications_url":"https://api.github.com/repos/scalacenter/scalajs-bundler/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scalacenter/scalajs-bundler/labels{/name}","releases_url":"https://api.github.com/repos/scalacenter/scalajs-bundler/releases{/id}","deployments_url":"https://api.github.com/repos/scalacenter/scalajs-bundler/deployments","created_at":"2016-09-21T12:18:53Z","updated_at":"2016-12-09T17:39:05Z","pushed_at":"2016-12-10T19:45:24Z","git_url":"git://github.com/scalacenter/scalajs-bundler.git","ssh_url":"git@github.com:scalacenter/scalajs-bundler.git","clone_url":"https://github.com/scalacenter/scalajs-bundler.git","svn_url":"https://github.com/scalacenter/scalajs-bundler","homepage":"https://scalacenter.github.io/scalajs-bundler","size":283,"stargazers_count":39,"watchers_count":39,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":7,"mirror_url":null,"open_issues_count":10,"forks":7,"open_issues":10,"watchers":39,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scalacenter/scalajs-bundler/pulls/57"},"html":{"href":"https://github.com/scalacenter/scalajs-bundler/pull/57"},"issue":{"href":"https://api.github.com/repos/scalacenter/scalajs-bundler/issues/57"},"comments":{"href":"https://api.github.com/repos/scalacenter/scalajs-bundler/issues/57/comments"},"review_comments":{"href":"https://api.github.com/repos/scalacenter/scalajs-bundler/pulls/57/comments"},"review_comment":{"href":"https://api.github.com/repos/scalacenter/scalajs-bundler/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/scalacenter/scalajs-bundler/pulls/57/commits"},"statuses":{"href":"https://api.github.com/repos/scalacenter/scalajs-bundler/statuses/d023342624602c921be28461f3c9f4e7f04365bc"}}}}
{"actor":{"display_login":"julienrf"}}