Skip to content

Commit 5fa5ef8

Browse files
committed
Finish driver extraction and make sure it is buildable
1 parent 57c7733 commit 5fa5ef8

File tree

11 files changed

+405
-111
lines changed

11 files changed

+405
-111
lines changed

.gitignore

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# See http://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# compiled output
4+
/dist
5+
/tmp
6+
/out-tsc
7+
8+
# Runtime data
9+
pids
10+
*.pid
11+
*.seed
12+
*.pid.lock
13+
14+
# Directory for instrumented libs generated by jscoverage/JSCover
15+
lib-cov
16+
17+
# Coverage directory used by tools like istanbul
18+
coverage
19+
20+
# nyc test coverage
21+
.nyc_output
22+
23+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
24+
.grunt
25+
26+
# Bower dependency directory (https://bower.io/)
27+
bower_components
28+
29+
# node-waf configuration
30+
.lock-wscript
31+
32+
# IDEs and editors
33+
.idea
34+
.project
35+
.classpath
36+
.c9/
37+
*.launch
38+
.settings/
39+
*.sublime-workspace
40+
41+
# IDE - VSCode
42+
.vscode/*
43+
!.vscode/settings.json
44+
!.vscode/tasks.json
45+
!.vscode/launch.json
46+
!.vscode/extensions.json
47+
48+
# misc
49+
.sass-cache
50+
connect.lock
51+
typings
52+
53+
# Logs
54+
logs
55+
*.log
56+
npm-debug.log*
57+
yarn-debug.log*
58+
yarn-error.log*
59+
60+
61+
# Dependency directories
62+
node_modules/
63+
jspm_packages/
64+
65+
# Optional npm cache directory
66+
.npm
67+
68+
# Optional eslint cache
69+
.eslintcache
70+
71+
# Optional REPL history
72+
.node_repl_history
73+
74+
# Output of 'npm pack'
75+
*.tgz
76+
77+
# Yarn Integrity file
78+
.yarn-integrity
79+
80+
# dotenv environment variables file
81+
.env
82+
83+
# next.js build output
84+
.next
85+
86+
# Lerna
87+
lerna-debug.log
88+
89+
# System Files
90+
.DS_Store
91+
Thumbs.db

.groc.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

Makefile

Lines changed: 0 additions & 5 deletions
This file was deleted.

README.md

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,39 @@ Check out
1212
[rethinkdb.com/api/javascript](http://www.rethinkdb.com/api/javascript)
1313
for documentation and examples of using this driver.
1414

15-
## Creating the proto-def.js
15+
## Get and compile protobuf definitions
1616

17-
To build the JavaScript driver, you'll need to first generate the
18-
definitions file `proto-def.js`. To do that from the `drivers`
19-
directory, you can do:
17+
To get and compile protobuf definitions, you should run the `npm run get-proto`
18+
script. This will download the proto file from rethinkdb's next branch and
19+
convert it by `scripts/convert_protofile.py`.
2020

21-
```bash
22-
$ ./convert_protofile -l javascript \
23-
-i ../src/rdb_protocol/ql2.proto \
24-
-o ./javascript/proto-def.js
21+
## Compile coffee script
22+
23+
We are using a pretty outdated coffee script version right now, but to
24+
mitigate compilation issues, you can use the `npm run compile` command. It
25+
will compile the coffee script files for you.
26+
27+
## Build the package
28+
29+
Building the package combines getting proto file and compiling coffee script
30+
source files. To build RethinkDB JavaScript driver run `npm run build`.
31+
32+
## Publishing
33+
34+
You can use NPM's default toolchain for publishing (`npm publish`), but please try some scenarios
35+
with the freshly built driver before going forward. To test the driver, run at least
36+
something like this after executing `node` command.
37+
38+
```javascript
39+
var r = require('./dist/rethinkdb');
40+
var db = 'test';
41+
var table = 'testtable'
42+
43+
r.connect({db}, function(err, conn) {
44+
r.db(db).tableCreate(table).run(conn, function() {
45+
r.db(db).tableList().run(conn, console.log);
46+
});
47+
});
2548
```
49+
50+
To publish the package run `npm publish dist` with the appropriate credentials.

build.mk

Lines changed: 0 additions & 81 deletions
This file was deleted.

package-lock.json

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,34 @@
11
{
22
"name": "rethinkdb",
3-
"version": "2.4.1",
3+
"version": "2.4.2",
44
"main": "rethinkdb",
55
"description": "This package provides the JavaScript driver library for the RethinkDB database server for use in your node application.",
6-
"keywords": ["database", "NoSQL", "reql", "query language"],
6+
"scripts": {
7+
"get-proto": "./scripts/prepare.sh",
8+
"compile": "./scripts/compile.sh",
9+
"build": "npm run get-proto && npm run compile"
10+
},
11+
"keywords": [
12+
"database",
13+
"NoSQL",
14+
"reql",
15+
"query language"
16+
],
717
"homepage": "https://rethinkdb.com",
818
"bugs": {
919
"url": "https://github.com/rethinkdb/rethinkdb/issues",
1020
"email": "bugs@rethinkdb.com"
1121
},
12-
"files": ["rethinkdb.js", "ast.js", "net.js", "util.js", "errors.js", "cursor.js", "README.md", "proto-def.js"],
22+
"files": [
23+
"rethinkdb.js",
24+
"ast.js",
25+
"net.js",
26+
"util.js",
27+
"errors.js",
28+
"cursor.js",
29+
"README.md",
30+
"proto-def.js"
31+
],
1332
"repository": {
1433
"type": "git",
1534
"url": "https://github.com/rethinkdb/rethinkdb.git"
@@ -19,5 +38,8 @@
1938
},
2039
"dependencies": {
2140
"bluebird": "^3.5.1"
41+
},
42+
"devDependencies": {
43+
"coffeescript": "1.10.0"
2244
}
2345
}

scripts/compile.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
ls -1 src/*.coffee | while read fname; do
4+
fname=$(basename "${fname}" | cut -f 1 -d '.')
5+
coffee -b -p -c "src/${fname}.coffee" > "dist/${fname}.js"
6+
done

0 commit comments

Comments
 (0)