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

@gr2m/octokit-rest-routes

v1.3.0

Published

Machine-readable, always up-to-date GitHub REST API route specifications

Downloads

17

Readme

octokit-rest-routes

machine-readable, always up-to-date GitHub REST API route specifications

Build Status

⚠️ This module is work in progress. It does not follow semantic versioning yet. Feedback welcome :)

Usage

const ROUTES = require('@gr2m/octokit-rest-routes')

returns an object with keys being the route scopes such as activity, issues, repositories, etc (one for navigation header in the sidebar at https://developer.github.com/v3/).

The value for each scope is an array of REST API endpoint specification.

Example

Here is an excerpt for reference

{
  ...
  "repositories": [
    {
      "name": "List your repositories",
      "enabledForApps": false,
      "method": "GET",
      "path": "/user/repos",
      "description": "List repositories that are accessible to ...",
      "params": [
        {
          "name": "visibility",
          "type": "enum",
          "options": [
            "all",
            "public",
            "private"
          ],
          "description": "Can be one of `all`, `public`, or `private`.",
          "default": "all",
          "required": false
        },
        ...
      ],
      "documentationUrl": "https://developer.github.com/v3/repos/#list-your-repositories"
    },
    ...
  ],
  ...
}

How it works

This package updates itself using a daily cronjob running on Travis. All routes/*.json files as well as index.js is generated by bin/octokit-rest-routes.js. Run node bin/octokit-rest-routes.js --usage for instructions.

The update script is scraping GitHub’s REST API documentation pages and extracts the meta information using cheerio and a ton of regular expressions :)

For simpler local testing and tracking of changes all loaded pages are cached in the cache/ folder.

⚠️ TBD: cron job to send pull request on changes (#12)

1. Find documentation pages

Opens https://developer.github.com/v3/, find all documentation page URLs in the side bar navigation.

2. On each documentation page, finds sections

Loads HTML of each documentation page, finds sections in page.

3. In each section, finds endpoints

Loads HTML of documentation page section. Turns it into routes/*.json file. In some cases the HTML cannot be turned into an endpoint using the implemented patterns. For these cases custom overrides are defined.

LICENSE

MIT