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

smithers

v0.5.4

Published

Async Jenkins API client

Downloads

3

Readme

Smithers

Async Jenkins API client for browsers and node

npm version Build Status Coverage Status dependencies Status devDependencies Status

Note: This package is under active development and while the version is less than 1.x.x all releases should be treated as containing breaking changes.

Install

$ npm install --save smithers

Usage

Setup

Basic setup - no authentication (config optional)

import Smithers from 'smithers';

const smithers = new Smithers('https://jenkinsurl.com', config);

Username & password/token auth (config.auth required)

import Smithers from 'smithers';

const smithers = new Smithers('https://jenkinsurl.com', {
    auth: {
        username: 'username',
        password: 'password/token'
    }
});

Configuration

Configuration can be either passed when Smithers is instantiated or when a method is called. The configuration is forwarded to the axios calls so look at the axios documentation to see the different options.

  • crumbIssuer Boolean default=false: Enables CSRF crumb support for post requests
  • timeout Number default=5000: Request timeout in milliseconds

Methods

Note: These examples are using async/await but work perfectly with .then and .catch as well

getInfo()

  • config Object optional

Retrieves all data from the /api/json endpoint.

await smithers.getInfo([config]);

getJobInfo()

  • jobName String required
  • config Object optional

Retrieves all data from a specific job

await smithers.getJobInfo(jobName, [config]);

startBuild()

  • jobName String required
  • config Object optional

Triggers a build for the specific job

await smithers.startBuild(jobName, [config]);

stopBuild()

  • jobName String required
  • buildNumber Number required
  • config Object optional

Stops the build of a specifc job

await smithers.stopBuild(jobName, buildNumber, [config]);

getLastBuild()

  • jobName String required
  • config Object optional

Retrieves all data from the latest build of a specifc job

await smithers.getLastBuild(jobName, [config]);

getLastSuccessfulBuild()

  • jobName String required
  • config Object optional

Retrieves all data from the latest successful build of a specifc job

await smithers.getLastSuccessfulBuild(jobName, [config]);

getLastStableBuild()

  • jobName String required
  • config Object optional

Retrieves all data from the latest stable build of a specifc job

await smithers.getLastStableBuild(jobName, [config]);

getLastUnsuccessfulBuild()

  • jobName String required
  • config Object optional

Retrieves all data from the latest unsuccessful build of a specifc job

await smithers.getLastUnsuccessfulBuild(jobName, [config]);

getLastFailedBuild()

  • jobName String required
  • config Object optional

Retrieves all data from the latest unsuccessful build of a specifc job

await smithers.getLastFailedBuild(jobName, [config]);

getSpecificBuild()

  • jobName String required
  • buildNumber Number required
  • config Object optional

Retrieves all data for a specific build of a specifc job

await smithers.getSpecificBuild(jobName, buildNumber, [config]);

getConfigXML()

  • jobName String required
  • config Object optional

Retrieves the XML config of a specifc job

await smithers.getConfigXML(jobName, [config]);

getOverallLoad()

  • config Object optional

Retrieves statistics of the entire system (busy executors, queue length, etc...)

await smithers.getOverallLoad([config]);

getQueue()

  • config Object optional

Retrieves all data about the current queue

await smithers.getQueue([config]);

getView()

  • viewName String default='All' optional
  • config Object optional

Retrieves all data about a specific view or the default view of 'All'

await smithers.getView(viewName, [config]);

restart()

  • config Object optional

Restarts Jenkins

await smithers.restart([config]);

safeRestart()

  • config Object optional

Restarts Jenkins once no jobs are running

await smithers.safeRestart([config]);

startQuietDown()

  • config Object optional

Starts "quiet down" mode

await smithers.startQuietDown([config]);

stopQuietDown()

  • config Object optional

Stops "quiet down" mode

await smithers.stopQuietDown([config]);

getWhoAmI()

  • config Object optional

Retrieves user details

await smithers.getWhoAmI([config]);

getUser()

  • user String required
  • config Object optional

Retrieves all data about a specific user

await smithers.getUser(user, [config]);