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

cicada

v1.1.1

Published

a teeny git-based continuous integration server

Downloads

18

Readme

cicada

a teeny git-based continuous integration server

example

Just hack up a cicada server:

var http = require('http');
var cicada = require('cicada');

var ci = cicada('/tmp/blarg');
ci.on('commit', function (commit) {
    commit.run('test').on('exit', function (code) {
        var status = code === 0 ? 'PASSED' : 'FAILED';
        console.log(commit.hash + ' ' + status);
    });
});

var server = http.createServer(ci.handle);
server.listen(5255);

run it

$ node example/ci.js 

push some code to it:

$ git push http://localhost:5255/choose.git 
To http://localhost:5255/choose.git
   c79cef8..3537c0f  master -> master

and watch the results whiz by!

b7c19c9fd2c34176bd6eef436a69ab7a470ff98d PASSED
c79cef8c54a9abc2b2d6ecd179d41463767be526 FAILED
3537c0f83606788bdfb065242a6851b20504fe3e PASSED

methods

var cicada = require('cicada')

var ci = cicada(opts, cb)

Create a new ci server using opts.repodir for storing git blobs and opts.workdir for checking out code.

If opts is a string, use opts + '/repo' and opts + '/work'.

If cb is provided, it acts as a listener for the 'commit' event.

ci.handle(req, res)

Handle requests from an http server. This is necessary to make git work over http.

ci.checkout(repo, commit, branch, cb)

Manually check out a commit into the workdir.

The errback cb(err, commit) fires with an error or a commit object.

events

ci.on('push', function (repo, commit, branch) {})

Emitted when somebody pushes to the server.

ci.on('commit', function (commit) {})

After a push occurs, the commit will be checked out into the workdir. Once the commit is all checked out, this event fires with a commit handle described below.

ci.on('error', function (err) {}

Emitted when errors occur.

commit object

Commit objects are emitted by the 'commit' event or they may be created manually with the ci.checkout() function.

commit.run(scriptName, opts)

Run a command from the package.json script hash with npm run-script.

Returns the process object.

commit.spawn(command, args, opts)

Spawn an ordinary shell command in the commit.dir.

Returns the process object.

commit properties

commit objects have these properties:

  • commit.hash - the full git hash string for this commit
  • commit.id - a combination of the hash and the date in microseconds
  • commit.dir - the working directory the commit is checked out into
  • commit.repo - the repository this commit came from
  • commit.branch - the branch this commit came from

install

With npm do:

npm install cicada

license

MIT