{"action":"created","comment":{"url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/pulls/comments/33148651","id":33148651,"diff_hunk":"@@ -0,0 +1,98 @@\n+import metadata from 'react-component-metadata';\n+import glob from 'glob';\n+import fsp from 'fs-promise';\n+\n+let globp = promisify(glob);\n+\n+let cleanDoclets = desc => {\n+  let idx = desc.indexOf('@');\n+  return (idx === -1 ? desc : desc.substr(0, idx )).trim();\n+};\n+\n+let cleanDocletValue = str => str.replace(/^\\{/, '').replace(/\\}$/, '');\n+\n+let isLiteral = str => str[0] === '\"' || str[0] === \"'\";\n+\n+// override parsed metadata with jsDoc doclets\n+function applyDoclets(props, propName){\n+  let prop = props[propName];\n+  let doclets = prop.doclets;\n+  let value;\n+\n+  if (doclets.type) {\n+    value = cleanDocletValue(doclets.type);\n+    prop.type.name = value;\n+\n+    if ( value[0] === '(' ) {\n+      value = value.substring(1, value.length - 1).split('|');\n+\n+      prop.type.value = value;\n+      prop.type.name = value.every(isLiteral) ? 'enum' : 'union';\n+    }\n+  }\n+\n+  if ( doclets.required) {\n+    prop.required = true;\n+  }\n+}\n+\n+export default function generate(destination, options = { mixins: true }){\n+  //console.log(path.join(__dirname, '../src/**/*.js'))\n+\n+  return globp(__dirname + '/../src/**/*.js') //eslint-disable-line no-path-concat\n+    .then( files => {\n+      //console.log(files)\n+      let results = files.map(\n+        filename => fsp.readFile(filename).then(content => metadata(content, options)) );\n+\n+      return Promise.all(results)\n+        .then( data => {\n+          let result = {};\n+\n+          data.forEach(components => {\n+            Object.keys(components).forEach(key => {\n+              const component = components[key];\n+              component.doclets = metadata.parseDoclets(component.desc || '');\n+              component.desc = cleanDoclets(component.desc || '');\n+\n+              Object.keys(component.props).forEach( propName => {\n+                const prop = component.props[propName];\n+\n+                prop.doclets = metadata.parseDoclets(prop.desc || '');\n+                prop.desc = cleanDoclets(prop.desc || '');\n+\n+                applyDoclets(component.props, propName);\n+              });\n+            });\n+\n+            result = { ...result, ...components };\n+          });\n+\n+          //console.log(result);\n+\n+          return result;\n+        })\n+        .catch( e => setTimeout(()=> { throw e; }));\n+    });\n+}\n+\n+\n+function promisify(fn){\n+  return function (...args){\n+    return new Promise(function(resolve, reject){\n+\n+      function finish(err, result){\n+        //console.log('hi', result)\n+        if (err) {\n+          return reject(err);\n+        }\n+        resolve(result);\n+      }\n+\n+      args = args.concat(finish);\n+\n+      fn.apply(null, args);\n+    });\n+\n+  };\n+}","path":"docs/generate-metadata.js","position":98,"original_position":98,"commit_id":"0d9a933d52871a44119012a1f3ddd0fdfdb4b3f0","original_commit_id":"0d9a933d52871a44119012a1f3ddd0fdfdb4b3f0","user":{"login":"mtscout6","id":736870,"avatar_url":"https://avatars.githubusercontent.com/u/736870?v=3","gravatar_id":"","url":"https://api.github.com/users/mtscout6","html_url":"https://github.com/mtscout6","followers_url":"https://api.github.com/users/mtscout6/followers","following_url":"https://api.github.com/users/mtscout6/following{/other_user}","gists_url":"https://api.github.com/users/mtscout6/gists{/gist_id}","starred_url":"https://api.github.com/users/mtscout6/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mtscout6/subscriptions","organizations_url":"https://api.github.com/users/mtscout6/orgs","repos_url":"https://api.github.com/users/mtscout6/repos","events_url":"https://api.github.com/users/mtscout6/events{/privacy}","received_events_url":"https://api.github.com/users/mtscout6/received_events","type":"User","site_admin":false},"body":"Should this be defined somewhere else? I think it's simple enough that we shouldn't need to find another dependency that provides it, especially since this is for dev tools only. Though it is generic enough to move to say `tools/promisify` maybe?","created_at":"2015-06-24T13:49:27Z","updated_at":"2015-06-24T13:49:27Z","html_url":"https://github.com/react-bootstrap/react-bootstrap/pull/887#discussion_r33148651","pull_request_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/pulls/887","_links":{"self":{"href":"https://api.github.com/repos/react-bootstrap/react-bootstrap/pulls/comments/33148651"},"html":{"href":"https://github.com/react-bootstrap/react-bootstrap/pull/887#discussion_r33148651"},"pull_request":{"href":"https://api.github.com/repos/react-bootstrap/react-bootstrap/pulls/887"}}},"pull_request":{"url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/pulls/887","id":38401195,"html_url":"https://github.com/react-bootstrap/react-bootstrap/pull/887","diff_url":"https://github.com/react-bootstrap/react-bootstrap/pull/887.diff","patch_url":"https://github.com/react-bootstrap/react-bootstrap/pull/887.patch","issue_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/issues/887","number":887,"state":"open","locked":false,"title":"Generate Prop Documentation","user":{"login":"jquense","id":339286,"avatar_url":"https://avatars.githubusercontent.com/u/339286?v=3","gravatar_id":"","url":"https://api.github.com/users/jquense","html_url":"https://github.com/jquense","followers_url":"https://api.github.com/users/jquense/followers","following_url":"https://api.github.com/users/jquense/following{/other_user}","gists_url":"https://api.github.com/users/jquense/gists{/gist_id}","starred_url":"https://api.github.com/users/jquense/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jquense/subscriptions","organizations_url":"https://api.github.com/users/jquense/orgs","repos_url":"https://api.github.com/users/jquense/repos","events_url":"https://api.github.com/users/jquense/events{/privacy}","received_events_url":"https://api.github.com/users/jquense/received_events","type":"User","site_admin":false},"body":"This is a first pass at getting some of the doc info generated. Not having prop lists in our docs was really getting to me. So this is an attempt at a \"good enough for now\" solution that we can build on. \r\n\r\nyou can see that a bunch of info is still missing from the doc info, mostly because there are no doc comments on any Props, but also b/c some stuff isn't statically analyzable. For those cases we can use the jsDoc \"doclets\" (like @private) to tell the generator how to display the info.\r\n\r\nThis isn't meant to be a complete solution, but one that is better than what we currently have. I am hoping that others will help start documenting our props as we go.\r\n\r\nIt should also be said that I am not sure this is working with the doc build command. It does work with the dev server version though","created_at":"2015-06-24T02:01:59Z","updated_at":"2015-06-24T13:49:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"02c89f8bec9554ecdf9081d4dbd4e5ebdb7de3c9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/pulls/887/commits","review_comments_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/pulls/887/comments","review_comment_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/pulls/comments{/number}","comments_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/issues/887/comments","statuses_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/statuses/0d9a933d52871a44119012a1f3ddd0fdfdb4b3f0","head":{"label":"react-bootstrap:generate-prop-info","ref":"generate-prop-info","sha":"0d9a933d52871a44119012a1f3ddd0fdfdb4b3f0","user":{"login":"react-bootstrap","id":6853419,"avatar_url":"https://avatars.githubusercontent.com/u/6853419?v=3","gravatar_id":"","url":"https://api.github.com/users/react-bootstrap","html_url":"https://github.com/react-bootstrap","followers_url":"https://api.github.com/users/react-bootstrap/followers","following_url":"https://api.github.com/users/react-bootstrap/following{/other_user}","gists_url":"https://api.github.com/users/react-bootstrap/gists{/gist_id}","starred_url":"https://api.github.com/users/react-bootstrap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/react-bootstrap/subscriptions","organizations_url":"https://api.github.com/users/react-bootstrap/orgs","repos_url":"https://api.github.com/users/react-bootstrap/repos","events_url":"https://api.github.com/users/react-bootstrap/events{/privacy}","received_events_url":"https://api.github.com/users/react-bootstrap/received_events","type":"Organization","site_admin":false},"repo":{"id":15480067,"name":"react-bootstrap","full_name":"react-bootstrap/react-bootstrap","owner":{"login":"react-bootstrap","id":6853419,"avatar_url":"https://avatars.githubusercontent.com/u/6853419?v=3","gravatar_id":"","url":"https://api.github.com/users/react-bootstrap","html_url":"https://github.com/react-bootstrap","followers_url":"https://api.github.com/users/react-bootstrap/followers","following_url":"https://api.github.com/users/react-bootstrap/following{/other_user}","gists_url":"https://api.github.com/users/react-bootstrap/gists{/gist_id}","starred_url":"https://api.github.com/users/react-bootstrap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/react-bootstrap/subscriptions","organizations_url":"https://api.github.com/users/react-bootstrap/orgs","repos_url":"https://api.github.com/users/react-bootstrap/repos","events_url":"https://api.github.com/users/react-bootstrap/events{/privacy}","received_events_url":"https://api.github.com/users/react-bootstrap/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/react-bootstrap/react-bootstrap","description":"Bootstrap 3 components built with React","fork":false,"url":"https://api.github.com/repos/react-bootstrap/react-bootstrap","forks_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/forks","keys_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/keys{/key_id}","collaborators_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/teams","hooks_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/hooks","issue_events_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/issues/events{/number}","events_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/events","assignees_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/assignees{/user}","branches_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/branches{/branch}","tags_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/tags","blobs_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/git/refs{/sha}","trees_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/git/trees{/sha}","statuses_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/statuses/{sha}","languages_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/languages","stargazers_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/stargazers","contributors_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/contributors","subscribers_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/subscribers","subscription_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/subscription","commits_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/commits{/sha}","git_commits_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/git/commits{/sha}","comments_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/comments{/number}","issue_comment_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/issues/comments{/number}","contents_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/contents/{+path}","compare_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/compare/{base}...{head}","merges_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/merges","archive_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/downloads","issues_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/issues{/number}","pulls_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/pulls{/number}","milestones_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/milestones{/number}","notifications_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/labels{/name}","releases_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/releases{/id}","created_at":"2013-12-27T19:06:07Z","updated_at":"2015-06-24T13:18:07Z","pushed_at":"2015-06-24T10:39:51Z","git_url":"git://github.com/react-bootstrap/react-bootstrap.git","ssh_url":"git@github.com:react-bootstrap/react-bootstrap.git","clone_url":"https://github.com/react-bootstrap/react-bootstrap.git","svn_url":"https://github.com/react-bootstrap/react-bootstrap","homepage":"http://react-bootstrap.github.io/","size":8936,"stargazers_count":2607,"watchers_count":2607,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":407,"mirror_url":null,"open_issues_count":113,"forks":407,"open_issues":113,"watchers":2607,"default_branch":"master"}},"base":{"label":"react-bootstrap:master","ref":"master","sha":"4f0ed4fd353ea8d60afd9c54102eb6f0706cfd3c","user":{"login":"react-bootstrap","id":6853419,"avatar_url":"https://avatars.githubusercontent.com/u/6853419?v=3","gravatar_id":"","url":"https://api.github.com/users/react-bootstrap","html_url":"https://github.com/react-bootstrap","followers_url":"https://api.github.com/users/react-bootstrap/followers","following_url":"https://api.github.com/users/react-bootstrap/following{/other_user}","gists_url":"https://api.github.com/users/react-bootstrap/gists{/gist_id}","starred_url":"https://api.github.com/users/react-bootstrap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/react-bootstrap/subscriptions","organizations_url":"https://api.github.com/users/react-bootstrap/orgs","repos_url":"https://api.github.com/users/react-bootstrap/repos","events_url":"https://api.github.com/users/react-bootstrap/events{/privacy}","received_events_url":"https://api.github.com/users/react-bootstrap/received_events","type":"Organization","site_admin":false},"repo":{"id":15480067,"name":"react-bootstrap","full_name":"react-bootstrap/react-bootstrap","owner":{"login":"react-bootstrap","id":6853419,"avatar_url":"https://avatars.githubusercontent.com/u/6853419?v=3","gravatar_id":"","url":"https://api.github.com/users/react-bootstrap","html_url":"https://github.com/react-bootstrap","followers_url":"https://api.github.com/users/react-bootstrap/followers","following_url":"https://api.github.com/users/react-bootstrap/following{/other_user}","gists_url":"https://api.github.com/users/react-bootstrap/gists{/gist_id}","starred_url":"https://api.github.com/users/react-bootstrap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/react-bootstrap/subscriptions","organizations_url":"https://api.github.com/users/react-bootstrap/orgs","repos_url":"https://api.github.com/users/react-bootstrap/repos","events_url":"https://api.github.com/users/react-bootstrap/events{/privacy}","received_events_url":"https://api.github.com/users/react-bootstrap/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/react-bootstrap/react-bootstrap","description":"Bootstrap 3 components built with React","fork":false,"url":"https://api.github.com/repos/react-bootstrap/react-bootstrap","forks_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/forks","keys_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/keys{/key_id}","collaborators_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/teams","hooks_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/hooks","issue_events_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/issues/events{/number}","events_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/events","assignees_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/assignees{/user}","branches_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/branches{/branch}","tags_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/tags","blobs_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/git/refs{/sha}","trees_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/git/trees{/sha}","statuses_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/statuses/{sha}","languages_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/languages","stargazers_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/stargazers","contributors_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/contributors","subscribers_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/subscribers","subscription_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/subscription","commits_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/commits{/sha}","git_commits_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/git/commits{/sha}","comments_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/comments{/number}","issue_comment_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/issues/comments{/number}","contents_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/contents/{+path}","compare_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/compare/{base}...{head}","merges_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/merges","archive_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/downloads","issues_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/issues{/number}","pulls_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/pulls{/number}","milestones_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/milestones{/number}","notifications_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/labels{/name}","releases_url":"https://api.github.com/repos/react-bootstrap/react-bootstrap/releases{/id}","created_at":"2013-12-27T19:06:07Z","updated_at":"2015-06-24T13:18:07Z","pushed_at":"2015-06-24T10:39:51Z","git_url":"git://github.com/react-bootstrap/react-bootstrap.git","ssh_url":"git@github.com:react-bootstrap/react-bootstrap.git","clone_url":"https://github.com/react-bootstrap/react-bootstrap.git","svn_url":"https://github.com/react-bootstrap/react-bootstrap","homepage":"http://react-bootstrap.github.io/","size":8936,"stargazers_count":2607,"watchers_count":2607,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":407,"mirror_url":null,"open_issues_count":113,"forks":407,"open_issues":113,"watchers":2607,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/react-bootstrap/react-bootstrap/pulls/887"},"html":{"href":"https://github.com/react-bootstrap/react-bootstrap/pull/887"},"issue":{"href":"https://api.github.com/repos/react-bootstrap/react-bootstrap/issues/887"},"comments":{"href":"https://api.github.com/repos/react-bootstrap/react-bootstrap/issues/887/comments"},"review_comments":{"href":"https://api.github.com/repos/react-bootstrap/react-bootstrap/pulls/887/comments"},"review_comment":{"href":"https://api.github.com/repos/react-bootstrap/react-bootstrap/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/react-bootstrap/react-bootstrap/pulls/887/commits"},"statuses":{"href":"https://api.github.com/repos/react-bootstrap/react-bootstrap/statuses/0d9a933d52871a44119012a1f3ddd0fdfdb4b3f0"}}}}