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

thompson

v0.1.0

Published

hookup to git, add some listeners, get notified and act

Downloads

4

Readme

Thompson Build Status

Purpose

Thompson sets up github webhooks and listens for events on the webhooks, all he needs is a github token, an external address which he listens on, and a list of repos to attach his cane to.

Special thanks to:

Installation

$ npm install thompson --save

Usage

###programmatic:


var Thompson = require('thompson');

var options = {
  "url": "[external url you want webhooks to attach to]",
  "token": "[github api token]",
  "secret": "[secret to ensure you dont get anyone else pushing spurious events]",
  "host": "0.0.0.0",
  "events": ["push"]
}

var thompson = new Thompson(options);

//first attach to the webhook event, this is when we receive an event from github
thompson.on('webhook-event', function (message) {
  console.log('have message yay!');
    //message in format:
  message_format = {
    event:message.event,//"[push/pull_request]"
    name:message.name,//"[name of repo, sans owner]"
    owner:message.owner,//"{owner name}"
    branch:message.branch,// "master! ..master!"
    detail:message.detail//"[push message raw]"
  };
});

//add some repos you want to watch, addRepo is synchronous, we just pushing them to the collection:

thompson
  //add one
  .addRepo({
    name: repo,
    events:['push']
  })

thompson
  //and/or many
  .addRepo([
    {
      name: repo,
      events:['push']
    },{
      name: repo,
      events:['push']
    }
  ])

//then listen for webhook callbacks, this call will create webhooks if the dont already exist, and receive a test message if they are being newly created
thompson.listen()

.then(function(){
  console.log('voila!!');
})
.catch(function(e){
   console.log('oh dear, not spiffing at all...');
})

###CLI: just for testing purposes ATM, as we cannot attach events to actual external scripts yet, just prints out incoming events related to webhooks thompson has created ###Global:

> npm install thompson -g
> thompson  -r [repo owner]/[repo name] -t [github api token] -s [github webhooks secret] -u [url, not https yet] -e [events comma separated, ie:push,pull_request]

###Local:

> git clone https://github.com/happner/thompson.git
> cd thompson
> nodejs bin/thompson -r [repo owner]/[repo name] -t [github api token] -s [github webhooks secret] -u [url, not https yet] -e [events comma separated, ie:push,pull_request]

License

MIT © Happner