Skip to content

Commit

Permalink
(pouchdb/express-pouchdb#232) - Modernize pouchdb-show
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-de-vries committed Feb 5, 2016
1 parent c0fc0eb commit 2bc019b
Show file tree
Hide file tree
Showing 9 changed files with 539 additions and 36 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
dist
coverage
30 changes: 30 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
sudo: false
language: node_js

cache:
directories:
- node_modules

node_js:
- "0.10"

services:
- couchdb

before_install:
- npm i -g npm@^2.0.0

before_script:
- npm prune

script: npm run $COMMAND

env:
matrix:
- COMMAND='helper -- lint'
- COMMAND='helper -- js-test'
- COMMAND='build'

#after_success:
# - npm run helper -- semantic-release

33 changes: 31 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,38 @@
pouchdb-show
============

[![Build Status](https://travis-ci.org/pouchdb/pouchdb-show.svg?branch=master)](https://travis-ci.org/pouchdb/pouchdb-show)
[![Dependency Status](https://david-dm.org/pouchdb/pouchdb-show.svg)](https://david-dm.org/pouchdb/pouchdb-show)
[![devDependency Status](https://david-dm.org/pouchdb/pouchdb-show/dev-status.svg)](https://david-dm.org/pouchdb/pouchdb-show#info=devDependencies)

A PouchDB plug-in that allows you to re-use your CouchDB show functions
on the client side. A browser version is available.

See also [pouchdb-show's documentation](http://pythonhosted.org/Python-PouchDB/js-plugins.html#pouchdb-show-plug-in)
TODO: rst -> md, update & restructure
```rst
.. _pouchdb-show-plug-in:
PouchDB Show plug-in
====================
+----------------------+-----------------+
| NodeJS package name: | `pouchdb-show`_ |
+----------------------+-----------------+
| Browser object name: | ``window.Show`` |
+----------------------+-----------------+
First, make sure you understand how show functions work in CouchDB. A
good start is `the CouchDB guide entry on shows`_.
.. _pouchdb-show: https://www.npmjs.org/package/pouchdb-show
.. _the CouchDB guide entry on shows: http://guide.couchdb.org/draft/formats.html
.. js:function:: Show.show(showPath[, options[, callback]])
Similar to the :js:func:`List.list` function, but then for show
functions. Only differences are documented.
:param string showPath: specifies the show (and optionally the
document) to use. Has the following form:
``designDocName/showName[/docId]``
[Website of this plug-in and a few others](http://python-pouchdb.marten-de-vries.nl/plugins.html)
```
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function offlineQuery(db, designDocName, showName, docId, req, options) {
}
return designDoc;
});
var docPromise = db.get(docId, options).catch(function (err) {
var docPromise = db.get(docId, options).catch(function () {
//doc might not exist - that's ok and expected.
return null;
});
Expand Down
68 changes: 35 additions & 33 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,37 @@
{
"name": "pouchdb-show",
"version": "1.0.7",
"main": "index.js",
"description": "A PouchDB plug-in that allows you to re-use your CouchDB show functions on the client side.",
"repository": "pouchdb/pouchdb-show",
"homepage": "http://python-pouchdb.marten-de-vries.nl/plugins.html",
"keywords": [
"pouch",
"pouchdb",
"couch",
"couchdb",
"show",
"design"
],
"license": "Apache-2.0",
"author": "Marten de Vries",
"dependencies": {
"couchdb-objects": "^1.0.0",
"couchdb-render": "^1.0.0",
"pouchdb-req-http-query": "^1.0.0",
"promise-nodify": "^1.0.0",
"pouchdb-promise": "^0.0.0",
"pouchdb-plugin-error": "^1.0.0"
},
"devDependencies": {
"browserify": "^4.1.8",
"uglify-js": "^2.4.13",
"es3ify": "^0.1.3"
},
"scripts": {
"build-js": "mkdir -p dist && browserify index.js -s Show -g es3ify -o dist/pouchdb-show.js",
"build": "npm run build-js; cd dist; uglifyjs pouchdb-show.js -mc > pouchdb-show.min.js"
}
"name": "pouchdb-show",
"version": "1.0.7",
"main": "index.js",
"description": "A PouchDB plug-in that allows you to re-use your CouchDB show functions on the client side.",
"repository": {
"type": "git",
"url": "https://github.com/pouchdb/pouchdb-show.git"
},
"keywords": [
"pouch",
"pouchdb",
"couch",
"couchdb",
"show",
"design"
],
"license": "Apache-2.0",
"author": "Marten de Vries",
"dependencies": {
"couchdb-objects": "^1.0.0",
"couchdb-render": "^1.0.0",
"pouchdb-req-http-query": "^1.0.0",
"promise-nodify": "^1.0.0",
"pouchdb-promise": "^0.0.0",
"pouchdb-plugin-error": "^1.0.0"
},
"devDependencies": {
"navigator": "^1.0.1",
"pouchdb-plugin-helper": "^2.0.0"
},
"scripts": {
"helper": "./node_modules/.bin/pouchdb-plugin-helper",
"test": "npm run helper -- test",
"build": "npm run helper -- build Show"
}
}
Loading

0 comments on commit 2bc019b

Please sign in to comment.