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日生成的。