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

ecodoc

v1.3.0

Published

Manage docs across multiple packages

Downloads

7

Readme

ecodoc

Manage docs across multiple packages

Ecodoc maps an array of GitHub repository names to their info, contributors, latest version, and readme.

Install

npm install --save ecodoc

Usage

Note: In order for this to work, you need to set GH_TOKEN environment variable, or pass in opts.token. Otherwise, GitHub rate limits to 60 requests per hour. This tool makes at least 1 request per repository to check if info is updated. It makes 4 more requests for the info, contributors, tags, and README.

If you are lazy, you can just put GH_TOKEN=... in front of a command that runs ecodoc:

GH_TOKEN=... npm run build

ecodoc(opts)

Create an ecodoc mapping function (called docs) with some options

  • cache (String): Path to where to store leveldb cache. Required
  • token (String): GitHub API Token. Defaults to GH_TOKEN env var. Required
  • cacheMap (Function): Map each project right before you cache it.
  • map (Function): Map all project info before you receive it.
var docs = ecodoc({
  cache: __dirname + '/cache',
  token: ..., // GH token, or just use `GH_TOKEN`
})

docs(projects, done)

Map project names to their info, latest version, contributors, and readme. They come from either requests or leveldb cache.

You can provide projects as an array of GitHub repos, as an object in groups of arrays.

docs([
  'audiojs/audio',
  'audiojs/audio-buffer'
], function (err, projects) {
  console.log(projects)
  // [ { repo: 'audiojs/audio', latest_version: 'v1.2.0' ... }
  //   { repo: 'audiojs/audio-buffer', latest_version: 'v1.0.0' ... } ]
})

Or in groups:

docs({
  core: [
    'audiojs/audio',
    'audiojs/audio-buffer'
  ],
  utility: [
    'audiojs/is-audio-buffer'
  ]
}, function (err, projects) {
  console.log(projects)
  // [ { name: 'audio', group: 'core', ... },
  //   { name: 'audio-buffer', group: 'core' },
  //   { name: 'is-audio-buffer', group: 'utility' } ]
})

project

This object contains:

{
  name: 'audio',            // project name
  repo: 'audiojs/audio',    // project repo
  desc: '...',              // project description
  group: 'core',            // project group (or falsy)
  latest_version: 'v1.2.0', // latest git tag version
  latest_ref: ...,          // latest git ref
  readme: ...,              // README contents base64 encoded
  contributors: [
    {
      username: 'dfcreative',                    // contributor username
      profile: 'https://github.com/dfcreative',  // contributor profile
      avatar: ...,                               // contributor avatar
      id: 300067,                                // contributor id
      contributions: 4                           // contributions
    }
    // ...
  ]
}

License

MIT © Jamen Marz


[version][package] travis [downloads/month][package] [downloads][package] [license][package] support me follow [package]: https://npmjs.com/package/ecodoc