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

gardener

v1.1.4

Published

A node process manager for couchapps that depend on npm modules, or have npm modules bundled with them.

Downloads

35

Readme

gardener

Point a gardener at couchdb and it will install, update, and run node processes that design-docs and couchapps depend on.

gardener

Build Status

Usage

npm install gardener -g
gardener http://admin:pass@localhost:5984

This tells the gardener to watch all the databases on your local couch. But what does it do?

Simple. It looks for node_modules on design docs. Like this:

  {
    "id": "_design/twitter_things",
    "views" : {
        "map" : "by_date" : "function(doc) { emit(doc.date, null); }"
    }
    "node_modules" : "twitter-loader,[email protected]"
  }

In this case, gardener will npm install twitter-loader and worker-generate-thumbnails and run them. Gardener passes them the couch url, and optional username and password. It will look something like this:

$ gardener http://localhost:5984
info: [gardener] polling couch for design doc changes.
info: [gardener] installing twitter-loader-1.0.1.tgz start_immediate=true, module_digest=md5-COu0+gC6Cvk+UPOB3yz6iQ==, module_name=twitter-loader-1.0.1.tgz, package_version=1.0.1, local_name=aHR0cDovL2xvY2FsaG9zdDo1OTg0L3Rlc3QvX2Rlc2lnbi9tdWNreW11Y2s=, ddoc_url=http://localhost:5984/test/_design/myapp, db_url=http://localhost:5984/test
npm http GET https://registry.npmjs.org/twitter-loader
npm http 200 https://registry.npmjs.org/twitter-loader/twitter-loader-1.0.1.tgz
npm WARN package.json [email protected] No README.md file found!
[email protected] installed_packages/node_modules/twitter-loader
info: [gardener] starting package [twitter-loader] in working_dir/aHR0cDovL2xvY2FsaG9zdDo1OTg0L3Rlc3QvX2Rlc2lnbi9tdWNreW11Y2s=
info: [twitter-loader] Twitter loader is dumping tweets into http://localhost:5984/test

Yay, twitter loader has been installed, run, and hooked up to the right db.

How-to Node Program

Create a directory called 'twitter-loader'. Add server.js to it that looks like:

// the gardener will set the COUCH_URL variable. Now do what you want!
var db_url = process.env.COUCH_URL || 'http://localhost:5984/test';

// do something and save to couch
load_all_of_twitter(db_url);

Add a package.json file. npm publish.

(When publishing try to use the couchdb-worker tag so it is easy for others to find and resuse).

So like, what could I do with it?

Use some existing workers on npm: tagged couchdb-worker on npm

Here are just some ideas, you can extrapolate:

Advanced Usage:

Usage: gardener <url> [OPTIONS]

Available OPTIONS:
--include, -i  Comma seperated db and design docs to include.
--exclude, -e  Comma seperated db and design docs to exclude.
--web, -w	   Turn on a local http server and add turn on the /_garden proxy to it from couch ("true" or "false", "true" by default)
--host, -h	   The host name (or IP address) to bind the http server to. (localhost by default)
--port, -p	   The port to bind the http server to. (integer, 25984 by default)
--upnp	Use upnp to open the port on the firewall, and use the public ip ("true" or "false", "false" by default)
--user	The username given to the node module for connecting to couch
--pass  The password given to the node module for connecting to couch
--time, -t	Polling interval (seconds) to check couch for changes to design docs (integer, 30 by default)
--stdinpass when specified, gardener will read a single line from stdin, which will be used as the password when connecting to couch

see examples for examples of commandline usage.

Slim

To reduce the footprint of gardener dependencies, not all are listed in the dependencies section. To use some features you will have to do an addition npm install.

  • web, you need to npm install tako
  • upnp, you need to npm install nat-upnp
  • testing (or make or npm test) npm install mocha

I am probably doing this wrong. Please let me know a better solution.

About Version Numbers

gardener follows semver-ftw. Dont think 1.0.0 means production ready yet. There were some breaking changes, so had to move up the major version.