{"action":"created","comment":{"url":"https://api.github.com/repos/voorhoede-labs/fastatic/pulls/comments/73365561","id":73365561,"diff_hunk":"@@ -0,0 +1,65 @@\n+'use strict';\n+\n+const promisify = require('bluebird').promisify;\n+const Table = require('cli-table');\n+const glob = promisify(require('glob').glob);;\n+const filesize = require('filesize');\n+const percent = require('calc-percent');\n+const fs = require('fs');\n+\n+\n+var table = new Table({\n+\thead: ['files', 'original size', 'optimized size', 'saving'],\n+});\n+\n+function stats(config) {\n+\treturn Promise.all(\n+\t\t\tObject.keys(config.parsers).map(function(name){\n+\t\t\t\treturn Promise.all([\n+\t\t\t\t\tgetSumOfFileSize(config.src, config.parsers[name].pattern),\n+\t\t\t\t\tgetSumOfFileSize(config.temp, config.parsers[name].pattern)\n+\t\t\t\t])\n+\t\t\t})\n+\t\t).then(function (sizes) {\n+\t\t\tlet sumSrc = 0;\n+\t\t\tlet sumTemp = 0;\n+\t\t\tsizes.map(function(parsers){\n+\t\t\t\tlet row = [];\n+\t\t\t\tlet src = parsers[0];\n+\t\t\t\tlet temp = parsers[1];\n+\t\t\t\tlet diff = src.sum - temp.sum;\n+\t\t\t\trow.push(src.pattern);\n+\t\t\t\trow.push(filesize(src.sum));\n+\t\t\t\tsumSrc += src.sum;\n+\t\t\t\trow.push(filesize(temp.sum));\n+\t\t\t\tsumTemp += temp.sum;\n+\t\t\t\trow.push(percent(diff, [src.sum], {suffix: '%'}));\n+\t\t\t\ttable.push(row);\n+\t\t\t});\n+\n+\t\t\tlet totalDiff = percent((sumSrc-sumTemp), sumSrc, {suffix: '%'});\n+\n+\t\t\ttable.push(['Total:', filesize(sumSrc), filesize(sumTemp), totalDiff]);\n+\n+\t\t\tconsole.log(table.toString());","path":"lib/parser-stats.js","position":44,"original_position":44,"commit_id":"754f89552c07e295d235e828e40ac0cad4c2ee13","original_commit_id":"754f89552c07e295d235e828e40ac0cad4c2ee13","user":{"login":"jbmoelker","id":1516059,"avatar_url":"https://avatars.githubusercontent.com/u/1516059?v=3","gravatar_id":"","url":"https://api.github.com/users/jbmoelker","html_url":"https://github.com/jbmoelker","followers_url":"https://api.github.com/users/jbmoelker/followers","following_url":"https://api.github.com/users/jbmoelker/following{/other_user}","gists_url":"https://api.github.com/users/jbmoelker/gists{/gist_id}","starred_url":"https://api.github.com/users/jbmoelker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbmoelker/subscriptions","organizations_url":"https://api.github.com/users/jbmoelker/orgs","repos_url":"https://api.github.com/users/jbmoelker/repos","events_url":"https://api.github.com/users/jbmoelker/events{/privacy}","received_events_url":"https://api.github.com/users/jbmoelker/received_events","type":"User","site_admin":false},"body":"If you return / resolve with `table.toString()` and `console.log` in the file calling `stats()` this module has one less thing it does. The module calling `stats()` could then instead of logging it out also save it to a file or whatever it wants with it.","created_at":"2016-08-03T16:01:34Z","updated_at":"2016-08-03T16:01:34Z","html_url":"https://github.com/voorhoede-labs/fastatic/pull/24#discussion_r73365561","pull_request_url":"https://api.github.com/repos/voorhoede-labs/fastatic/pulls/24","_links":{"self":{"href":"https://api.github.com/repos/voorhoede-labs/fastatic/pulls/comments/73365561"},"html":{"href":"https://github.com/voorhoede-labs/fastatic/pull/24#discussion_r73365561"},"pull_request":{"href":"https://api.github.com/repos/voorhoede-labs/fastatic/pulls/24"}}},"pull_request":{"url":"https://api.github.com/repos/voorhoede-labs/fastatic/pulls/24","id":79927168,"html_url":"https://github.com/voorhoede-labs/fastatic/pull/24","diff_url":"https://github.com/voorhoede-labs/fastatic/pull/24.diff","patch_url":"https://github.com/voorhoede-labs/fastatic/pull/24.patch","issue_url":"https://api.github.com/repos/voorhoede-labs/fastatic/issues/24","number":24,"state":"open","locked":false,"title":"Parse stats","user":{"login":"jpsc","id":411763,"avatar_url":"https://avatars.githubusercontent.com/u/411763?v=3","gravatar_id":"","url":"https://api.github.com/users/jpsc","html_url":"https://github.com/jpsc","followers_url":"https://api.github.com/users/jpsc/followers","following_url":"https://api.github.com/users/jpsc/following{/other_user}","gists_url":"https://api.github.com/users/jpsc/gists{/gist_id}","starred_url":"https://api.github.com/users/jpsc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpsc/subscriptions","organizations_url":"https://api.github.com/users/jpsc/orgs","repos_url":"https://api.github.com/users/jpsc/repos","events_url":"https://api.github.com/users/jpsc/events{/privacy}","received_events_url":"https://api.github.com/users/jpsc/received_events","type":"User","site_admin":false},"body":"closes #2 \r\ncloses #4 \r\ncloses #5 ","created_at":"2016-08-03T15:28:57Z","updated_at":"2016-08-03T16:01:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/voorhoede-labs/fastatic/pulls/24/commits","review_comments_url":"https://api.github.com/repos/voorhoede-labs/fastatic/pulls/24/comments","review_comment_url":"https://api.github.com/repos/voorhoede-labs/fastatic/pulls/comments{/number}","comments_url":"https://api.github.com/repos/voorhoede-labs/fastatic/issues/24/comments","statuses_url":"https://api.github.com/repos/voorhoede-labs/fastatic/statuses/754f89552c07e295d235e828e40ac0cad4c2ee13","head":{"label":"voorhoede-labs:parse-stats","ref":"parse-stats","sha":"754f89552c07e295d235e828e40ac0cad4c2ee13","user":{"login":"voorhoede-labs","id":17215558,"avatar_url":"https://avatars.githubusercontent.com/u/17215558?v=3","gravatar_id":"","url":"https://api.github.com/users/voorhoede-labs","html_url":"https://github.com/voorhoede-labs","followers_url":"https://api.github.com/users/voorhoede-labs/followers","following_url":"https://api.github.com/users/voorhoede-labs/following{/other_user}","gists_url":"https://api.github.com/users/voorhoede-labs/gists{/gist_id}","starred_url":"https://api.github.com/users/voorhoede-labs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/voorhoede-labs/subscriptions","organizations_url":"https://api.github.com/users/voorhoede-labs/orgs","repos_url":"https://api.github.com/users/voorhoede-labs/repos","events_url":"https://api.github.com/users/voorhoede-labs/events{/privacy}","received_events_url":"https://api.github.com/users/voorhoede-labs/received_events","type":"Organization","site_admin":false},"repo":{"id":64655853,"name":"fastatic","full_name":"voorhoede-labs/fastatic","owner":{"login":"voorhoede-labs","id":17215558,"avatar_url":"https://avatars.githubusercontent.com/u/17215558?v=3","gravatar_id":"","url":"https://api.github.com/users/voorhoede-labs","html_url":"https://github.com/voorhoede-labs","followers_url":"https://api.github.com/users/voorhoede-labs/followers","following_url":"https://api.github.com/users/voorhoede-labs/following{/other_user}","gists_url":"https://api.github.com/users/voorhoede-labs/gists{/gist_id}","starred_url":"https://api.github.com/users/voorhoede-labs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/voorhoede-labs/subscriptions","organizations_url":"https://api.github.com/users/voorhoede-labs/orgs","repos_url":"https://api.github.com/users/voorhoede-labs/repos","events_url":"https://api.github.com/users/voorhoede-labs/events{/privacy}","received_events_url":"https://api.github.com/users/voorhoede-labs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/voorhoede-labs/fastatic","description":"Speed up your static site with one command","fork":false,"url":"https://api.github.com/repos/voorhoede-labs/fastatic","forks_url":"https://api.github.com/repos/voorhoede-labs/fastatic/forks","keys_url":"https://api.github.com/repos/voorhoede-labs/fastatic/keys{/key_id}","collaborators_url":"https://api.github.com/repos/voorhoede-labs/fastatic/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/voorhoede-labs/fastatic/teams","hooks_url":"https://api.github.com/repos/voorhoede-labs/fastatic/hooks","issue_events_url":"https://api.github.com/repos/voorhoede-labs/fastatic/issues/events{/number}","events_url":"https://api.github.com/repos/voorhoede-labs/fastatic/events","assignees_url":"https://api.github.com/repos/voorhoede-labs/fastatic/assignees{/user}","branches_url":"https://api.github.com/repos/voorhoede-labs/fastatic/branches{/branch}","tags_url":"https://api.github.com/repos/voorhoede-labs/fastatic/tags","blobs_url":"https://api.github.com/repos/voorhoede-labs/fastatic/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/voorhoede-labs/fastatic/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/voorhoede-labs/fastatic/git/refs{/sha}","trees_url":"https://api.github.com/repos/voorhoede-labs/fastatic/git/trees{/sha}","statuses_url":"https://api.github.com/repos/voorhoede-labs/fastatic/statuses/{sha}","languages_url":"https://api.github.com/repos/voorhoede-labs/fastatic/languages","stargazers_url":"https://api.github.com/repos/voorhoede-labs/fastatic/stargazers","contributors_url":"https://api.github.com/repos/voorhoede-labs/fastatic/contributors","subscribers_url":"https://api.github.com/repos/voorhoede-labs/fastatic/subscribers","subscription_url":"https://api.github.com/repos/voorhoede-labs/fastatic/subscription","commits_url":"https://api.github.com/repos/voorhoede-labs/fastatic/commits{/sha}","git_commits_url":"https://api.github.com/repos/voorhoede-labs/fastatic/git/commits{/sha}","comments_url":"https://api.github.com/repos/voorhoede-labs/fastatic/comments{/number}","issue_comment_url":"https://api.github.com/repos/voorhoede-labs/fastatic/issues/comments{/number}","contents_url":"https://api.github.com/repos/voorhoede-labs/fastatic/contents/{+path}","compare_url":"https://api.github.com/repos/voorhoede-labs/fastatic/compare/{base}...{head}","merges_url":"https://api.github.com/repos/voorhoede-labs/fastatic/merges","archive_url":"https://api.github.com/repos/voorhoede-labs/fastatic/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/voorhoede-labs/fastatic/downloads","issues_url":"https://api.github.com/repos/voorhoede-labs/fastatic/issues{/number}","pulls_url":"https://api.github.com/repos/voorhoede-labs/fastatic/pulls{/number}","milestones_url":"https://api.github.com/repos/voorhoede-labs/fastatic/milestones{/number}","notifications_url":"https://api.github.com/repos/voorhoede-labs/fastatic/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/voorhoede-labs/fastatic/labels{/name}","releases_url":"https://api.github.com/repos/voorhoede-labs/fastatic/releases{/id}","deployments_url":"https://api.github.com/repos/voorhoede-labs/fastatic/deployments","created_at":"2016-08-01T09:51:45Z","updated_at":"2016-08-02T14:28:58Z","pushed_at":"2016-08-03T15:53:49Z","git_url":"git://github.com/voorhoede-labs/fastatic.git","ssh_url":"git@github.com:voorhoede-labs/fastatic.git","clone_url":"https://github.com/voorhoede-labs/fastatic.git","svn_url":"https://github.com/voorhoede-labs/fastatic","homepage":null,"size":42799,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":19,"forks":0,"open_issues":19,"watchers":0,"default_branch":"master"}},"base":{"label":"voorhoede-labs:master","ref":"master","sha":"a6235cb12ff9f52d20a1cea124f2420a016b25a0","user":{"login":"voorhoede-labs","id":17215558,"avatar_url":"https://avatars.githubusercontent.com/u/17215558?v=3","gravatar_id":"","url":"https://api.github.com/users/voorhoede-labs","html_url":"https://github.com/voorhoede-labs","followers_url":"https://api.github.com/users/voorhoede-labs/followers","following_url":"https://api.github.com/users/voorhoede-labs/following{/other_user}","gists_url":"https://api.github.com/users/voorhoede-labs/gists{/gist_id}","starred_url":"https://api.github.com/users/voorhoede-labs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/voorhoede-labs/subscriptions","organizations_url":"https://api.github.com/users/voorhoede-labs/orgs","repos_url":"https://api.github.com/users/voorhoede-labs/repos","events_url":"https://api.github.com/users/voorhoede-labs/events{/privacy}","received_events_url":"https://api.github.com/users/voorhoede-labs/received_events","type":"Organization","site_admin":false},"repo":{"id":64655853,"name":"fastatic","full_name":"voorhoede-labs/fastatic","owner":{"login":"voorhoede-labs","id":17215558,"avatar_url":"https://avatars.githubusercontent.com/u/17215558?v=3","gravatar_id":"","url":"https://api.github.com/users/voorhoede-labs","html_url":"https://github.com/voorhoede-labs","followers_url":"https://api.github.com/users/voorhoede-labs/followers","following_url":"https://api.github.com/users/voorhoede-labs/following{/other_user}","gists_url":"https://api.github.com/users/voorhoede-labs/gists{/gist_id}","starred_url":"https://api.github.com/users/voorhoede-labs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/voorhoede-labs/subscriptions","organizations_url":"https://api.github.com/users/voorhoede-labs/orgs","repos_url":"https://api.github.com/users/voorhoede-labs/repos","events_url":"https://api.github.com/users/voorhoede-labs/events{/privacy}","received_events_url":"https://api.github.com/users/voorhoede-labs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/voorhoede-labs/fastatic","description":"Speed up your static site with one command","fork":false,"url":"https://api.github.com/repos/voorhoede-labs/fastatic","forks_url":"https://api.github.com/repos/voorhoede-labs/fastatic/forks","keys_url":"https://api.github.com/repos/voorhoede-labs/fastatic/keys{/key_id}","collaborators_url":"https://api.github.com/repos/voorhoede-labs/fastatic/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/voorhoede-labs/fastatic/teams","hooks_url":"https://api.github.com/repos/voorhoede-labs/fastatic/hooks","issue_events_url":"https://api.github.com/repos/voorhoede-labs/fastatic/issues/events{/number}","events_url":"https://api.github.com/repos/voorhoede-labs/fastatic/events","assignees_url":"https://api.github.com/repos/voorhoede-labs/fastatic/assignees{/user}","branches_url":"https://api.github.com/repos/voorhoede-labs/fastatic/branches{/branch}","tags_url":"https://api.github.com/repos/voorhoede-labs/fastatic/tags","blobs_url":"https://api.github.com/repos/voorhoede-labs/fastatic/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/voorhoede-labs/fastatic/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/voorhoede-labs/fastatic/git/refs{/sha}","trees_url":"https://api.github.com/repos/voorhoede-labs/fastatic/git/trees{/sha}","statuses_url":"https://api.github.com/repos/voorhoede-labs/fastatic/statuses/{sha}","languages_url":"https://api.github.com/repos/voorhoede-labs/fastatic/languages","stargazers_url":"https://api.github.com/repos/voorhoede-labs/fastatic/stargazers","contributors_url":"https://api.github.com/repos/voorhoede-labs/fastatic/contributors","subscribers_url":"https://api.github.com/repos/voorhoede-labs/fastatic/subscribers","subscription_url":"https://api.github.com/repos/voorhoede-labs/fastatic/subscription","commits_url":"https://api.github.com/repos/voorhoede-labs/fastatic/commits{/sha}","git_commits_url":"https://api.github.com/repos/voorhoede-labs/fastatic/git/commits{/sha}","comments_url":"https://api.github.com/repos/voorhoede-labs/fastatic/comments{/number}","issue_comment_url":"https://api.github.com/repos/voorhoede-labs/fastatic/issues/comments{/number}","contents_url":"https://api.github.com/repos/voorhoede-labs/fastatic/contents/{+path}","compare_url":"https://api.github.com/repos/voorhoede-labs/fastatic/compare/{base}...{head}","merges_url":"https://api.github.com/repos/voorhoede-labs/fastatic/merges","archive_url":"https://api.github.com/repos/voorhoede-labs/fastatic/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/voorhoede-labs/fastatic/downloads","issues_url":"https://api.github.com/repos/voorhoede-labs/fastatic/issues{/number}","pulls_url":"https://api.github.com/repos/voorhoede-labs/fastatic/pulls{/number}","milestones_url":"https://api.github.com/repos/voorhoede-labs/fastatic/milestones{/number}","notifications_url":"https://api.github.com/repos/voorhoede-labs/fastatic/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/voorhoede-labs/fastatic/labels{/name}","releases_url":"https://api.github.com/repos/voorhoede-labs/fastatic/releases{/id}","deployments_url":"https://api.github.com/repos/voorhoede-labs/fastatic/deployments","created_at":"2016-08-01T09:51:45Z","updated_at":"2016-08-02T14:28:58Z","pushed_at":"2016-08-03T15:53:49Z","git_url":"git://github.com/voorhoede-labs/fastatic.git","ssh_url":"git@github.com:voorhoede-labs/fastatic.git","clone_url":"https://github.com/voorhoede-labs/fastatic.git","svn_url":"https://github.com/voorhoede-labs/fastatic","homepage":null,"size":42799,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":19,"forks":0,"open_issues":19,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/voorhoede-labs/fastatic/pulls/24"},"html":{"href":"https://github.com/voorhoede-labs/fastatic/pull/24"},"issue":{"href":"https://api.github.com/repos/voorhoede-labs/fastatic/issues/24"},"comments":{"href":"https://api.github.com/repos/voorhoede-labs/fastatic/issues/24/comments"},"review_comments":{"href":"https://api.github.com/repos/voorhoede-labs/fastatic/pulls/24/comments"},"review_comment":{"href":"https://api.github.com/repos/voorhoede-labs/fastatic/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/voorhoede-labs/fastatic/pulls/24/commits"},"statuses":{"href":"https://api.github.com/repos/voorhoede-labs/fastatic/statuses/754f89552c07e295d235e828e40ac0cad4c2ee13"}}}}
{"actor":{"display_login":"jbmoelker"}}