The goal of this repo is to normalize different remote endpoints for Component into a unified API.
You can also create your own remote endpoints instead of shoehorning different APIs into a JSON file.
This also handles versions and git trees, which is a little more complicated than just github raw.
dir - local components path. Defaults to `process.cwd() + '/components'
local - use the local component.
remotes.use(remote)
Add a remote to this list of remotes. Note that order matters.
var remote = yield* remotes.resolve([names], repo, [ref])
Returns the first remote with <repo>@<ref> from the list of remotes. You may optionally pass names, a list of remote names, instead of searching all the remotes or to search in a different order.
Authentication
Some remotes, such as GitHub, require authentication. We suggest you use netrc.
For Github, you need to supply you username and password for the api.github.com host.
You may also set the GITHUB_USERNAME and GITHUB_PASSWORD environmental variables.
Similarly, for BitBucket, you set BITBUCKET_USERNAME and BITBUCKET_PASSWORD.
Using a Remote
remote.name
The name of the remote.
var json = yield* remote.json(repo, [ref])
Return the component.json of a component from this remote.
var versions = yield* remote.versions(repo)
Get all valid semver version of this remote.
var tree = yield* remote.tree(repo, ref)
Return the git tree of this repo. Will return a list of objects with properties:
path - file path in the repo
sha - sha1 check sum
fize - file byte length
var urls = remote.file(repo, ref, path)
Return an array of absolute URLs of where to download this component's file path.
var archive = remote.archive(repo, ref)
Return an object containing absolute URLs of where to download this repo's archive. archive is of the format archive[format] = urls[]. Example:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.