Thanks for taking the time for contribution to Cube.js! We're very welcoming community and while it's very much appreciated if you follow these guidelines it's not a requirement.
This project and everyone participating in it is governed by the Cube.js Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to info@statsbot.co.
Cube.js works with Node.js 8+ and uses yarn as a package manager.
- After cloning Cube.js repository run
$ yarn
inpackages/cubejs-client-core
andpackages/cubejs-react
to install dependencies. - Use
$ yarn link
to add these packages to link registry. - Perform required code changes.
- Use
$ yarn build
in the repository root to build CommonJS and UMD modules. - Use
$ yarn link @cubejs-client/core
and/or$ yarn link @cubejs-client/react
in your project to test changes applied. - Use
$ yarn test
where available to test your changes. - Ensure commit CommonJS and UMD modules as part of your commit.
- Copy existing driver package structure and name it in
@cubejs-backend/<db-name>-driver
format.@cubejs-backend/mysql-driver
is very good candidate for copying this structure. - Please do not copy CHANGELOG.md.
- Name driver class and adjust package.json, README.md accordingly.
- As a rule of thumb please use only Pure JS libraries as a dependencies where possible. It increases driver adoption rate a lot.
- Typically you need to implement only
query()
andtestConnection()
methods of driver. The rest will be done byBaseDriver
class. - If db requires connection pooling prefer use
generic-pool
implementation with settings similar to other db packages. - Make sure your driver has
release()
method in case DB expects graceful shutdowns for connections. - Please use yarn to add any dependencies and run
$ yarn
within the package before committing to ensure rightyarn.lock
is in place. - Add this driver dependency to (cubejs-server-core/core/index.js)[https://github.com/statsbotco/cube.js/blob/master/packages/cubejs-server-core/core/index.js#L8].
- Find most similar
BaseQuery
implementation in@cubejs-backend/schema-compiler/adapter
. - Copy it and adjust SQL generation accordingly.
- Add
BaseQuery
implementation to@cubejs-backend/schema-compiler/adapter/QueryBuilder.js
with same name as driver.