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. Requiredtoken
(String
): GitHub API Token. Defaults toGH_TOKEN
env var. RequiredcacheMap
(Function
): Map each project right before you cache it.map
(Function
): Map all project info before you receive it.
var docs =
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.
Or in groups:
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