{"action":"created","comment":{"url":"https://api.github.com/repos/chrisprice/babili/pulls/comments/79867673","id":79867673,"diff_hunk":"@@ -78,62 +161,54 @@ function test(name, callback) {\n   });\n }\n \n-test(\"babili\", function (code) {\n-  return babel.transform(code, {\n-    sourceType: \"script\",\n-    presets: [require(\"../packages/babel-preset-babili\")],\n-    comments: false,\n-  }).code;\n-});\n-\n-test(\"closure\", function (/*code*/) {\n-  return child.execSync(\n-    \"java -jar \" + path.join(__dirname, \"gcc.jar\") + \" --env=CUSTOM --jscomp_off=* --js \" + filename\n-  ).toString();\n-});\n-\n-test(\"closure js\", function (code) {\n-  const flags = {\n-    jsCode: [{ src: code }],\n-    env: \"CUSTOM\",\n-  };\n-  const out = compile(flags);\n-  return out.compiledCode;\n-});\n+function processResults() {\n+  results = results.sort(function (a, b) {\n+    return a.gzip > b.gzip;\n+  });\n \n-test(\"uglify\", function (code) {\n-  return uglify.minify(code, {\n-    fromString: true,\n-  }).code;\n-});\n+  results.forEach(function (result, i) {\n+    let row = [\n+      chalk.bold(result.name),\n+      bytes(result.raw),\n+      Math.round(((code.length / result.raw) * 100) - 100) + \"%\",\n+      bytes(result.gzip),\n+      Math.round(((gzippedCode.length / result.gzip) * 100) - 100) + \"%\",\n+      Math.round(result.parse) + \"ms\",\n+      Math.round(result.run) + \"ms\",\n+    ];\n+\n+    let style = chalk.yellow;\n+    if (i === 0) {\n+      style = chalk.green;\n+    }\n+    if (i === results.length - 1) {\n+      style = chalk.red;\n+    }\n+    row = row.map(function (item) {\n+      return style(item);\n+    });\n+\n+    table.push(row);\n+  });\n \n-results = results.sort(function (a, b) {\n-  return a.gzip > b.gzip;\n-});\n+  console.log(table.toString());\n+}\n \n-results.forEach(function (result, i) {\n-  let row = [\n-    chalk.bold(result.name),\n-    bytes(result.raw),\n-    Math.round(((code.length / result.raw) * 100) - 100) + \"%\",\n-    bytes(result.gzip),\n-    Math.round(((gzippedCode.length / result.gzip) * 100) - 100) + \"%\",\n-    Math.round(result.parse) + \"ms\",\n-    Math.round(result.run) + \"ms\",\n-  ];\n-\n-  let style = chalk.yellow;\n-  if (i === 0) {\n-    style = chalk.green;\n+function pathExists(path) {\n+  try {\n+    return fs.statSync(path);\n   }\n-  if (i === results.length - 1) {\n-    style = chalk.red;\n+  catch(e) {\n+\treturn false;\n   }\n-  row = row.map(function (item) {\n-    return style(item);\n-  });\n+}\n \n-  table.push(row);\n-});\n+if(!pathExists(path.join(pathToScripts, \"node_modules\", packagename)) || !script.offline) {\n+  installPackage();\n+}\n+\n+checkFile();\n+testFile();\n+processResults();\n \n-console.log(table.toString());\n+!script.offline && uninstallPackage();","path":"scripts/benchmark.js","position":221,"original_position":221,"commit_id":"25423c8415d2e26c6f5e9c27707e2bfddee4af8f","original_commit_id":"25423c8415d2e26c6f5e9c27707e2bfddee4af8f","user":{"login":"chrisprice","id":433457,"avatar_url":"https://avatars.githubusercontent.com/u/433457?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisprice","html_url":"https://github.com/chrisprice","followers_url":"https://api.github.com/users/chrisprice/followers","following_url":"https://api.github.com/users/chrisprice/following{/other_user}","gists_url":"https://api.github.com/users/chrisprice/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisprice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisprice/subscriptions","organizations_url":"https://api.github.com/users/chrisprice/orgs","repos_url":"https://api.github.com/users/chrisprice/repos","events_url":"https://api.github.com/users/chrisprice/events{/privacy}","received_events_url":"https://api.github.com/users/chrisprice/received_events","type":"User","site_admin":false},"body":"And maybe move it into the function?","created_at":"2016-09-21T15:53:42Z","updated_at":"2016-09-21T15:53:42Z","html_url":"https://github.com/chrisprice/babili/pull/2#discussion_r79867673","pull_request_url":"https://api.github.com/repos/chrisprice/babili/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/chrisprice/babili/pulls/comments/79867673"},"html":{"href":"https://github.com/chrisprice/babili/pull/2#discussion_r79867673"},"pull_request":{"href":"https://api.github.com/repos/chrisprice/babili/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/chrisprice/babili/pulls/2","id":86187464,"html_url":"https://github.com/chrisprice/babili/pull/2","diff_url":"https://github.com/chrisprice/babili/pull/2.diff","patch_url":"https://github.com/chrisprice/babili/pull/2.patch","issue_url":"https://api.github.com/repos/chrisprice/babili/issues/2","number":2,"state":"open","locked":false,"title":"babili npm package testing","user":{"login":"garyjN7","id":17061859,"avatar_url":"https://avatars.githubusercontent.com/u/17061859?v=3","gravatar_id":"","url":"https://api.github.com/users/garyjN7","html_url":"https://github.com/garyjN7","followers_url":"https://api.github.com/users/garyjN7/followers","following_url":"https://api.github.com/users/garyjN7/following{/other_user}","gists_url":"https://api.github.com/users/garyjN7/gists{/gist_id}","starred_url":"https://api.github.com/users/garyjN7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garyjN7/subscriptions","organizations_url":"https://api.github.com/users/garyjN7/orgs","repos_url":"https://api.github.com/users/garyjN7/repos","events_url":"https://api.github.com/users/garyjN7/events{/privacy}","received_events_url":"https://api.github.com/users/garyjN7/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-09-21T15:35:43Z","updated_at":"2016-09-21T15:53:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"de61426eaf16348f69c6df74d6d8f747949f7698","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/chrisprice/babili/pulls/2/commits","review_comments_url":"https://api.github.com/repos/chrisprice/babili/pulls/2/comments","review_comment_url":"https://api.github.com/repos/chrisprice/babili/pulls/comments{/number}","comments_url":"https://api.github.com/repos/chrisprice/babili/issues/2/comments","statuses_url":"https://api.github.com/repos/chrisprice/babili/statuses/25423c8415d2e26c6f5e9c27707e2bfddee4af8f","head":{"label":"garyjN7:master","ref":"master","sha":"25423c8415d2e26c6f5e9c27707e2bfddee4af8f","user":{"login":"garyjN7","id":17061859,"avatar_url":"https://avatars.githubusercontent.com/u/17061859?v=3","gravatar_id":"","url":"https://api.github.com/users/garyjN7","html_url":"https://github.com/garyjN7","followers_url":"https://api.github.com/users/garyjN7/followers","following_url":"https://api.github.com/users/garyjN7/following{/other_user}","gists_url":"https://api.github.com/users/garyjN7/gists{/gist_id}","starred_url":"https://api.github.com/users/garyjN7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garyjN7/subscriptions","organizations_url":"https://api.github.com/users/garyjN7/orgs","repos_url":"https://api.github.com/users/garyjN7/repos","events_url":"https://api.github.com/users/garyjN7/events{/privacy}","received_events_url":"https://api.github.com/users/garyjN7/received_events","type":"User","site_admin":false},"repo":{"id":68700053,"name":"babili","full_name":"garyjN7/babili","owner":{"login":"garyjN7","id":17061859,"avatar_url":"https://avatars.githubusercontent.com/u/17061859?v=3","gravatar_id":"","url":"https://api.github.com/users/garyjN7","html_url":"https://github.com/garyjN7","followers_url":"https://api.github.com/users/garyjN7/followers","following_url":"https://api.github.com/users/garyjN7/following{/other_user}","gists_url":"https://api.github.com/users/garyjN7/gists{/gist_id}","starred_url":"https://api.github.com/users/garyjN7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garyjN7/subscriptions","organizations_url":"https://api.github.com/users/garyjN7/orgs","repos_url":"https://api.github.com/users/garyjN7/repos","events_url":"https://api.github.com/users/garyjN7/events{/privacy}","received_events_url":"https://api.github.com/users/garyjN7/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/garyjN7/babili","description":":scissors: An ES6+ aware minifier based on the Babel toolchain (beta)","fork":true,"url":"https://api.github.com/repos/garyjN7/babili","forks_url":"https://api.github.com/repos/garyjN7/babili/forks","keys_url":"https://api.github.com/repos/garyjN7/babili/keys{/key_id}","collaborators_url":"https://api.github.com/repos/garyjN7/babili/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/garyjN7/babili/teams","hooks_url":"https://api.github.com/repos/garyjN7/babili/hooks","issue_events_url":"https://api.github.com/repos/garyjN7/babili/issues/events{/number}","events_url":"https://api.github.com/repos/garyjN7/babili/events","assignees_url":"https://api.github.com/repos/garyjN7/babili/assignees{/user}","branches_url":"https://api.github.com/repos/garyjN7/babili/branches{/branch}","tags_url":"https://api.github.com/repos/garyjN7/babili/tags","blobs_url":"https://api.github.com/repos/garyjN7/babili/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/garyjN7/babili/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/garyjN7/babili/git/refs{/sha}","trees_url":"https://api.github.com/repos/garyjN7/babili/git/trees{/sha}","statuses_url":"https://api.github.com/repos/garyjN7/babili/statuses/{sha}","languages_url":"https://api.github.com/repos/garyjN7/babili/languages","stargazers_url":"https://api.github.com/repos/garyjN7/babili/stargazers","contributors_url":"https://api.github.com/repos/garyjN7/babili/contributors","subscribers_url":"https://api.github.com/repos/garyjN7/babili/subscribers","subscription_url":"https://api.github.com/repos/garyjN7/babili/subscription","commits_url":"https://api.github.com/repos/garyjN7/babili/commits{/sha}","git_commits_url":"https://api.github.com/repos/garyjN7/babili/git/commits{/sha}","comments_url":"https://api.github.com/repos/garyjN7/babili/comments{/number}","issue_comment_url":"https://api.github.com/repos/garyjN7/babili/issues/comments{/number}","contents_url":"https://api.github.com/repos/garyjN7/babili/contents/{+path}","compare_url":"https://api.github.com/repos/garyjN7/babili/compare/{base}...{head}","merges_url":"https://api.github.com/repos/garyjN7/babili/merges","archive_url":"https://api.github.com/repos/garyjN7/babili/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/garyjN7/babili/downloads","issues_url":"https://api.github.com/repos/garyjN7/babili/issues{/number}","pulls_url":"https://api.github.com/repos/garyjN7/babili/pulls{/number}","milestones_url":"https://api.github.com/repos/garyjN7/babili/milestones{/number}","notifications_url":"https://api.github.com/repos/garyjN7/babili/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/garyjN7/babili/labels{/name}","releases_url":"https://api.github.com/repos/garyjN7/babili/releases{/id}","deployments_url":"https://api.github.com/repos/garyjN7/babili/deployments","created_at":"2016-09-20T10:15:01Z","updated_at":"2016-09-20T10:15:03Z","pushed_at":"2016-09-21T15:30:04Z","git_url":"git://github.com/garyjN7/babili.git","ssh_url":"git@github.com:garyjN7/babili.git","clone_url":"https://github.com/garyjN7/babili.git","svn_url":"https://github.com/garyjN7/babili","homepage":"https://babeljs.io/repl","size":9395,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"chrisprice:master","ref":"master","sha":"bfd6004426821b725be4d1a7bd5d08630f0cd5a3","user":{"login":"chrisprice","id":433457,"avatar_url":"https://avatars.githubusercontent.com/u/433457?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisprice","html_url":"https://github.com/chrisprice","followers_url":"https://api.github.com/users/chrisprice/followers","following_url":"https://api.github.com/users/chrisprice/following{/other_user}","gists_url":"https://api.github.com/users/chrisprice/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisprice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisprice/subscriptions","organizations_url":"https://api.github.com/users/chrisprice/orgs","repos_url":"https://api.github.com/users/chrisprice/repos","events_url":"https://api.github.com/users/chrisprice/events{/privacy}","received_events_url":"https://api.github.com/users/chrisprice/received_events","type":"User","site_admin":false},"repo":{"id":68711051,"name":"babili","full_name":"chrisprice/babili","owner":{"login":"chrisprice","id":433457,"avatar_url":"https://avatars.githubusercontent.com/u/433457?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisprice","html_url":"https://github.com/chrisprice","followers_url":"https://api.github.com/users/chrisprice/followers","following_url":"https://api.github.com/users/chrisprice/following{/other_user}","gists_url":"https://api.github.com/users/chrisprice/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisprice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisprice/subscriptions","organizations_url":"https://api.github.com/users/chrisprice/orgs","repos_url":"https://api.github.com/users/chrisprice/repos","events_url":"https://api.github.com/users/chrisprice/events{/privacy}","received_events_url":"https://api.github.com/users/chrisprice/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/chrisprice/babili","description":":scissors: An ES6+ aware minifier based on the Babel toolchain (beta)","fork":true,"url":"https://api.github.com/repos/chrisprice/babili","forks_url":"https://api.github.com/repos/chrisprice/babili/forks","keys_url":"https://api.github.com/repos/chrisprice/babili/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chrisprice/babili/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chrisprice/babili/teams","hooks_url":"https://api.github.com/repos/chrisprice/babili/hooks","issue_events_url":"https://api.github.com/repos/chrisprice/babili/issues/events{/number}","events_url":"https://api.github.com/repos/chrisprice/babili/events","assignees_url":"https://api.github.com/repos/chrisprice/babili/assignees{/user}","branches_url":"https://api.github.com/repos/chrisprice/babili/branches{/branch}","tags_url":"https://api.github.com/repos/chrisprice/babili/tags","blobs_url":"https://api.github.com/repos/chrisprice/babili/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chrisprice/babili/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chrisprice/babili/git/refs{/sha}","trees_url":"https://api.github.com/repos/chrisprice/babili/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chrisprice/babili/statuses/{sha}","languages_url":"https://api.github.com/repos/chrisprice/babili/languages","stargazers_url":"https://api.github.com/repos/chrisprice/babili/stargazers","contributors_url":"https://api.github.com/repos/chrisprice/babili/contributors","subscribers_url":"https://api.github.com/repos/chrisprice/babili/subscribers","subscription_url":"https://api.github.com/repos/chrisprice/babili/subscription","commits_url":"https://api.github.com/repos/chrisprice/babili/commits{/sha}","git_commits_url":"https://api.github.com/repos/chrisprice/babili/git/commits{/sha}","comments_url":"https://api.github.com/repos/chrisprice/babili/comments{/number}","issue_comment_url":"https://api.github.com/repos/chrisprice/babili/issues/comments{/number}","contents_url":"https://api.github.com/repos/chrisprice/babili/contents/{+path}","compare_url":"https://api.github.com/repos/chrisprice/babili/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chrisprice/babili/merges","archive_url":"https://api.github.com/repos/chrisprice/babili/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chrisprice/babili/downloads","issues_url":"https://api.github.com/repos/chrisprice/babili/issues{/number}","pulls_url":"https://api.github.com/repos/chrisprice/babili/pulls{/number}","milestones_url":"https://api.github.com/repos/chrisprice/babili/milestones{/number}","notifications_url":"https://api.github.com/repos/chrisprice/babili/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chrisprice/babili/labels{/name}","releases_url":"https://api.github.com/repos/chrisprice/babili/releases{/id}","deployments_url":"https://api.github.com/repos/chrisprice/babili/deployments","created_at":"2016-09-20T12:46:56Z","updated_at":"2016-09-20T12:46:57Z","pushed_at":"2016-09-21T15:35:43Z","git_url":"git://github.com/chrisprice/babili.git","ssh_url":"git@github.com:chrisprice/babili.git","clone_url":"https://github.com/chrisprice/babili.git","svn_url":"https://github.com/chrisprice/babili","homepage":"https://babeljs.io/repl","size":9493,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/chrisprice/babili/pulls/2"},"html":{"href":"https://github.com/chrisprice/babili/pull/2"},"issue":{"href":"https://api.github.com/repos/chrisprice/babili/issues/2"},"comments":{"href":"https://api.github.com/repos/chrisprice/babili/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/chrisprice/babili/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/chrisprice/babili/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/chrisprice/babili/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/chrisprice/babili/statuses/25423c8415d2e26c6f5e9c27707e2bfddee4af8f"}}}}
{"actor":{"display_login":"chrisprice"}}