Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
[Docs] Add Contribution Guidelines (#261)
Giuseppe Macrì5934dea21b40
diff --git a/README.md b/README.mdindex fb62561c0..72f409adb 100644--- a/README.md+++ b/README.md@@ -19,86 +19,54 @@<h1 align="center">Kepler.gl | <a href="https://uber.github.io/kepler.gl">Website</a> |<a href="https://uber.github.io/kepler.gl/#/demo">Demo App</a></h1>+<h3></h3>+[Kepler.gl][web] is a data-agnostic, high-performance web-based application for visual exploration of large-scale geolocation data sets. Built on top of [deck.gl](http://uber.github.io/deck.gl/#/), kepler.gl can render millions of points representing thousands of trips and perform spatial aggregations on the fly.-[kepler.gl](http://www.kepler.gl/) is a data-agnostic, high-performance web-based application for visual exploration of large-scale geolocation data sets. Built on top of [deck.gl](http://uber.github.io/deck.gl/#/), kepler.gl can render millions of points representing thousands of trips and perform spatial aggregations on the fly.--For what it is capable of, take a look at [kepler.gl demo app](https://uber.github.io/kepler.gl/#/demo).+For what it is capable of, take a look at [kepler.gl demo app][demo-app].Kepler.gl is a redux component that uses redux reducer to store and manage state transitions.This package consists of a reducer and the UI components to render and customize the map.-For information on how to save the map state you've created and have it persist after you've closed the browser, take a look at [this tutorial on vis.academy](http://vis.academy/#/kepler.gl/).--## User guide-Check out [kepler.gl's user documentation here](docs/a-introduction.md)--## Dev Questions - StackOverflow-Check out this [StackOverflow](https://stackoverflow.com/questions/tagged/kepler.gl)+For information on how to embed kepler.gl in your app take a look at [this tutorial][vis-academy] on vis.academy.## Links--### Env+- [Website][web]+- [Demo][demo-app]+- [Examples][examples]+- [App User guide][user-guide]+- [Tutorial][vis-academy]+- [Stack Overflow][stack]+- [Contribution Guidelines][contributing]+- API Docs - Coming Soon++## EnvUse Node v6 and above, older node versions have not been testedFor best results, use [nvm](https://github.com/creationix/nvm) `nvm install`.-### Install+## Install kepler.glInstall node (`> 6`), yarn, and project dependencies```npm install --save kepler.gl+// or+yarn add kepler.gl```-Get a [Mapbox Access Token](https://www.mapbox.com/help/define-access-token/).--### Local dev-```-npm install-```-or-```-yarn --ignore-engines-```-then-```-export MapboxAccessToken=<insert_your_token>--npm start-```-An Example app will be served at-http://localhost:8080/+kepler.gl is built upon [mapbox][mapbox]. You will need a [Mapbox Access Token][mapbox-token] to use it.-### Develop The kepler.gl Website+## Develop kepler.gl-Make sure to export mapbox token in the same terminal before start the server.-```sh- export MapboxAccessToken=<insert_your_token>-```+Take a look at the [development guide][developers] to develop kepler.gl locally.-In order to start-```- yarn web-```+## Basic Usage-To checkout the build-```- cd website && yarn build-```+Here are the basic steps to import kepler.gl into your app. You also take a look at the examples folder. Each example in the folder can be installed and run locally.-Publish on github pages __Authorized User Only__.+#### 1. Mount kepler.gl reducer in your app reducer.+Kepler.gl uses Redux to manage its internal state, along with [react-palm][react-palm] middleware to handle side effects.-<b>important* Before publish. Copy the mapbox token at [this link](http://t.uber.com/kepler.gl-token). (Only accessible by Uber developer). Deploy will fail if token is missing</b>-```- export MapboxAccessToken=<insert_your_token>- yarn deploy-```--### Basic Usage-You can also take a look at `kepler.gl/examples/demo-app` for how to use kepler.gl in your app-Here are the basic steps:--#### 1. Mount kepler.gl reducer in your app reducer. Kepler.gl uses [react-palm](https://github.com/btford/react-palm) to handle side effects.You need to add `taskMiddleware` to your store too. We are actively working on a solution where`react-palm` will not be required, however it is still a very nice side effects management tool that works easier for testing than react-thunk.@@ -165,7 +133,7 @@ overridden by the latest instance and reset to a blank state.- Default: `undefined`-You can create a free account at [www.mapbox.com](https://www.mapbox.com) and create a token at [www.mapbox.com/account/access-tokens](https://www.mapbox.com/account/access-tokens)+You can create a free account at [mapbox][mapbox] and create a token at [www.mapbox.com/account/access-tokens][mapbox-token]##### `getState` (Function, optional)@@ -406,3 +374,17 @@ config: {}```the latter will be applied and the map view will be moved the defined coordinates.++[contributing]: contributing/CONTRIBUTING.md+[demo-app]: https://uber.github.io/kepler.gl/#/demo+[github]: https://github.com/uber/kepler.gl+[github-pr]: https://help.github.com/articles/creating-a-pull-request/+[mapbox]: https://www.mapbox.com+[mapbox-token]: https://www.mapbox.com/help/define-access-token/+[developers]: contributing/DEVELOPERS.md+[examples]: https://github.com/uber/kepler.gl/tree/master/examples+[user-guide]: docs/a-introduction.md+[react-palm]: (https://github.com/btford/react-palm)+[stack]: https://stackoverflow.com/questions/tagged/kepler.gl+[web]: http://www.kepler.gl/+[vis-academy]: http://vis.academy/#/kepler.gl/diff --git a/contributing.md b/contributing.mddeleted file mode 100644index af1114eae..000000000--- a/contributing.md+++ /dev/null@@ -1,26 +0,0 @@-/* CONTRIBUTE */--This is the contribute.md of our project. Great to have you here. Here are a few ways you can help make this project better!--Contribute.md--Adding new features--If you want to contribute or add new features, please use Issue on github projects to start a new discursion. If this receive a Go ahead, you can submit your patch as PR to the repository.---Bug triage--You can help us diagnose and fix existing bugs by asking and providing answers for the following:--Is the bug reproducible as explained?-Is it reproducible in other environments (for instance, on different browsers or devices)?-Are the steps to reproduce the bug clear? If not, can you describe how you might reproduce it?-What tags should the bug have?-Is this bug something you have run into? Would you appreciate it being looked into faster?-You can close fixed bugs by testing old tickets to see if they are still happening.--Documentation-If you have some doubt about the project, you can check the wiki or check the documentation on https://uber.github.io/kepler.gl/#/--Help us with documentation herediff --git a/contributing/CODE_OF_CONDUCT.md b/contributing/CODE_OF_CONDUCT.mdnew file mode 100644index 000000000..e327d9aa5--- /dev/null+++ b/contributing/CODE_OF_CONDUCT.md@@ -0,0 +1,75 @@+# Contributor Covenant Code of Conduct++## Our Pledge++In the interest of fostering an open and welcoming environment, we as+contributors and maintainers pledge to making participation in our project and+our community a harassment-free experience for everyone, regardless of age,+body size, disability, ethnicity, gender identity and expression, level of+experience, nationality, personal appearance, race, religion, or sexual+identity and orientation.++## Our Standards++Examples of behavior that contributes to creating a positive environment+include:++* Using welcoming and inclusive language+* Being respectful of differing viewpoints and experiences+* Gracefully accepting constructive criticism+* Focusing on what is best for the community+* Showing empathy towards other community members++Examples of unacceptable behavior by participants include:++* The use of sexualized language or imagery and unwelcome sexual attention or+ advances+* Trolling, insulting/derogatory comments, and personal or political attacks+* Public or private harassment+* Publishing others' private information, such as a physical or electronic+ address, without explicit permission+* Other conduct which could reasonably be considered inappropriate in a+ professional setting++## Our Responsibilities++Project maintainers are responsible for clarifying the standards of acceptable+behavior and are expected to take appropriate and fair corrective action in+response to any instances of unacceptable behavior.++Project maintainers have the right and responsibility to remove, edit, or+reject comments, commits, code, wiki edits, issues, and other contributions+that are not aligned to this Code of Conduct, or to ban temporarily or+permanently any contributor for other behaviors that they deem inappropriate,+threatening, offensive, or harmful.++## Scope++This Code of Conduct applies both within project spaces and in public spaces+when an individual is representing the project or its community. Examples of+representing a project or community include using an official project e-mail+address, posting via an official social media account, or acting as an+appointed representative at an online or offline event. Representation of a+project may be further defined and clarified by project maintainers.++## Enforcement++Instances of abusive, harassing, or otherwise unacceptable behavior may be+reported by contacting the project team at [email protected]. The project+team will review and investigate all complaints, and will respond in a way+that it deems appropriate to the circumstances. The project team is obligated+to maintain confidentiality with regard to the reporter of an incident.+Further details of specific enforcement policies may be posted separately.++Project maintainers who do not follow or enforce the Code of Conduct in good+faith may face temporary or permanent repercussions as determined by other+members of the project's leadership.++## Attribution++This Code of Conduct is adapted from the [Contributor Covenant][homepage],+version 1.4, available at+[http://contributor-covenant.org/version/1/4][version].++[homepage]: http://contributor-covenant.org+[version]: http://contributor-covenant.org/version/1/4/diff --git a/contributing/CONTRIBUTING.md b/contributing/CONTRIBUTING.mdnew file mode 100644index 000000000..df36a4c5b--- /dev/null+++ b/contributing/CONTRIBUTING.md@@ -0,0 +1,85 @@+# Contributing to kepler.gl++Great to have you here. Here are a few ways you can help make kepler.gl even better!++Note that you'll need to sign [Uber's Contributor License Agreement][cla]+before we can accept any of your contributions. If necessary, a bot will remind+you to accept the CLA when you open your pull request.++* [Code of Conduct](#coc)+* [Questions and Problems](#question)+* [Issues and Bugs](#issue)+* [Feature Requests](#feature)+* [Improving Documentation](#docs)+* [Submitting Pull Request](#submit-pr)++## <a name="coc"></a> Code of Conduct+Help us keep kepler.gl open and inclusive. Please read and follow our [Code of Conduct](./CODE_OF_CONDUCT.md).++## <a name="question"></a> Questions and Problems+We are trying to keep our Github page for issues, bugs and feature requests only. You've got much better chances of getting supports on [Stack Overflow][stack]. Many people including our engineers are ready to answer questions on Stack Overflow. Your question might already been answered there.++## <a name="issue"></a> Issues and Bugs+If you find a bug, you can help us by submitting an [Issue][git-iss] to our GitHub Repository. Please use the github [Bug Report Template][git-bug] and fill in as much as information as possible. Even better, you can submit a [Pull Request][git-pr] with a fix.++## <a name="feature"></a> Feature Requests++If you want to contribute or add new features, please use [Issue][git-iss] on github projects to start a new discussion using the [Feature Request Template][git-feature]. If this receive a Go ahead, you can submit your patch as PR to the repository.++If you would like to implement a new feature then consider what kind of change it is:++* **Take a look at our [roadmap][roadmap]** It lists out the items we are planning to work on+* **Pick your item** Pick an item to execute+* **Claim the item** Reply in the ticket linked in the roadmap to claim the item, one of the member of the technical team will respond+* **Major Changes** that you wish to contribute to the project should be discussed first in an+ [GitHub issue][github-issues] that clearly outlines the changes and benefits of the feature.+* **Small Changes** can directly be crafted and submitted to the [GitHub Repository][github]+ as a Pull Request. See the section about [Pull Request Submission Guidelines](#submit-pr), and+ for detailed information the [core development documentation][developers].+* **Let's review your code** Create a pull request++## <a name="docs"></a> Improving Documentation++Questions about kepler.gl? you can checkout the examples and medium articles on [kepler.gl][website].++[User Guides][user-guide] and API Docs are saved in the [docs][api-docs] folder on Github. Help us improve documentation here by submitting a Pull Request.++## <a name="submit-pr"></a> Submitting Pull Request+Before you submit your pull request consider the following guidelines:++* Search [GitHub][git-pr] for an open or closed Pull Request+ that relates to your submission. You don't want to duplicate effort.+* Create the [development environment][developers.setup]+* Make your changes in a new git branch:++ ```shell+ git checkout -b my-fix-branch master+ ```++* Create your patch commit, **including appropriate test cases**.+* If the changes affect public APIs, change or add relevant [documentation][developers.documentation].+* Run the AngularJS [unit][developers.tests-unit] and [E2E test][developers.tests-e2e] suites, and ensure that all tests+ pass. It is generally sufficient to run the tests only on Chrome, as our Travis integration will+ run the tests on all supported browsers.+* Run `yarn grunt eslint` to check that you have followed the automatically enforced coding rules+* Commit your changes using a descriptive commit message that follows our+ [commit message conventions][developers.commits]. Adherence to the+ [commit message conventions][developers.commits] is required, because release notes are+ automatically generated from these messages.++[cla]: https://cla-assistant.io/uber/kepler.gl+[github]: https://github.com/uber/kepler.gl+[git-iss]: https://github.com/uber/kepler.gl/issues+[git-pr]: https://github.com/uber/kepler.gl/pulls+[git-feature]: https://github.com/uber/kepler.gl/issues/new?template=feature_request.md+[git-bug]: https://github.com/uber/kepler.gl/issues/new?template=bug_report.md+[stack]: https://stackoverflow.com/questions/tagged/kepler.gl+[api-docs]: https://github.com/uber/kepler.gl/tree/master/docs+[website]: https://uber.github.io/kepler.gl/#/+[user-guide]: https://github.com/uber/kepler.gl/blob/master/docs/a-introduction.md+[roadmap]: https://github.com/uber/kepler.gl/wiki/Roadmap+[developers]: DEVELOPERS.md+[developers.commits]: DEVELOPERS.md#commits+[developers.documentation]: DEVELOPERS.md#documentation+[developers.rules]: DEVELOPERS.md#rules+[developers.setup]: DEVELOPERS.md#setupdiff --git a/contributing/DEVELOPERS.md b/contributing/DEVELOPERS.mdnew file mode 100644index 000000000..ce6883cea--- /dev/null+++ b/contributing/DEVELOPERS.md@@ -0,0 +1,243 @@+# Developing Kepler.gl++* [Development Setup](#setup)+* [Running Tests](#tests)+* [Coding Rules](#rules)+* [Commit Message Guidelines](#commits)+* [Writing Documentation](#documentation)+* [Developing kepler.gl Website](#website)++## <a name="setup"> Development Setup++This document describes how to set up your development environment to build and test Kepler.gl, and+explains the basic mechanics of using `git`, `node`, `yarn`.++### Installing Dependencies++Before you can build Kepler.gl, you must install and configure the following dependencies on your+machine:++* [Git](http://git-scm.com/): The [Github Guide to+ Installing Git][git-setup] is a good source of information.++* [Node.js ^6.x](http://nodejs.org): We use Node to generate the documentation, run a+ development web server, run tests, and generate distributable files. Depending on your system,+ you can install Node either from source or as a pre-packaged bundle.++ We recommend using [nvm](https://github.com/creationix/nvm) (or+ [nvm-windows](https://github.com/coreybutler/nvm-windows))+ to manage and install Node.js, which makes it easy to change the version of Node.js per project.++* [Yarn](https://yarnpkg.com): We use Yarn to install our Node.js module dependencies+ (rather than using npm). See the detailed [installation instructions][yarn-install].++#### Fork Kepler.gl Repo+If you plan to contribute code to kepler.gl, you must have a [GitHub account](https://github.com/signup/free) so you can push code and open Pull Requests in the [GitHub Repository][github]. You must [fork](http://help.github.com/forking) the+[main kepler.gl repository][github] to [create a Pull Request][github-pr].+++#### Developing kepler.gl++To develop features, debug code, run tests, we use webpack to start a local web server and serve the kepler.gl demo app from the src directory.++```shell+# Clone your kepler.gl fork repository:+git clone [email protected]:<github username>/kepler.gl.git++# Go to the kepler.gl directory:+cd kepler.gl++# Add the main kepler.gl repository as an upstream remote to your repository:+git remote add upstream "[email protected]:uber/kepler.gl.git"++# Install JavaScript dependencies:+yarn --ignore-engines++# Setup mapbox access token locally+export MapboxAccessToken=<insert_your_token>++# Start the kepler.gl demo app+npm start+```++An demo app will be served at++```text+http://localhost:8080/+```++This is the demo app we hosted on [http://kepler.gl/#/demo][demo-app]. By default, it serves non-minified source code inside the src directory.++## <a name="tests"> Running Tests++We write unit and browser tests with [Tape][tape] and [Enzyme][enzyme], and lint with [ESLint][eslint]. Make sure to run test before submitting your PR. To run all of the tests once with node:++```shell+yarn test+```++To run seperately+```shell+# lint+yarn lint++# node tests+yarn test-node++# browser tests+yarn test-browser++# fast test (no linting)+yarn fast-test+```++To generate a coverage report+```shell+yarn cover+```++<!-- ## <a name="rules"></a> Coding Rules -->++To ensure consistency throughout the source code, keep these rules in mind as you are working:++* All features or bug fixes **must be tested** by one or more [specs][unit-testing].+* All public API methods **must be documented** with using jsdoc. To see how we document our APIs, please check+ out the existing source code and see the section about [writing documentation](#documentation)+++## <a name="commits"></a> Git Commit Guidelines++To commit your changes, please follow our rules over how our git commit messages can be formatted. This leads to **more readable and unified messages** that are easy to follow. But also,+we use the git commit messages to **generate the kepler.gl change log**.++### Commit Message Format+Each commit message consists of a **header** and a **body**. The header has a special+format that includes a **type** and a **subject**. The **PR** # will be auto-generated once the PR is merged.++```shell+[<type>]<subject>(<pr>)+<BLANK LINE>+<body>++#e.g.+[Enhancement] Upgrade type-analyzer to pass 0/1 as integer (#317)++* Upgrade to [email protected]+* Add test+```++The **header** is mandatory and the **scope** of the header is optional.++Any line of the commit message cannot be longer 100 characters! This allows the message to be easier+to read on GitHub as well as in various git tools.++### Revert+If the commit reverts a previous commit, it should begin with `revert: `, followed by the header+of the reverted commit.+In the body it should say: `This reverts commit <hash>.`, where the hash is the SHA of the commit+being reverted.+A commit with this format is automatically created by the [`git revert`][git-revert] command.++### Type+Must be one of the following, capitalizd.++* **[Feat]]**: A new feature+* **[Enhancement]]**: An update of a existing feature+* **[Bug]]**: A bug fix+* **[Docs]]**: Documentation only changes+* **[Style]**: Changes that do not affect the meaning of the code (white-space, formatting, missing+ semi-colons, typos, etc)+* **[Refactor]**: A code change that neither fixes a bug nor adds a feature+* **[Perf]**: A code change that improves performance+* **[Test]**: Adding missing or correcting existing tests+* **[Chore]**: Changes to the build process or auxiliary tools and libraries such as documentation+ generation++### Subject+The subject contains succinct description of the change:++* use the imperative, present tense: "change" not "changed" nor "changes"+* don't capitalize first letter+* no dot (.) at the end++### Body+Just as in the **subject**, use the imperative, present tense: "change" not "changed" nor "changes".+The body should include the motivation for the change and contrast this with previous behavior.++**Breaking Changes** should start with the word `BREAKING CHANGE:` with a space or two newlines.+The rest of the commit message is then used for this.++## <a name="documentation"></a> Writing Documentation (THIS PART IS NOT AVAILABLE YET)++The Kepler.gl project uses [jsdoc](http://usejsdoc.org/)++This means that all the docs are stored inline in the source code and so are kept in sync as it+changes.++There is also extra content (the developer guide, error pages, the tutorial,+and misceallenous pages) that live inside the Kepler.gl repository as markdown files.++This means that since we generate the documentation from the source code, we can easily provide+version-specific documentation by simply checking out a version of Kepler.gl and running the build.++### Building and viewing the docs locally+We build Api docs from scratch using [documentation.js][documentationjs]. It generates docs from jsdoc:++```shell+yarn docs+```++### Writing jsdoc+You can find JSDoc instructions [here][jsDoc]. Documentation.js is interested in the following block tags:++* `@param {type} name description` - describes a parameter of a function+* `@returns {type} description` - describes what a function returns+* `@property` - describes a property of an object+* `@description` - used to provide a description of a component in markdown++* `@example` - specifies an example.+* `@public` - Only methods with @public tag will be included in the docs++The `type` in `@param` and `@returns` must be wrapped in `{}` curly braces, e.g. `{Object|Array}`.+Parameters can be made optional by *either* appending a `=` to the type, e.g. `{Object=}`, *or* by+putting the `[name]` in square brackets.+Default values are only possible with the second syntax by appending `=<value>` to the parameter+name, e.g. `@param {boolean} [ownPropsOnly=false]`.+++## <a name="website"></a> Develop The kepler.gl Website++Make sure to export mapbox token in the same terminal before start the server.+```sh+ export MapboxAccessToken=<insert_your_token>+```++In order to start+```+ yarn web+```++To checkout the build+```+ cd website && yarn build+```++Publish on github pages __Authorized User Only__.++<b>important* Before publish. Copy the mapbox token at [this link](http://t.uber.com/kepler.gl-token). (Only accessible by Uber developer). Deploy will fail if token is missing</b>+```+ export MapboxAccessToken=<insert_your_token>+ yarn deploy+```++[demo-app]: http://kepler.gl/#/demo+[documentationjs]: https://documentation.js.org/+[eslint]: https://eslint.org/+[enzyme]: https://airbnb.io/enzyme/+[git-revert]: https://git-scm.com/docs/git-revert+[git-setup]: https://help.github.com/articles/set-up-git+[github]: https://github.com/uber/kepler.gl+[github-pr]: https://help.github.com/articles/creating-a-pull-request/+[jsDoc]: http://usejsdoc.org/+[tape]: https://github.com/substack/tape+[yarn-install]: https://yarnpkg.com/en/docs/installdiff --git a/examples/README.md b/examples/README.mdindex f7d9f3185..86afd550a 100644--- a/examples/README.md+++ b/examples/README.md@@ -1,9 +1,23 @@# Examples-Below are a list of examples that demonstrates uses of `kepler.gl`.+A list of examples to demonstrate adding `kepler.gl` to your app. Each of the examples is a complete project that can be ran locally.-## Demo App-This is the src code of kepler.gl demo app.+To start each example, cd into the folder then run:-## Open modal-Open kepler.gl in a modal+```+yarn --ignore-engines && yarn start+```++- ### [demo-app][demo-app]++ kepler.gl as a single page app, loading sample maps from remote url, saving map data to dropbox. This is also the source code of kepler.gl/#/demo.++- ### [open-modal][open-modal]+ Open kepler.gl in a modal.++- ### [custom-reducer][custom-reducer]+ Cutomize kepler.gl reducer initial state, adding more actions using plugin.++[custom-reducer]: custom-reducer+[demo-app]: demo-app+[open-modal]: open-modaldiff --git a/scripts/install-and-start.js b/scripts/install-and-start.jsindex dde66875a..a8fbeac13 100644--- a/scripts/install-and-start.js+++ b/scripts/install-and-start.js@@ -25,7 +25,7 @@ const folder = process.argv[2];const script = process.argv[3];const cmd = !existsSync(`${folder}/node_modules`)- ? `npm i && npm run ${script}`+ ? `yarn --ignore-engines && npm run ${script}`: `npm run ${script}`;execSync(cmd, {