Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/pouchdb/pouchdb into upst…
Browse files Browse the repository at this point in the history
…ream
  • Loading branch information
craftzdog committed Feb 10, 2021
2 parents c42c97b + 7532eb3 commit 14cecfb
Show file tree
Hide file tree
Showing 88 changed files with 988 additions and 754 deletions.
22 changes: 0 additions & 22 deletions .github/stale.yml

This file was deleted.

21 changes: 21 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Mark stale issues and pull requests

on:
schedule:
- cron: "30 1 * * *"

jobs:
stale:

runs-on: ubuntu-latest

steps:
- uses: actions/stale@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-label: 'stale'
stale-issue-message: 'This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days'
exempt-issue-labels: 'pinned'
days-before-stale: 60
days-before-close: 7
only-labels: 'enhancement, needs reproducing, question'
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ tmp
/node_modules
docs/_site
docs/static/css
docs/.jekyll-cache
npm-debug.log
npm-debug.log.*
*~
Expand All @@ -22,3 +23,5 @@ lerna-debug.log
tests/integration/utils-bundle.js
*.heapsnapshot
/pouchdb-server-install
package-lock.json
yarn.lock
66 changes: 18 additions & 48 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: node_js

node_js:
- "6"
- "10"

services:
- docker
Expand All @@ -13,14 +13,6 @@ git:
dist: xenial
sudo: true

addons:
jwt:
secure: YlCp9qGHmnnATcScIQVyOt8eI9FxLhMGAz9iRTHh7r41ADjfGJUzyqkWoBLcCagiQWtqtUujukPAtRuOibbBp9SvmGp+IIdbwHVUDvSZNOvGxkQ1qczeGxJcnht+2YNoCwfzkHW4vFrNiGOULdjvbWAB4sAJ8N0AZPShURwXU1E=

before_install:
# Because Saucelabs doesnt proxy 5984 on OSX
- "if [ -z \"$COUCH_HOST\" ]; then export COUCH_HOST=http://127.0.0.1:3000; fi"

before_script:
# Fail early so we dont run hours of saucelabs if we know there
# is a lint failure
Expand All @@ -34,7 +26,6 @@ script: travis_retry npm run $COMMAND
env:
global:
- NPM_CONFIG_PROGRESS="false"
- SAUCE_USERNAME=pouchdb

matrix:
- CLIENT=node COMMAND=test
Expand All @@ -43,39 +34,26 @@ env:
- CLIENT=node ADAPTER=memory COMMAND=test

# Test in firefox running on travis
- CLIENT=selenium:firefox COMMAND=test
- CLIENT=selenium:firefox POUCHDB_SRC="../../packages/node_modules/pouchdb/dist/pouchdb.min.js" COMMAND=test

# Test in chromium running on travis
- CLIENT=selenium:chrome CHROME_BIN=/usr/bin/chromium-browser COMMAND=test
- CLIENT=selenium:firefox ADAPTER=idb COMMAND=test
- CLIENT=selenium:firefox ADAPTER=idb POUCHDB_SRC="../../packages/node_modules/pouchdb/dist/pouchdb.min.js" COMMAND=test
- CLIENT=selenium:firefox ADAPTER=indexeddb COMMAND=test
- CLIENT=selenium:firefox ADAPTER=indexeddb POUCHDB_SRC="../../packages/node_modules/pouchdb/dist/pouchdb.min.js" COMMAND=test

# Test auto-compaction in Node and Firefox
- AUTO_COMPACTION=true CLIENT=node COMMAND=test
- AUTO_COMPACTION=true CLIENT=selenium:firefox COMMAND=test
- AUTO_COMPACTION=true CLIENT=selenium:firefox ADAPTER=idb COMMAND=test
- AUTO_COMPACTION=true CLIENT=selenium:firefox ADAPTER=indexeddb COMMAND=test

# Test map/reduce
- TYPE=mapreduce CLIENT=node COMMAND=test
- TYPE=mapreduce CLIENT=selenium:firefox COMMAND=test
- TYPE=mapreduce CLIENT=selenium:chrome CHROME_BIN=/usr/bin/chromium-browser COMMAND=test
- TYPE=mapreduce CLIENT=selenium:firefox ADAPTER=idb COMMAND=test
- TYPE=mapreduce CLIENT=selenium:firefox ADAPTER=indexeddb COMMAND=test

# Test pouchdb-find
- COUCH_HOST=http://127.0.0.1:3001 TYPE=find PLUGINS=pouchdb-find CLIENT=node SERVER=couchdb-master COMMAND=test
- TYPE=find PLUGINS=pouchdb-find CLIENT=selenium:firefox SERVER=pouchdb-server COMMAND=test
- TYPE=find PLUGINS=pouchdb-find CLIENT=selenium:chrome CHROME_BIN=/usr/bin/chromium-browser SERVER=pouchdb-server COMMAND=test

# Testing in saucelabs
- CLIENT=saucelabs:chrome:70 COMMAND=test
- SKIP_MIGRATION=true CLIENT=saucelabs:safari:10 COMMAND=test

# Split up the ie test suites (they are faily)
- GREP=test.basics.js CLIENT="saucelabs:internet explorer:11:Windows 10" COMMAND=test

- GREP=suite2 SKIP_MIGRATION=true CLIENT="saucelabs:MicrosoftEdge:14:Windows 10" COMMAND=test
- GREP=suite2 INVERT=true SKIP_MIGRATION=true CLIENT="saucelabs:MicrosoftEdge:14:Windows 10" COMMAND=test
- GREP=suite2 SKIP_MIGRATION=true CLIENT="saucelabs:internet explorer:11:Windows 10" COMMAND=test
- GREP=suite2 INVERT=true SKIP_MIGRATION=true CLIENT="saucelabs:internet explorer:11:Windows 10" COMMAND=test
- SKIP_MIGRATION=true CLIENT=saucelabs:iphone:11.2 COMMAND=test
- CLIENT="saucelabs:Android:6.0:Linux" COMMAND=test
- COUCH_HOST=http://127.0.0.1:3002 TYPE=find PLUGINS=pouchdb-find CLIENT=node SERVER=couchdb-v2 COMMAND=test
- TYPE=find PLUGINS=pouchdb-find CLIENT=selenium:firefox ADAPTER=idb SERVER=pouchdb-server COMMAND=test
- TYPE=find PLUGINS=pouchdb-find CLIENT=selenium:firefox ADAPTER=indexeddb SERVER=pouchdb-server COMMAND=test

# Test memory
- CLIENT=selenium:firefox ADAPTERS=memory COMMAND=test
Expand All @@ -85,15 +63,14 @@ env:

# Test CouchDB master (aka bigcouch branch)
- COUCH_HOST=http://127.0.0.1:3001 CLIENT=node SERVER=couchdb-master COMMAND=test
- COUCH_HOST=http://127.0.0.1:3002 CLIENT=node SERVER=couchdb-v2 COMMAND=test
- COUCH_HOST=http://127.0.0.1:3001 SKIP_MIGRATION=true CLIENT=selenium:firefox SERVER=couchdb-master COMMAND=test
- COUCH_HOST=http://127.0.0.1:3002 SKIP_MIGRATION=true CLIENT=selenium:firefox SERVER=couchdb-v2 COMMAND=test

# Performance tests
- CLIENT=selenium:firefox PERF=1 COMMAND=test
- PERF=1 COMMAND=test

# Test Webpack bundle
- CLIENT=selenium:firefox NEXT=1 COMMAND=test

- COMMAND=test-unit
- COMMAND=test-component
- COMMAND=test-fuzzy
Expand All @@ -109,18 +86,11 @@ matrix:
- node_js: "10"
services: docker
env: CLIENT=node COMMAND=test
- node_js: "12"
services: docker
env: CLIENT=node COMMAND=test
allow_failures:
- env: GREP=suite2 SKIP_MIGRATION=true CLIENT="saucelabs:MicrosoftEdge:14:Windows 10" COMMAND=test
- env: GREP=suite2 INVERT=true SKIP_MIGRATION=true CLIENT="saucelabs:MicrosoftEdge:14:Windows 10" COMMAND=test
- env: GREP=suite2 SKIP_MIGRATION=true CLIENT="saucelabs:internet explorer:11:Windows 10" COMMAND=test
- env: GREP=suite2 INVERT=true SKIP_MIGRATION=true CLIENT="saucelabs:internet explorer:11:Windows 10" COMMAND=test
- env: SKIP_MIGRATION=true CLIENT=saucelabs:safari:10 COMMAND=test
# xvfb started failing, removing it broke chrome tests
# https://github.com/pouchdb/pouchdb/issues/7625
- env: CLIENT=selenium:chrome CHROME_BIN=/usr/bin/chromium-browser COMMAND=test
- env: TYPE=mapreduce CLIENT=selenium:chrome CHROME_BIN=/usr/bin/chromium-browser COMMAND=test
- env: TYPE=find PLUGINS=pouchdb-find CLIENT=selenium:chrome CHROME_BIN=/usr/bin/chromium-browser SERVER=pouchdb-server COMMAND=test
- env: CLIENT="saucelabs:Android:6.0:Linux" COMMAND=test
- env: CLIENT=selenium:firefox COMMAND=test-webpack

branches:
only:
Expand Down
58 changes: 29 additions & 29 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,29 @@ Welcome, so you are thinking about contributing to PouchDB? Awesome, this is a g
Get in Touch
------------

The following documentation should answer most of the common questions about how to get starting contributing, if you have any questions, please feel free to get in touch @ [Freenode IRC](https://www.irccloud.com/invite?channel=pouchdb&hostname=irc.freenode.net&port=6697&ssl=1), in [the Google Groups mailing list](https://groups.google.com/forum/#!forum/pouchdb), and [on StackOverflow](http://stackoverflow.com/questions/tagged/pouchdb). Or you can [tweet @pouchdb](http://twitter.com/pouchdb).
The following documentation should answer most of the common questions about how to get starting contributing, if you have any questions, please feel free to get in touch @ [the Google Groups mailing list](https://groups.google.com/forum/#!forum/pouchdb), and [on StackOverflow](http://stackoverflow.com/questions/tagged/pouchdb). Or you can [tweet @pouchdb](http://twitter.com/pouchdb).

Most project discussions should happen on the Mailing list / Bug Tracker and IRC, however if you are a first time contributor and want some help getting started feel free to send a private email to any of the following maintainers:
Most project discussions should happen on the Mailing list / Bug Tracker, however if you are a first time contributor and want some help getting started feel free to send a private email to any of the following maintainers:

* Dale Harvey ([email protected], daleharvey on IRC)
* Nolan Lawson ([email protected], nolanlawson on IRC)
* Calvin Metcalf ([email protected], calvinmetcalf on IRC)
* Dale Harvey ([email protected])

#### PouchDB meeting
Help Wanted
----------------

We hold a weekly 'office hours' meeting on IRC (irc.freenode.net#pouchdb) on Mondays at 5:00PM UTC (9:00 AM Pacific, 12:00 PM Eastern, 10:30 PM IST), this is open to anyone and a time when developers and users discuss issues they are having or working on.
If you are looking for something to work on, we try to maintain a list of issues that should be suitable for first time contributions, they can be found tagged [help-wanted](https://github.com/pouchdb/pouchdb/issues?labels=help-wanted&state=open).

Help Wanted
Triage
----------------

If you are looking for something to work on, we try to maintain a list of issues that should be suitable for first time contributions, they can be found tagged [help wanted](https://github.com/pouchdb/pouchdb/issues?labels=help%20wanted&state=open).
Bugs that get filed have no labels [and are triaged](https://github.com/pouchdb/pouchdb/issues?q=is%3Aissue+is%3Aopen+no%3Alabel). A bug should be given one of the following labels: bug, enhancement, needs-reproducing, question during triage. Issues with the `bug` label will not be marked stale.


Guide to Contributions
--------------------------------------

* Almost all Pull Requests for features or bug fixes will need tests
* We follow [Felix's Node.js Style Guide](https://github.com/felixge/node-style-guide)
* Almost all Pull Requests for features or bug fixes will need tests (seriously, it's really important)
* Before opening a pull request run `$ npm test` to lint test the changes and run node tests. Preferably run the browser tests as well.
* Commit messages should follow the following style:

```
Expand All @@ -46,11 +45,6 @@ Dependencies
PouchDB needs the following to be able to build and test your build, if you haven't installed them then best to do so now, we will wait.

* [Node.js](http://nodejs.org/)
* [CouchDB](http://couchdb.apache.org/)

CouchDB must be running and available at `http://localhost:5984`. If you can open that URL in a browser and see `"couchdb": "Welcome"`, then it's working.

You'll also need to ensure that CORS is enabled on the CouchDB. You can easily do this by running `npm install -g add-cors-to-couchdb` and then `add-cors-to-couchdb`.

**On Windows?** PouchDB's build and tests work on Windows, but you will have to follow [Microsoft's guidelines for Windows](https://github.com/Microsoft/nodejs-guidelines/blob/master/windows-environment.md#environment-setup-and-configuration) to ensure you can install and compile native add-ons. Also, we recommend [Git Bash for Windows](https://git-scm.com/download/win) because our build relies on many Bash- and Unix-isms. Another option is [Windows Subsystem for Linux](https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux).

Expand All @@ -72,40 +66,46 @@ UMD module to `dist/`. All of this logic is in `bin/build.sh`.
Testing PouchDB
--------------------------------------

Running PouchDB tests is really simple (5 minutes), go to [TESTING](./TESTING.md) for instructions.

Debugging PouchDB
--------------------------------------
The main PouchDB test suite can be run with:

PouchDB uses the `debug` [module](https://www.npmjs.org/package/debug) for debug
logging, to turn on the log output enable the debug flag in node:
$ npm test

DEBUG=pouchdb:*
If you would like to test against your a CouchDB instance you are currently running you can specify that with `COUCH_HOST`:

Or in the browser:
$ COUCH_HOST="http://127.0.0.1:5984" npm test

PouchDB.debug.enable('pouchdb:*');
There is more information about the various test suites and testing options in [TESTING](./TESTING.md).

Git Essentials
--------------------------------------

Workflows can vary, but here is a very simple workflow for contributing a bug fix:

$ git clone [email protected]:myfork/pouchdb.git
$ git remote add pouchdb https://github.com/pouchdb/pouchdb.git

$ git clone https://github.com/pouchdb/pouchdb.git
$ git checkout -b 121-issue-keyword master
# Write tests + code
$ git add src/afile.js
$ git commit -m "(#121) - A brief description of what I changed"

Once you have some code to push, fork the [PouchDB repository](https://github.com/pouchdb/pouchdb) then push your changes to your fork:

$ git remote add myfork https://github.com/myfork/pouchdb.git
$ git push origin 121-issue-keyword

Now when you visit https://github.com/myfork/pouchdb there should be a button that will let you create a pull request.

Building PouchDB Documentation
--------------------------------------

The source for the website http://pouchdb.com is stored inside the `docs` directory of the PouchDB repository, you can make changes and submit pull requests as with any other patch. To build and view the website locally you will need to install [jekyll](http://jekyllrb.com/) and a few other gems. Jekyll is installed using [bundler](http://bundler.io/) so you need to install that first.
The source for the website http://pouchdb.com is stored inside the `docs` directory of the PouchDB repository, you can make changes and submit pull requests as with any other patch. To build and view the website locally you will need to have the Ruby development package installed.
On Ubuntu this is done with:

$ sudo apt install -y ruby-dev

You then neet to install [jekyll](http://jekyllrb.com/) and a few other gems. Jekyll is installed using [bundler](http://bundler.io/) so you need to install that first.
On Ubuntu you will need root permissions to do this so prefix the ```gem``` command with ```sudo```

$ gem install bundler
$ [sudo] gem install bundler
$ npm run install-jekyll

If you haven't already done so, you'll also need to run `npm install` to pull in packages for the dev server:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Getting Help

The PouchDB community is active [on Freenode IRC](https://www.irccloud.com/invite?channel=pouchdb&hostname=irc.freenode.net&port=6697&ssl=1), in [the Google Groups mailing list](https://groups.google.com/forum/#!forum/pouchdb), and [on StackOverflow](http://stackoverflow.com/questions/tagged/pouchdb). Or you can [tweet @pouchdb](http://twitter.com/pouchdb)!

If you think you've found a bug in PouchDB, please write a reproducible test case and file [a Github issue](https://github.com/pouchdb/pouchdb/issues). We recommend [bl.ocks.org](http://bl.ocks.org/) for code snippets, because some iframe-based services like JSFiddle and JSBin do not support IndexedDB in all browsers. You can start with [this template](https://gist.github.com/nolanlawson/816f138a51b86785d3e6).
If you think you've found a bug in PouchDB, please write a reproducible test case and file [a Github issue](https://github.com/pouchdb/pouchdb/issues). You can start with a [template we have built on glitch](https://glitch.com/~pouchdb-bug-helper).

Prerelease builds
----
Expand Down
13 changes: 12 additions & 1 deletion TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ Running PouchDB Tests

The PouchDB test suite expects an instance of CouchDB (version 1.6.1 and above) running in [Admin Party](http://guide.couchdb.org/draft/security.html#party) on http://127.0.0.1:5984 with [CORS enabled](https://github.com/pouchdb/add-cors-to-couchdb), you can configure this by setting the `COUCH_HOST` env var.

If you use docker, you can start the couchdb-instance with
```bash
docker run -it --name my-couchdb -p 5984:5984 couchdb:latest

# to have a couchdb with enabled cors, you can use trivago/couchdb-cors
docker run -it --name my-couchdb -p 5984:5984 trivago/couchdb-cors:latest
```

* PouchDB has been primarily developed on Linux and OSX, if you are using Windows then these instructions will have problems, we would love your help fixing them though.

### Node Tests
Expand Down Expand Up @@ -61,7 +69,6 @@ or
#### Other test options

* `SKIP_MIGRATION=1` should be used to skip the migration tests.
* `NEXT=1` will test pouchdb-next (PouchDB with v2 IndexedDB adapter).
* `POUCHDB_SRC=../../dist/pouchdb.js` can be used to treat another file as the PouchDB source file.
* `npm run test-webpack` will build with Webpack and then test that in a browser.

Expand Down Expand Up @@ -108,6 +115,10 @@ Note that you must `npm install pouchdb-server` or `npm install express-pouchdb`

### Testing different Node adapters

Use this option to test the new indexeddb adapter:

ADAPTER=indexeddb

Use this option to test the in-memory adapter:

ADAPTER=memory
Expand Down
7 changes: 6 additions & 1 deletion bin/build-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ var AGGRESSIVELY_BUNDLED_PACKAGES =
// packages that only have a browser version
var BROWSER_ONLY_PACKAGES =
['pouchdb-browser'];
// packages that only use the browser field to ignore dependencies
var BROWSER_DEPENDENCY_ONLY_PACKAGES =
['pouchdb-adapter-leveldb'];

function buildModule(filepath) {
var pkg = require(path.resolve(filepath, 'package.json'));
Expand All @@ -49,7 +52,9 @@ function buildModule(filepath) {

// technically this is necessary in source code because browserify
// needs to know about the browser switches in the lib/ folder
if (pkg.browser && pkg.browser['./lib/index.js'] !==
// some modules don't need this check and should be skipped
var skipBrowserField = BROWSER_DEPENDENCY_ONLY_PACKAGES.indexOf(pkg.name) !== -1;
if (!skipBrowserField && pkg.browser && pkg.browser['./lib/index.js'] !==
'./lib/index-browser.js') {
return Promise.reject(new Error(pkg.name +
' is missing a "lib/index.js" entry in the browser field'));
Expand Down
12 changes: 1 addition & 11 deletions bin/build-pouchdb.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,16 +146,6 @@ function buildPluginsForBrowser() {
});
}

function buildPouchDBNext() {
return doRollup('src/next.js', true, {
cjs: 'lib/next.js'
}).then(function () {
return doBrowserify('pouchdb', 'lib/next.js', {standalone: 'PouchDB'});
}).then(function (code) {
return writeFile('packages/node_modules/pouchdb/dist/pouchdb-next.js', code);
});
}

var rimrafMkdirp = argsarray(function (args) {
return all(args.map(function (otherPath) {
return rimraf(addPath('pouchdb', otherPath));
Expand All @@ -182,7 +172,7 @@ function doBuildNode() {
function doBuildAll() {
return rimrafMkdirp('lib', 'dist', 'lib/plugins')
.then(doAll(buildForNode, buildForBrowserify))
.then(doAll(buildForBrowser, buildPluginsForBrowserify, buildPouchDBNext))
.then(doAll(buildForBrowser, buildPluginsForBrowserify))
.then(doAll(buildPluginsForBrowser));
}

Expand Down
Loading

0 comments on commit 14cecfb

Please sign in to comment.