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

update-couch-designs

v0.4.2

Published

A utility to create / update design documents on a CouchDB database, and index their views with *zero downtime*.

Downloads

14

Readme

update-couch-designs

A utility to create / update design documents on a CouchDB database, and index their views with zero downtime.

Typically when a design document is updated, none of its views can return results until CouchDB has re-indexed every view on the updated document. This can take hours on large databases. update-couch-designs achieves zero downtime by:

  1. Writing the updated versions to temporary design documents.
  2. These temporary docs are indexed with couchdb-indexer.
  3. The original design docs are updated to match the temporary design docs.
  4. The temporary design docs are deleted.

Because CouchDB is able to identify that the temporary design docs are identical to the updated docs, it does not need to re-index the updated design docs. Thus the effect is that views can always return results without any delay for indexing.

Installation

The module is published to npm. You can either install it globally for CLI use, or as a module to be required within a project.

npm install -g update-couch-designs

Usage

Installing the module globally will allow you to run the update-couch-designs CLI command.

update-couch-designs --db http://localhost:5984/my-db --docs 'db/{designs1,designs2}/*.js' --tmp-doc-prefix 'build-1-'

Options

  • --db - (required) the URL of a CouchDB database
  • --docs - (required) a glob from which JSON/JS design documents will be found
  • --temp-doc-prefix - the prefix used for naming temporary design docs: _id: _design/{% TEMP-DOC-PREFIX %}original_id

If the specified database does not exist at the given URL it will be created. Any design document files matched by the glob will be inserted if they do not already exist in the database or updated if they do already exist and have changed since the last update.

Note that the design document files are expected to be valid JSON or valid JavaScript programs. They are pulled into the script via require so if you're using actual JavaScript rather than JSON for your design documents make sure the exported object contains stringified functions.