Skip to content

Commit

Permalink
Initial implementation
Browse files Browse the repository at this point in the history
This is an initial implementation of ShareDB's [`MilestoneDB`][1]. The
base bones of `MongoMilestoneDB` are based on the [`sharedb-mongo`][2]
database adapter.

This adapter is a slight departure from other ShareDB code, as it is
written in ES7 for easier maintenance, especially when dealing with
asynchronous code, as this gives us access to the `async`/`await`
notation (although we can't realise its full potential due to needing
to deal with consumer callbacks to be consistent with the rest of
ShareDB).

The move to ES7 drops support for Node v6.

This library notably uses v2 of [`mongodb`][3] instead of the newer v3.
This is to stay consistent with `sharedb-mongo`, so in theory the same
config (or style of config) can be used in both `sharedb-mongo` and in
`sharedb-milestone-mongo`.

The version of [`istanbul`][4] is also bumped to the alpha version to
[support ES7 syntax][5]. We also move away from `jshint` and use
`eslint` with some more aggressive linting.

[1]: share/sharedb#236
[2]: https://github.com/share/sharedb-mongo
[3]: https://mongodb.github.io/node-mongodb-native/
[4]: https://github.com/gotwarlost/istanbul
[5]: gotwarlost/istanbul#733
  • Loading branch information
Alec Gibson committed Aug 17, 2018
1 parent 6fa49ed commit 053e303
Show file tree
Hide file tree
Showing 12 changed files with 3,991 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"extends": "./eslint.base.yaml",
"parserOptions": {
"ecmaVersion": 2017,
"sourceType": "module",
"ecmaFeatures": {
"modules": true
}
},
"env": {
"mocha": true,
"es6": true,
"node": true
}
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*

# IDEs
.vscode

# Runtime data
pids
*.pid
Expand Down
26 changes: 26 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
language: node_js

node_js:
- "8"
- "10"

services:
- docker

env:
- MONGODB_VERSION="2.6"
- MONGODB_VERSION="3.6"
- MONGODB_VERSION="4.0"

before_install:
- docker run -d -p 127.0.0.1:27017:27017 mongo:$MONGODB_VERSION

before_script:
- until nc -z localhost 27017; do echo Waiting for MongoDB; sleep 1; done

script:
- npm run test-cover

# Send coverage data to Coveralls
after_script:
- cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Licensed under the standard MIT license:

Copyright 2018 Alec Gibson

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Loading

0 comments on commit 053e303

Please sign in to comment.