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

ci-adapter

v0.3.0

Published

Uniform access to a bunch of continuous integration providers

Downloads

25

Readme

ci-adapter

Uniform access to a bunch of continuous integration providers.

Supported providers

Adapter API

getInfo()

Return a Promise and resolve it with an object containing information about the adapter instance.

adapter.getInfo().then(function (info) {
  console.log(info);
});
// {
//   "name": "Travis CI - your_account (https://api.travis-ci.org)",
//   "url": "https://api.travis-ci.org/repos/your_account",
//   "html_url": "https://travis-ci.org/your_account",
//   "builders_url": "https://api.travis-ci.org/repos/your_account{/name}{?ids}",
//   "builders": [ "your_repo", "your_other_repo" ],
//   "data": { ... }
// }

getBuilders( info )

Return a Promise and resolve it with a list of builders that are known to this adapter. A "builder" may be called differenty by your CI solution, for example, Travis CI mainly talks about "repositories" while Jenkins calls them "jobs".

adapter.getBuilders(info).then(function (builders) {
  console.log(builders);
});
// [
//   {
//     "name": "your_repo",
//     "url": "https://api.travis-ci.org/repos/your_account/your_repo",
//     "html_url": "https://travis-ci.org/your_account/your_repo",
//     "builds_url": "https://api.travis-ci.org/repos/your_account/your_repo/build{?number,after_number}",
//     "builds": [ 120, 119, 118, 117, 116 ],
//     "data": { ... }
//   },
//   {
//     "name": "your_other_repo",
//     "url": "https://api.travis-ci.org/repos/your_account/your_other_repo",
//     "html_url": "https://travis-ci.org/your_account/your_other_repo",
//     "builds_url": "https://api.travis-ci.org/repos/your_account/your_other_repo/build{?number,after_number}",
//     "builds": [ 174, 173, 172, 171, 170 ],
//     "data": { ... }
//   }
// ]

getBuilds( builder )

Return a Promise and resolve it with a list of builds that were run by the given builder.

adapter.getBuilds( builder ).then(function (builds) {
  console.log(builds);
});
// [
//   {
//     "name": "your_repo",
//     "number": 120,
//     "url": "https://api.travis-ci.org/repos/your_account/your_repo/builds/56413624",
//     "html_url": "https://travis-ci.org/your_account/your_repo/builds/56413624",
//     "state": "success",
//     "start": Sat Oct 26 2015 01:20:00 GMT-0800 (PST),
//     "end": Sat Oct 26 2015 01:21:00 GMT-0800 (PST),
//     "data": { ... }
//   }
// ]

Hypermedia

The returned responses contain URIs (RFC 3986) and URI templates (RFC 6570). Since this library provides no HTTP endpoint in and of itself, these URIs point to the respective service the adapter is connected to. That is, the url field of a build object obtained from the Travis adapter will point to the Travis API endpoint endpoint of the given build.

Each object has an html_url property that points to an HTML representation of the given object. For example the build-results page on Travis or the job overview page on a Jenkins server.

Further, objects may link to sub resources, such as the builder linking to its builds. In that case the property is to be interpreted as a URI template. The object should provide a set of possible substitutions for the given template. In case of the builder example above, the builder would have a builds_url property which accepts a number variable. The number variable can then be expanded with the values of the builds array.

const builds_url = builder.builds_url; // "https://api.travis-ci.org/repos/your_account/your_repo/builds/{?number}"
const builds = builder.builds; // [ 15, 14, 13, 12 ]
const template = urltemplate(builds_url);
const urls = builder.builds.map(number => template.expand({ number }));
// [
//   "https://api.travis-ci.org/repos/your_account/your_repo/builds/?number=15",
//   "https://api.travis-ci.org/repos/your_account/your_repo/builds/?number=14",
//   "https://api.travis-ci.org/repos/your_account/your_repo/builds/?number=13",
//   "https://api.travis-ci.org/repos/your_account/your_repo/builds/?number=12"
// ]