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

couchdb-extsync

v1.0.4

Published

A set of tools to manage Couchdb design docs and other usefull stuffs

Downloads

4

Readme

couchdb-extsync

Tests CI

I renamed to "couchdb-extsync" for npm publish because couchdb-utils was taken and I do not have npm enterprise account
This is why the github project and folder is named couchdb-utils

What is couchdb-extsync

This is a cli tool to extract design docs from a development CouchDB database to a local dev folder, and the another cli tool to sync thos design docs to a second CouchDB server.

Installation

global

$ npm i -g couchdb-extsync
// this will puth "cdbu" command in your /usr/bin

// you can use it like this
$ cdbu -h

local

$ npm i -D couchdb-extsync
// then create a package.json script entry
// e.g. "cdbu": "cdbu"

// you can use it like this
$ cdbu -- [args]
//e.g
$ cdbu -- -h

Dependecies

  • node js (developed with v14.17.3 LTS)
  • axios
  • dotenv

CLI usage

$ cdbu [MODE] [options]

// extract ddocs
$ cdbu -e -d my_db [-C configs] [-E envs]

// sync ddocs
$ cdbu -s -d my_db [-r new_DB_name] [-C configs] [-E envs]

MODES

Modes:
-s | sync    - Sync mode (will copy from local files to remote couchdb server)
-e | extract - Extract mode (will copy from local dev couchdb to local files)
-h | help    - Help
-v | version - Script version

OPTIONS

Options:
-d | database - The database name (required with -e and -s options)
-r | rename   - (optional) Will use a diferent database name on the remote server
-C | config   - (optional, but...) Provides a js object OR a path to config json file (e.g. .cdburc.json) (MUST BE JSON)
-E | env      - (optional, but...) Provides a js object OR a path to a env file (e.g. .env).
              - Also reads a connection string from COUCH env (e.g. COUCH=http://admin:[email protected]:5984)

Defaul Config values

The package will read the configs from "-C" argument. The argument value may be a path to a json file or a inline javascript object.

If no -C argument is passed, it will try to read a ".cdburc" file in the project root directory (MUST be JSON syntax).

If no -C argument and no ".cdburc" file exists, the package will use this defaults:

{
  "workDir": "process.cwd()",
  "outputFolder": "couchdb",
  "keepRevs": true,
}

options

workDir - dir where to store the folder with the ddocs files (default is cwd, the dir from were script is called)
outputFolder - dir to be created inside workDir, to store the ddocs files (default is couchdb)
keepRevs - true = will sync to the new couchdb instance and keep ddocs _rev (better to version controll), false=will reset _rev (default is true)

Default Env variables

The package will read the env variables to generate the couchdb connection string.

First it will try to read them from "-E" argument. The argument value may be a path to a env file as a string, or it can be a javascript object passed inline.

If no -E argument is passed, it will try to read a "COUCH" variable from process.env. This is the default way used in tests. e.g.

$ export COUCH=http://user:pass@localhost:5984 && cdbu -s ...

If no -E argument passed and no COUCH variable exportes, it will try to read a ".env" file from project root directory. If no -E argument and no ".env" file exists, the package will use this defaults:

COUCHDB_PROT = "http";
COUCHDB_USER = "admin";
COUCHDB_PASS = "admin";
COUCHDB_ADDR = "localhost";
COUCHDB_PORT = "5984";

TESTS

If you try to run tests locally, make sure you have a couchdb instance running first.

AUTHOR

Gabriel Martins aka Gabtec

LICENSE

MIT