npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

github-repository-provider

v9.0.21

Published

repository provider for github

Downloads

2,557

Readme

npm License Typed with TypeScript bundlejs downloads GitHub Issues Build Status Styled with prettier Commitizen friendly Known Vulnerabilities Coverage Status

github-repository-provider

repository provider for github

import { GithubProvider } from 'github-repository-provider';

const config = GithubProvider.optionsFromEnvironment(process.env);
const provider = new GithubProvider(config);
const repository = await provider.repository(`myuser/repo1`);

for async (const entry of repository.entries('\*_/_.md')) {
console.log(entry.name);
}

API

Table of Contents

GithubBranch

Extends Branch

Branch on GitHub.

Parameters

  • owner
  • name
  • options

writeEntry

Writes content into the branch https://developer.github.com/v3/git/blobs/#get-a-blob

Parameters

  • entry ContentEntry

Returns Promise<ContentEntry> written content with sha values set

commit

https://developer.github.com/v3/git/trees/#create-a-tree https://developer.github.com/v3/git/commits/#create-a-commit https://developer.github.com/v3/git/refs/#update-a-reference

Parameters

entry

https://developer.github.com/v3/repos/contents/#get-repository-content

Parameters

entries

Parameters

Returns AsyncGenerator<ContentEntry> all matching entries in the branch

removeEntries

https://developer.github.com/v3/repos/contents/

Parameters

  • entries AsyncIterable<ContentEntry>

GithubOwner

Extends RepositoryGroup

Represents github repo owner either

  • users
  • organization

createRepository

https://developer.github.com/v3/repos/#create-a-repository-for-the-authenticated-user

Parameters

Returns Promise<Repository> newly created repository

deleteRepository

https://developer.github.com/v3/repos/#delete-a-repository

Parameters

attributeMapping

Map attributes between external and internal representation.

GithubProvider

Extends MultiGroupProvider

GitHub provider. Lookup a repository. known environment variables

  • GITHUB_TOKEN or GH_TOKEN api token

Examples

import GithubProvider from 'github-repository-provider';

const ghp = new GithubProvider();
const r1 = ghp.repository('[email protected]:arlac77/github-repository-provider.git');
const r2 = ghp.repository('git://github.com/arlac77/github-repository-provider.git');
const r3 = ghp.repository('git+ssh://github.com/arlac77/github-repository-provider.git');
const r4 = ghp.repository('https://github.com/arlac77/github-repository-provider.git#master');
const r5 = ghp.repository('git+https://github.com/arlac77/github-repository-provider.git#master');
const r6 = ghp.repository('arlac77/github-repository-provider');
// different ways to address the same repository

initializeRepositories

https://developer.github.com/v3/repos/#list-repositories-for-the-authenticated-user

repositoryBases

All possible base urls

Returns Array<string> common base urls of all repositories

name

We are called github.

Returns string github

instanceIdentifier

Returns string default environment name prefix for the provider instance

GithubPullRequest

Extends PullRequest

Github pull request.

_merge

https://developer.github.com/v3/pulls/#merge-a-pull-request

Parameters

  • method (optional, default "MERGE")

update

validMergeMethods

All valid merge methods.

Returns Set<string> valid merge methods

list

https://developer.github.com/v3/pulls/#list-pull-requests

Parameters

  • repository Repository
  • filter Object (optional, default {})

open

https://developer.github.com/v3/pulls/#create-a-pull-request

Parameters

  • source Branch
  • destination Branch
  • options Object?

GithubRepository

Extends Repository

Repository on GitHub.

defaultBranchName

Returns string "main"

commits

https://docs.github.com/en/rest/reference/commits#list-commits

Parameters

Returns AsyncIterable<Commit>

commitForSha

https://developer.github.com/v3/git/commits/#get-a-commit

Parameters

Returns Promise<Object> response

tree

Parameters

Returns Promise<Array<Object>>

addTree

Parameters

Returns Promise<Object> newly created tree

initializeBranches

https://developer.github.com/v3/repos/branches/#list-branches

initializeTags

https://docs.github.com/en/rest/reference/repos#list-repository-tags

url

Returns string github https url

issuesURL

Deliver the url of issue tracking system.

Returns string

homePageURL

Deliver the url of the repositories home page.

Returns string

api

API endpoint for ourselfs.

Returns string

update

https://docs.github.com/de/rest/repos/repos?apiVersion=2022-11-28#update-a-repository

refId

Get sha of a ref. https://developer.github.com/v3/git/refs/

Parameters

Returns Promise<string> sha of the ref

_setRefId

Parameters

setRefId

https://docs.github.com/en/github-ae@latest/rest/git/refs#update-a-reference

Parameters

Returns Promise<Object>

deletePullRequest

https://developer.github.com/v3/pulls/#update-a-pull-request

Parameters

initializeHooks

https://developer.github.com/v3/repos/hooks/

install

With npm do:

npm install github-repository-provider

license

BSD-2-Clause