リポジトリについて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
{オブジェクト} :認証とリポジトリの詳細を含むオプションオブジェクト。options.owner
{String} :リポジトリを所有するユーザーまたは組織。これは、「https://github.com/」以降の最初のパスセグメントです。options.repo
{string} :メタデータを取得するリポジトリ名。これは、「https://github.com/」の後の2番目のパスセグメントです。options.exclude
{array} :オプションで、githubからダウンロードしないことにより、メタデータから除外するトップレベルのプロパティのリストを渡します。options.username
{string} :オプションで、認証用のgithubユーザー名を提供します。これは、認証にusername/password
使用する場合にのみ必要です。options.password
{String} :オプションで、認証用のGitHubパスワードを提供します。これは、認証にusername/password
使用する場合にのみ必要です。options.token
{String} :オプションで、認証用のGitHub Personal Accessトークンを提供します。これは、認証のために( username/password
の代わりに)OAuthを使用する場合にのみ必要です。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は動詞によって生成されます。readmeを直接編集しないでください。readmeの変更は.verb.md readmeテンプレートで行う必要があります。)
readmeを生成するには、次のコマンドを実行します。
$ npm install -g verbose/verb#dev verb-generate-readme && verb
ユニットテストの実行とレビューは、ライブラリとそのAPIに慣れるのに最適な方法です。次のコマンドで依存関係をインストールし、テストを実行できます。
$ npm install && npm test
ブライアン・ウッドワード
Copyright©2017、Brian Woodward。 MITライセンスの下でリリースされました。
このファイルは、2017年9月21日に動詞generate-readme v0.6.0によって生成されました。