github metadata
1.0.0
收集有关存储库的github元数据。
使用NPM安装:
$ npm install --save github-metadata
使用纱线安装:
$ yarn add github-metadata
var metadata = require ( 'github-metadata' ) ;
为指定的存储库收集github元数据。这试图获得Jekyll使用并在GitHub文档中指定的相同元数据。某些元数据需要认证,这需要传递username
和password
,或者是在options
对象上的token
。最好使用GitHub的个人访问令牌。查看结果部分,以查看返回的元数据对象的样子
参数
options
{Object} :包含身份验证和存储库详细信息的选项对象。options.owner
{string} :拥有存储库的用户或组织。这是“ https://github.com/”之后的第一个路径细分。options.repo
{string} :用于获取元数据的存储库名称。这是“ https://github.com/”之后的第二个路径段。options.exclude
{array} :可选地传递顶级属性列表,以通过不从github下载它来排除元数据。options.username
{string} :可选地为身份验证提供github用户名。这仅在使用username/password
进行身份验证时才有必要。options.password
{string} :可选地提供github密码以进行身份验证。这仅在使用username/password
进行身份验证时才有必要。options.token
{string} :可选地提供github个人访问令牌以进行身份验证。这只有使用OAuth(而不是username/password
)进行身份验证是必要的。returns
{promise} :返回一个诺言,解决后将具有存储库元数据。例子
var options = {
token : 'XXXXXXXXXX' // get this from GitHub,
owner : 'doowb' ,
repo : 'github-metadata'
} ;
metadata ( options )
. then ( function ( data ) {
console . log ( data ) ;
//=> {
//=> // this object contains all of the metadata that was gather from GitHub
//=> }
} )
. catch ( console . error ) ;
以下对象代表用于组装/组装存储库的github元数据。包含长数组的属性的项目已被删除并替换为...
有关这些数组中这些项目的更多信息,请参见完整的JSON对象和GitHub API文档。
{
"public_repositories" : [
...
] ,
"organization_members" : [
...
] ,
"contributors" : [
...
] ,
"collaborators" : [
...
] ,
"branches" : [
...
] ,
"languages" : {
"CSS" : 483616 ,
"JavaScript" : 102873 ,
"HTML" : 44790
} ,
"teams" : [
...
] ,
"releases" : [
...
] ,
"tags" : [
...
] ,
"repository" : {
"id" : 5916767 ,
"name" : "assemble" ,
"full_name" : "assemble/assemble" ,
"owner" : {
"login" : "assemble" ,
"id" : 2645080 ,
"avatar_url" : "https://avatars3.githubusercontent.com/u/2645080?v=3" ,
"gravatar_id" : "" ,
"url" : "https://api.github.com/users/assemble" ,
"html_url" : "https://github.com/assemble" ,
"followers_url" : "https://api.github.com/users/assemble/followers" ,
"following_url" : "https://api.github.com/users/assemble/following{/other_user}" ,
"gists_url" : "https://api.github.com/users/assemble/gists{/gist_id}" ,
"starred_url" : "https://api.github.com/users/assemble/starred{/owner}{/repo}" ,
"subscriptions_url" : "https://api.github.com/users/assemble/subscriptions" ,
"organizations_url" : "https://api.github.com/users/assemble/orgs" ,
"repos_url" : "https://api.github.com/users/assemble/repos" ,
"events_url" : "https://api.github.com/users/assemble/events{/privacy}" ,
"received_events_url" : "https://api.github.com/users/assemble/received_events" ,
"type" : "Organization" ,
"site_admin" : false
} ,
"private" : false ,
"html_url" : "https://github.com/assemble/assemble" ,
"description" : "Static site generator and rapid prototyping framework for Node.js, Grunt.js, and Yeoman and Gulp. Render templates with Handlebars, Lo-Dash or any template engine. Used by Less.js / lesscss.org, Topcoat, Web Experience Toolkit, and hundreds of other projects to build sites, themes, components, documentation, blogs and gh-pages." ,
"fork" : false ,
"url" : "https://api.github.com/repos/assemble/assemble" ,
"forks_url" : "https://api.github.com/repos/assemble/assemble/forks" ,
"keys_url" : "https://api.github.com/repos/assemble/assemble/keys{/key_id}" ,
"collaborators_url" : "https://api.github.com/repos/assemble/assemble/collaborators{/collaborator}" ,
"teams_url" : "https://api.github.com/repos/assemble/assemble/teams" ,
"hooks_url" : "https://api.github.com/repos/assemble/assemble/hooks" ,
"issue_events_url" : "https://api.github.com/repos/assemble/assemble/issues/events{/number}" ,
"events_url" : "https://api.github.com/repos/assemble/assemble/events" ,
"assignees_url" : "https://api.github.com/repos/assemble/assemble/assignees{/user}" ,
"branches_url" : "https://api.github.com/repos/assemble/assemble/branches{/branch}" ,
"tags_url" : "https://api.github.com/repos/assemble/assemble/tags" ,
"blobs_url" : "https://api.github.com/repos/assemble/assemble/git/blobs{/sha}" ,
"git_tags_url" : "https://api.github.com/repos/assemble/assemble/git/tags{/sha}" ,
"git_refs_url" : "https://api.github.com/repos/assemble/assemble/git/refs{/sha}" ,
"trees_url" : "https://api.github.com/repos/assemble/assemble/git/trees{/sha}" ,
"statuses_url" : "https://api.github.com/repos/assemble/assemble/statuses/{sha}" ,
"languages_url" : "https://api.github.com/repos/assemble/assemble/languages" ,
"stargazers_url" : "https://api.github.com/repos/assemble/assemble/stargazers" ,
"contributors_url" : "https://api.github.com/repos/assemble/assemble/contributors" ,
"subscribers_url" : "https://api.github.com/repos/assemble/assemble/subscribers" ,
"subscription_url" : "https://api.github.com/repos/assemble/assemble/subscription" ,
"commits_url" : "https://api.github.com/repos/assemble/assemble/commits{/sha}" ,
"git_commits_url" : "https://api.github.com/repos/assemble/assemble/git/commits{/sha}" ,
"comments_url" : "https://api.github.com/repos/assemble/assemble/comments{/number}" ,
"issue_comment_url" : "https://api.github.com/repos/assemble/assemble/issues/comments{/number}" ,
"contents_url" : "https://api.github.com/repos/assemble/assemble/contents/{+path}" ,
"compare_url" : "https://api.github.com/repos/assemble/assemble/compare/{base}...{head}" ,
"merges_url" : "https://api.github.com/repos/assemble/assemble/merges" ,
"archive_url" : "https://api.github.com/repos/assemble/assemble/{archive_format}{/ref}" ,
"downloads_url" : "https://api.github.com/repos/assemble/assemble/downloads" ,
"issues_url" : "https://api.github.com/repos/assemble/assemble/issues{/number}" ,
"pulls_url" : "https://api.github.com/repos/assemble/assemble/pulls{/number}" ,
"milestones_url" : "https://api.github.com/repos/assemble/assemble/milestones{/number}" ,
"notifications_url" : "https://api.github.com/repos/assemble/assemble/notifications{?since,all,participating}" ,
"labels_url" : "https://api.github.com/repos/assemble/assemble/labels{/name}" ,
"releases_url" : "https://api.github.com/repos/assemble/assemble/releases{/id}" ,
"deployments_url" : "https://api.github.com/repos/assemble/assemble/deployments" ,
"created_at" : "2012-09-22T20:50:23Z" ,
"updated_at" : "2017-06-15T01:09:31Z" ,
"pushed_at" : "2017-05-20T00:33:33Z" ,
"git_url" : "git://github.com/assemble/assemble.git" ,
"ssh_url" : "[email protected]:assemble/assemble.git" ,
"clone_url" : "https://github.com/assemble/assemble.git" ,
"svn_url" : "https://github.com/assemble/assemble" ,
"homepage" : "http://assemble.io/" ,
"size" : 13050 ,
"stargazers_count" : 3350 ,
"watchers_count" : 3350 ,
"language" : "CSS" ,
"has_issues" : true ,
"has_projects" : true ,
"has_downloads" : true ,
"has_wiki" : true ,
"has_pages" : false ,
"forks_count" : 225 ,
"mirror_url" : null ,
"open_issues_count" : 26 ,
"forks" : 225 ,
"open_issues" : 26 ,
"watchers" : 3350 ,
"default_branch" : "master" ,
"permissions" : {
"admin" : true ,
"push" : true ,
"pull" : true
} ,
"allow_squash_merge" : true ,
"allow_merge_commit" : true ,
"allow_rebase_merge" : true ,
"organization" : {
"login" : "assemble" ,
"id" : 2645080 ,
"avatar_url" : "https://avatars3.githubusercontent.com/u/2645080?v=3" ,
"gravatar_id" : "" ,
"url" : "https://api.github.com/users/assemble" ,
"html_url" : "https://github.com/assemble" ,
"followers_url" : "https://api.github.com/users/assemble/followers" ,
"following_url" : "https://api.github.com/users/assemble/following{/other_user}" ,
"gists_url" : "https://api.github.com/users/assemble/gists{/gist_id}" ,
"starred_url" : "https://api.github.com/users/assemble/starred{/owner}{/repo}" ,
"subscriptions_url" : "https://api.github.com/users/assemble/subscriptions" ,
"organizations_url" : "https://api.github.com/users/assemble/orgs" ,
"repos_url" : "https://api.github.com/users/assemble/repos" ,
"events_url" : "https://api.github.com/users/assemble/events{/privacy}" ,
"received_events_url" : "https://api.github.com/users/assemble/received_events" ,
"type" : "Organization" ,
"site_admin" : false
} ,
"network_count" : 225 ,
"subscribers_count" : 121
} ,
"pages_info" : {
"message" : "Not Found" ,
"documentation_url" : "https://developer.github.com/v3"
} ,
"pages" : {
"env" : "development" ,
"test" : false ,
"dotcom" : false ,
"enterprise" : false ,
"development" : true ,
"ssl" : false ,
"schema" : "http" ,
"custom_domains_enabled" : false ,
"github_hostname" : "github.com" ,
"pages_hostname" : "localhost:4000" ,
"github_url" : "http://github.com" ,
"api_url" : "https://api.github.com" ,
"help_url" : "https://help.github.com"
} ,
"hostname" : "github.com" ,
"pages_hostname" : "localhost:4000" ,
"api_url" : "https://api.github.com" ,
"help_url" : "https://help.github.com" ,
"environment" : "development" ,
"pages_env" : "development" ,
"url" : "https://github.com/assemble/assemble" ,
"project_title" : "assemble" ,
"repository_name" : "assemble" ,
"repository_nwo" : "assemble/assemble" ,
"project_tagline" : "Static site generator and rapid prototyping framework for Node.js, Grunt.js, and Yeoman and Gulp. Render templates with Handlebars, Lo-Dash or any template engine. Used by Less.js / lesscss.org, Topcoat, Web Experience Toolkit, and hundreds of other projects to build sites, themes, components, documentation, blogs and gh-pages." ,
"owner_name" : "assemble" ,
"owner_gravatar_url" : "http://github.com/assemble.png}" ,
"repository_url" : "https://github.com/assemble/assemble" ,
"language" : "CSS" ,
"show_downloads" : true ,
"owner_url" : "http://github.com/assemble" ,
"zip_url" : "http://github.com/assemble/assemble/zipball/gh_pages" ,
"tar_url" : "http://github.com/assemble/assemble/tarball/gh_pages" ,
"clone_url" : "http://github.com/assemble/assemble.git" ,
"releases_url" : "http://github.com/assemble/assemble/releases" ,
"issues_url" : "http://github.com/assemble/assemble/issues" ,
"wiki_url" : "http://github.com/assemble/assemble/wiki" ,
"is_user_page" : false ,
"is_project_page" : true
}
始终欢迎拉动请求和星星。对于错误和功能请求,请创建一个问题。
请阅读《贡献指南》,以获取有关开放问题,拉请请求和编码标准的建议。
(该项目的readme.md是由动词生成的,请不要直接编辑读书文件。必须在.verb.md readme模板中对redme进行任何更改。)
要生成读数,请运行以下命令:
$ npm install -g verbose/verb#dev verb-generate-readme && verb
运行和审查单元测试是熟悉库及其API的好方法。您可以使用以下命令安装依赖项并运行测试:
$ npm install && npm test
布莱恩·伍德沃德
版权所有©2017,Brian Woodward。根据MIT许可发布。
该文件是由动词生成的读者(v0.6.0)于2017年9月21日生成的。