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

circleci2

v0.3.2

Published

A Node.js client for CircleCI

Downloads

12

Readme

CircleCI

Build Status Dependencies Downloads/month

A Node.js API client for CircleCI

## Installation

npm install circleci --save

Then, in your project require and instantiate the CircleCI client:

var CircleCI = require('circleci');
var ci = new CircleCI({
  auth: "my-auth-token"
});

Note that all requests require a valid API token.

Options:

  • auth (String, required)

Available Methods

getUser

Provides information about the signed in user.

Example Usage

ci.getUser().then(function(user){
  console.log(user.login); // e.g. your Github username
});

getProjects

List of all the projects you're following on CircleCI, with build information organized by branch.

Example Usage

ci.getProjects().then(function(projects){
  for(var i=0; i < projects.length; i++) {
    console.log(projects[i].reponame); // logs the repo name of each project
  }
});

getRecentBuilds

Recent builds across all projects. Returns the build summary for each of the last 30 recent builds, ordered by build_num.

Example Usage

ci.getRecentBuilds({ limit: 5, offset: 10 })
  .then(function(builds){
    for(var i=0; i < builds.length; i++) {
      console.log(builds[i].build_num); // logs the build number for each project
    }
  });

Options

  • limit [optional] - The number of builds to return. Maximum 100, defaults to 30)
  • offset [optional] - The API returns builds starting from this offset, defaults to 0)

getBuilds

Recent builds for a single project. Returns the build summary for each of the last 30 builds for a single git repo.

Example Usage

ci.getBuilds({ username: "jpstevens", project: "circleci" })
  .then(function(builds){
    for(var i=0; i < builds.length; i++) {
      console.log(builds[i].build_num); // logs the build number for each project
    }
  });

Options

  • username [required] - The username for the project you wish to look up
  • project [required] - The project (repo) name you wish to look up
  • limit [optional] - The number of builds to return. Maximum 100, defaults to 30)
  • offset [optional] - The API returns builds starting from this offset, defaults to 0)

getBranchBuilds

Recent builds for a single project filtered by a branch name. Returns the build summary for each of the last 30 builds for a single git repo.

Example Usage

ci.getBranchBuilds({ username: "jpstevens", project: "circleci", branch: "master" })
  .then(function(builds){
    for(var i=0; i < builds.length; i++) {
      console.log(builds[i].build_num); // logs the build number for each project
    }
  });

Options

  • username [required] - The username for the project you wish to look up
  • project [required] - The project (repo) name you wish to look up
  • branch [required] - The branch name you wish to use as filter
  • limit [optional] - The number of builds to return. Maximum 100, defaults to 30)
  • offset [optional] - The API returns builds starting from this offset, defaults to 0)

getBuild

Full details for a single build. The response includes all of the fields from the build summary. This is also the payload for the notification webhooks, in which case this object is the value to a key named 'payload'.

Example Usage

ci.getBuild({
  username: "jpstevens",
  project: "circleci",
  build_num: 1
}).then(function(build){
  console.log(build);
});

Options

  • username [required] - The username for the project you wish to look up
  • project [required] - The project (repo) name you wish to look up
  • build_num [required] - CircleCI build number

startBuild

Triggers a new build, returns a summary of the build.

NOTE: This client does not yet support the sending of optional build parameters.

Example Usage

ci.startBuild({
  username: "jpstevens",
  project: "circleci",
  branch: "master"
}).then(function(build){
  console.log(build);
});

Options

  • username [required] - The username for the project
  • project [required] - The project (repo) name
  • branch [required] - The branch you wish to start the build for

cancelBuild

Cancels the build, returns a summary of the build.

Example Usage

ci.cancelBuild({
  username: "jpstevens",
  project: "circleci",
  build_num: 1
}).then(function(build){
  console.log(build);
});

Options

  • username [required] - The username for the project you wish to look up
  • project [required] - The project (repo) name you wish to look up
  • build_num [required] - CircleCI build number

retryBuild

Example Usage

ci.retryBuild({
  username: "jpstevens",
  project: "circleci",
  build_num: 1
}).then(function(build){
  console.log(build);
});

Options

  • username [required] - The username for the project you wish to look up
  • project [required] - The project (repo) name you wish to look up
  • build_num [required] - CircleCI build number

getBuildArtifacts

List the artifacts produced by a given build.

Example Usage

ci.getBuildArtifacts({
  username: "jpstevens",
  project: "circleci",
  build_num: 1
}).then(function(artifacts){
  console.log(artifacts); // logs an array of artifacts
});

Options

  • username [required] - The username for the project you wish to look up
  • project [required] - The project (repo) name you wish to look up
  • build_num [required] - CircleCI build number

clearBuildCache

Clears the cache for a project

Example Usage

ci.clearBuildCache({
  username: "jpstevens",
  project: "circleci"
}).then(function(res){
  console.log(res.status); // e.g. "build caches deleted"
});

Options

  • username [required] - The username for the project you wish to look up
  • project [required] - The project (repo) name you wish to look up

Change Log

0.1.0 - Initial (stable) release

0.2.0 - Add getBranchBuilds method