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

couchsurfer

v1.0.2

Published

Query couchdb design documents to trigger view rebuilds

Downloads

2

Readme

Couchsurfer

Couchsurfer is a friendly utility that checks in with your couchdb to see if your view indexes are up-to-date and trigger a re-indexing at the same time. This is useful after deploying changes to your views.

Installation

This is a node.js utility, so you have to install node before you can run couchsurfer.

npm install couchsurfer [-g]

Usage

Command Line

usage: couchsurfer [OPTIONS] http[s]://[user:name@]couch_url:port[/database]

If no database is specified in the URL couchsurfer will iterate over all
non-system databases accessible to the given user (or the public).

options:
    -u user:pass, --user=user:pass  Couchsurf as the given user (can also be
                                    specified in the URL).
    -d db_name, --dbs=db_name       Only query the given databases.
    --byUsers                       Iterate over the dbs of users in '/_users'.
    -f regex, --filter=regex        RegExp to filter the ddoc names.
    -s, --silent                    Don't log progress, just errors.
    --version                       Print couchsurfer version and exit.
    -h, --help                      Print this help and exit.

Examples

These are the same and will query all the design docs in database assuming user is allowed to access this db.

couchsurfer -u user:secret http://couch:5984/database
couchsurfer http://user:secret@couch:5984/database

Query all the databases the user has access to. If you want to really query all the databases in your couch, do this as an admin.

couchsurfer http://user:secret@couch:5984

Only query design docs in foo and bar

couchsurfer http://user:secret@couch:5984 -d foo -d bar

Look up registered users in /_users and then query their databases with the respective name.

couchsurfer http://admin:secret@couch:5984 --byUsers

You can filter the design documents you want to query. Just specify a RegExp.

Only query ddocs whose names begin with old_

couchsurfer http://admin:secret@couch:5984 -f ^old_

Query everything except lame_ddoc

couchsurfer http://admin:secret@couch:5984 -f [^lame_ddoc]

Node Module

Couchsurfer is an event emitter.

var couchsurfer = require('couchsurfer')

var surfer = couchsurfer({ url: 'http://foo:5984', ... })

surfer.on('error', console.error)

surfer.on('end', function () {
  console.log('yay! done!')
})

// emitted every time a ddoc has been rebuild
surfer.on('ddoc', function (info) {
  // db name, ddoc name and the time it took to rebuild
  console.log(info.db, info.ddoc, info.time)
})

// emitted every time a view cleanup happened
surfer.on('cleanup', function (err, db) {
  // yes, it's weird to use the "(err, result)" pattern here
  if (err) return console.log('couldn\'t clean up views in %s: %s', db, err)
  console.log('cleaned up views in ' + db)
})

Contributing

If you find a bug, have a feature request or any kind of question, please open an issue or submit a pull request. I'm open for discussing any kind of idea for couchsurfer.