Skip to content

Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.

added package.json babelrc webpack.config, and index files

Shan He9d8b5a386476
diff --git a/.babelrc b/.babelrc
new file mode 100644
index 000000000..0f6b3892e
--- /dev/null
+++ b/.babelrc
@@ -0,0 +1,33 @@
+{
+ "presets": [
+ "babel-preset-es2015",
+ "babel-preset-react",
+ "babel-preset-stage-0"
+ ],
+ "plugins": [
+ "transform-decorators-legacy",
+ ["transform-runtime", {
+ "polyfill": false,
+ "regenerator": true
+ }],
+ ["inline-json-import", {}],
+ [
+ "module-resolver",
+ {
+ "root": [
+ "./src"
+ ],
+ "alias": {
+ "test": "./test"
+ }
+ }
+ ]
+ ],
+ "env": {
+ "test": {
+ "plugins": [
+ "istanbul"
+ ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index c275bed2f..d24317933 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,6 +6,7 @@ dist/
*/**/yarn.lock
yarn-error.log
+*/**/package-lock.json
package-lock.json
.DS_Store
diff --git a/README.md b/README.md
index 9bc3c5cea..ba93ef5ed 100644
--- a/README.md
+++ b/README.md
@@ -1,14 +1,35 @@
-# kepler.gl
+# Kepler.gl
-### Development
+Kepler.gl is the core package of Voyager. It is a map visualization tool that provides the UI
+to visualize any type of geospatial dataset. For what it is capable of. Take a look at [Voyager](voyager.uberinternal.com)
-Install node (`> 6`), yarn, and project dependencies
+Kepler.gl is a redux component that uses redux reducer to store and manage state transitions.
+The package consists of a reducer and the UI component to render and customize the map
+
+##Links
+
+### Env
+Use Node v6 and above, older node version has not been tested
- yarn --ignore-engines
+### Install
+Install node (`> 6`), yarn, and project dependencies
-Run the project
+```
+npm install --save @uber/kepler.gl
+```
- npm start
+### Local dev
+```
+npm install
+```
+or
+```
+yarn --ignore-engines
+```
+then
+```
+npm start
+```
### Website
@@ -23,3 +44,323 @@ To checkout the build
Publish on github pages
yarn deploy
+
+
+An Example app will be served at
+http://localhost:8080/
+
+### Basic Usage
+You can also take a look at `kepler.gl/examples/demo-app` for How to uer kepler.gl in your app
+Here are the basic steps:
+
+#### 1. Mount kepler.gl reducer in your app reducer. Kepler.gl is using [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 much easy for testing (unlike react-thunk).
+
+```
+import keplerGlReducer from '@uber/kepler.gl/reducers';
+import {createStore, combineReducers, applyMiddleware, compose} from 'redux';
+import {taskMiddleware} from 'react-palm';
+
+const reducers = combineReducers({
+ // <-- mount kepler.gl reducer in your app
+ keplerGl: keplerGlReducer,
+
+ // Your other reducers here
+ app: appReducer
+});
+
+// using createStore
+const store = createStore(reducer, applyMiddleWare(taskMiddleware))
+
+// using enhancers
+const initialState = {}
+const middlewares = [taskMiddleware]
+const enhancers = [
+ applyMiddleware(...middlewares)
+]
+
+const store = createStore(reducer, initialState, compose(...enhancers))
+```
+
+If you mount kepler.gl reducer in another address instead of `keplerGl`, or kepler.gl reducer is not
+mounted at root of your state, you will need to specify the path to it when you mount the component
+with the `getState` prop.
+
+#### 2. Mount kepler.gl Component
+
+```
+import KeplerGl from '@uber/kepler.gl';
+
+const Map = props => (
+ <KeplerGl
+ id="foo"
+ width={width}
+ height={height}/>
+);
+```
+
+##### Component Props
+
+##### `id` (String, required)
+
+- Default: `map`
+
+The id of this KeplerGl instance. `id` is required if you have multiple
+KeplerGl instances in your app. It defines the prop name of this KeplerGl state that
+stored in the KeplerGl reducer. For example. the state of the KeplerGl component with id `foo` is
+stored in `state.keplerGl.foo`.
+
+In case you create multiple kepler.gl instances using the same id, kepler.gl state defined by the entry will be
+overridden by the latest instance and reset to a blank state.
+
+
+##### `mapboxApiAccessToken` (String, required)
+
+- Default: `undefined`
+
+You can create a free account at [www.mapbox.com](www.mapbox.com) and create a token at [www.mapbox.com/account/access-tokens](www.mapbox.com/account/access-tokens)
+
+##### `getState` (Function, optional)
+
+- Default: `state => state.keplerGl`
+
+The path to the root keplerGl state in your reducer.
+
+##### `width` (Number, optional)
+
+- Default: `800`
+
+Width of the KeplerGl UI.
+
+##### `height` (Number, optional)
+
+- Default: `800`
+
+##### `appName` (String, optional)
+
+- Default: `Kepler.Gl`
+
+App name displayed in side panel header
+
+##### `version` (String, optional)
+
+- Default: `v1.0`
+
+version displayed in side panel header
+
+##### `onSaveMap` (Function, optional)
+
+- Default: `() => {}`
+
+Action called when click Save Map Url in side panel header.
+
+##### `actions` (Object, optional)
+
+- Default: `{}`
+
+Actions payload creator to replace default kepler.gl action. Only use custom action when you want to modify action payload.
+
+#### 3. Dispatch custom actions to `keplerGl` reducer.
+
+One greatest advantages of using reducer vs. react component state to handle keplerGl state is the flexibility
+to customize its behavior. If you only have one `KeplerGl` instance in your app or never intent to dispatch actions to KeplerGl from outside the component itself,
+you don’t need to worry about forwarding dispatch and can move on to the next section. But life is full of customizations, and we want to make yours as enjoyable as possible.
+
+There are multiple ways to dispatch actions to a specific `KeplerGl` instance.
+
+- In the root reducer, with reducer updaters.
+
+Each action is mapped to a reducer updater in kepler.gl. You can import the reducer updater correspond to a specific action, and call it with the previous state and action payload to get the updated state.
+e.g. `updateVisDataUpdater` is the updater for `ActionTypes.UPDATE_VIS_DATA` (take a look at each reducer `reducers/vis-state.js` for action to updater mapping).
+Here is an example how you can listen to an app action `QUERY_SUCCESS` and call `updateVisDataUpdater` to load data into Kepler.Gl.
+```
+import keplerGlReducer, {visStateUpdaters} from '@uber/kepler.gl/reducers';
+
+// Root Reducer
+const reducers = combineReducers({
+ keplerGl: keplerGlReducer,
+
+ app: appReducer
+});
+
+const composedReducer = (state, action) => {
+ switch (action.type) {
+ case 'QUERY_SUCCESS':
+ return {
+ ...state,
+ keplerGl: {
+ ...state.keplerGl,
+
+ // 'map' is the id of the keplerGl instance
+ map: {
+ ...state.keplerGl.map,
+ visState: visStateUpdaters.updateVisDataUpdater(
+ state.keplerGl.map.visState, {datasets: action.payload})
+ }
+ }
+ };
+ }
+ return reducers(state, action);
+};
+
+export default composeddReducer;
+```
+
+- Using redux `connect`
+
+You can add dispatch function to your component that dispatch action to a specific `keplerGl` component,
+using connect.
+
+
+```
+// component
+import KeplerGl from '@uber/kepler.gl';
+
+// action and forward dispatcher
+import {toggleFullScreen, forwardTo} from '@uber/kepler.gl/actions';
+import {connect} from 'react-redux';
+
+Const MapContainer = props => (
+ <div>
+ <button onClick=() => props.keplerGlDispatch(toggleFullScreen())/>
+ <KeplerGl
+ id="foo"
+ />
+ </div>
+)
+
+const mapStateToProps = state => state
+const dispatchToProps = (dispatch, props) => ({
+ dispatch,
+ keplerGlDispatch: forwardTo(‘foo’, dispatch)
+});
+
+export default connect(
+ mapStateToProps,
+ dispatchToProps
+)(MapContainer);
+```
+
+- Wrap action payload
+
+You can also simply wrap an action into a forward action with the `wrapTo` helper
+
+```
+// component
+import KeplerGl from '@uber/kepler.gl';
+
+// action and forward dispatcher
+import {toggleFullScreen, wrapTo} from '@uber/kepler.gl/actions';
+
+// create a function to wrapper action payload to 'foo'
+const wrapToMap = wrapTo('foo');
+const MapContainer = ({dispatch}) => (
+ <div>
+ <button onClick=() => dispatch(wrapToMap(toggleFullScreen())/>
+ <KeplerGl
+ id="foo"
+ />
+ </div>
+);
+
+```
+
+#### 4. Replace default components.
+Everyone wants the flexibility to render custom kepler.gl componenents. Kepler.gl has a dependency injection system that allow you to inject
+components to KeplerGl replacing existing ones. All you need to do is to create a component factory for the one you want to replace, import the original component factory
+and call `injectComponents` at the root component of your app where `KeplerGl` is mounted.
+Take a look at `examples/demo-app/src/app.js` and see how it renders custom side panel header in kepler.gl
+
+```
+// import injectComponents helper and original PanelHeaderFactory
+import {injectComponents, PanelHeaderFactory} from '@uber/kepler.gl/components';
+
+// define custom header
+const CustomHeader = () => (<div>My kepler.gl app</div>);
+const myCustomHeaderFactory = () => CustomHeader;
+
+// Inject custom header into Kepler.gl, replacing original one
+const KeplerGl = injectComponents([
+ [PanelHeaderFactory, myCustomHeaderFactory]
+]);
+
+// render KeplerGl, it's going to render your custom header instead
+const MapContainer = (}) => (
+ <div>
+ <KeplerGl
+ id="foo"
+ />
+ </div>
+);
+
+```
+
+Using `withState` helper to Add reducer state and actions to customized component as additional props.
+
+```
+import {withState, injectComponents, PanelHeaderFactory} from '@uber/kepler.gl/components';
+import {visStateLens} from '@uber/kepler.gl/reducers';
+
+// custom action wrap to mounted instance
+const addTodo = (text) => wrapTo('map', {
+ type: 'ADD_TODO',
+ text
+});
+
+// define custom header
+const CustomHeader = ({visState, addTodo}) => (
+ <div onClick={() => addTodo('hello')}>{`${Object.keys(visState.datasets).length} dataset loaded`}</div>
+);
+
+// now CustomHeader will receive `visState` and `addTodo` as additional props.
+const myCustomHeaderFactory = () => withState(
+ // keplerGl state lenses
+ [visStateLens],
+ // customMapStateToProps
+ headerStateToProps,
+ // actions
+ {addTodo}
+)(CustomHeader);
+
+```
+#### 5. How to add data to map
+In order to interact with a kepler.gl instance and add new data to it the following methods are available:
+- updateVisData
+- addDataToMap
+It is also important to remember that Kepler.gl provides an easy API (```KeplerGlSchema.getConfigToSave```) to generate a dump of the current kepler instance configuration.
+
+
+##### UpdateVisData
+This action will upload a new datasets and update the visState according with input parameters.
+The method takes 3 parameters as input:
+- ```datasets | object```: new data to be added to the current kepler.gl instance
+- ```options | object ``` - ```{centerMap: true, readOnly: false}```:
+ - if centerMap is set to true kepler.gl will place the map view within the data points boundaries
+ - if readOnly is set to true the left setting panel will not be visible
+- ```config | object```: this is the new visState configuration that will be loaded into the kepler.gl instance.
+Properties defined in this object will override the current ones in the redux state.
+
+
+##### addDataToMap
+This method is really similar to the previous one but it is able to update the full kepler.gl configuration (mapState, mapStyle, visState).
+This action takes an object as input with the following properties
+```javascript
+{
+ datasets | object: same as previous
+ options | object: same as previous
+ config | object: this object will contain the full kepler.gl instance configuration {mapState, mapStyle, visState}.
+}
+```
+It is important to notice that the config object value will always have higher priority than the options properties.
+For instance, if you provide ```{centerMap: true}``` as part of the options object and in your config object you pass
+the mapState configuration with latitude and longitude define as it follows:
+```javascript
+config: {
+ mapState: {
+ latitude: 33.88608913680742,
+ longitude: -84.43459130456425
+ }
+}
+```
+the latter one will be applied and the map view will be moved the defined coordinates.
diff --git a/TODO.md b/TODO.md
new file mode 100644
index 000000000..6dc068ab6
--- /dev/null
+++ b/TODO.md
@@ -0,0 +1,22 @@
+
+
+### Bugs
+- Time playback slider sticking out after resize
+- Heatmap frozen
+
+### Refactor Tasks
+- Refactor Layer configurator component so it works better with the layer API [shan]
+
+### Feature
+- Re-implement file upload to use event streaming (no react-palm) [shan]
+- Input map style from mapbox style url [shan]
+- Map style API to add custom map style [shan]
+- Field type editor [shan]
+- Export map [javid, shan]
+
+### Remaining UI Update
+- Free form color picker [shan]
+- Vis config by channel UI (add value switch) [shan]
+
+### Design Request
+- More map styles [erik]
diff --git a/actions.js b/actions.js
new file mode 100644
index 000000000..53b7b47c2
--- /dev/null
+++ b/actions.js
@@ -0,0 +1,21 @@
+// Copyright (c) 2018 Uber Technologies, Inc.
+//
+// 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.
+
+module.exports = require('./dist/actions');
diff --git a/components.js b/components.js
new file mode 100644
index 000000000..ed19abc2c
--- /dev/null
+++ b/components.js
@@ -0,0 +1,21 @@
+// Copyright (c) 2018 Uber Technologies, Inc.
+//
+// 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.
+
+module.exports = require('./dist/components');
diff --git a/constants.js b/constants.js
new file mode 100644
index 000000000..b0dc04940
--- /dev/null
+++ b/constants.js
@@ -0,0 +1,21 @@
+// Copyright (c) 2018 Uber Technologies, Inc.
+//
+// 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.
+
+module.exports = require('./dist/constants');
diff --git a/layers.js b/layers.js
new file mode 100644
index 000000000..c87c41ec4
--- /dev/null
+++ b/layers.js
@@ -0,0 +1,21 @@
+// Copyright (c) 2018 Uber Technologies, Inc.
+//
+// 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.
+
+module.exports = require('./dist/layers');
diff --git a/package.json b/package.json
index 8a48754f7..ff76dd8e6 100644
--- a/package.json
+++ b/package.json
@@ -1,43 +1,171 @@
{
"name": "kepler.gl",
"author": "Shan He <[email protected]>",
+ "version": "0.0.11",
+ "description": "kepler.gl is a webgl based application to visualize large scale location data in the browser",
+ "license": "MIT",
+ "private": true,
"main": "dist/index.js",
- "version": "0.0.1",
"engines": {
"node": "^8.7.0",
"npm": "^5.4.2",
"yarn": "^0.27.5"
},
+ "keywords": [
+ "babel",
+ "es6",
+ "react",
+ "webgl",
+ "visualization",
+ "deck.gl"
+ ],
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/uber/kepler.gl.git"
+ },
"scripts": {
- "start-local": "webpack-dev-server --env.local --progress --hot --port 3030 --open",
- "start": "webpack-dev-server --env.local --progress --port 3030 --open",
- "build-clean": "rm -rf ./dist && mkdir dist",
- "build-static": "cp -r ./src/static/* dist && cp index.html dist",
- "build-script": "webpack -p --env.prod",
- "build": "npm run build-clean && npm run build-static && npm run build-script",
+ "test": "npm run test-node && npm run test-browser",
+ "fast-test": "NODE_ENV=test babel-tape-runner ./test/node.js && NODE_ENV=test babel-tape-runner -r ./test/setup-browser-env.js ./test/browser.js",
+ "test-browser": "NODE_ENV=test babel-tape-runner -r ./test/setup-browser-env.js ./test/browser.js | tap-spec",
+ "test-node": "NODE_ENV=test babel-tape-runner ./test/node.js | tap-spec",
+ "cover": "nyc --reporter html --reporter cobertura --reporter json-summary npm test && nyc report",
+ "start": "(cd examples/demo-app && (path-exists node_modules || npm i) && npm run start-local)",
+ "start:custom-layer": "(cd examples/custom-layer && (path-exists node_modules || npm i) && npm run start-local)",
+ "build": "rm -fr dist && uber-licence && babel src --out-dir dist --plugins=transform-es2015-modules-commonjs --source-maps inline",
+ "lint": "eslint src examples/demo-app/src examples/custom-layer/src",
+ "check-licence": "uber-licence --dry",
+ "add-licence": "uber-licence",
+ "prepublish": "uber-licence && npm run build",
"web": "(cd website && yarn --ignore-engines && yarn start)",
"deploy": "(cd website && yarn build && git checkout gh-pages && cp dist/* .. && git add .. && git commit -m 'Update website' && git push origin gh-pages && git checkout master)"
},
+ "files": [
+ "dist",
+ "src",
+ "examples",
+ "actions.js",
+ "components.js",
+ "constants.js",
+ "layers.js",
+ "processors.js",
+ "reducers.js",
+ "schemas.js",
+ "styles.js"
+ ],
"dependencies": {
- "classnames": "^2.2.5",
- "global": "^4.3.2",
- "react": "^15.4.1",
- "react-dom": "^15.4.1"
+ "@mapbox/geo-viewport": "^0.2.2",
+ "@mapbox/geojson-extent": "^0.3.2",
+ "classnames": "^2.2.1",
+ "colorbrewer": "^1.0.0",
+ "curry": "^1.2.0",
+ "d3-array": "^1.2.0",
+ "d3-axis": "^1.0.8",
+ "d3-brush": "^1.0.4",
+ "d3-color": "^1.0.3",
+ "d3-dsv": "^1.0.3",
+ "d3-format": "^1.2.0",
+ "d3-hexbin": "^0.2.2",
+ "d3-request": "^1.0.6",
+ "d3-scale": "^1.0.6",
+ "deck.gl": "4.1.6",
+ "dom-to-image": "^2.6.0",
+ "fuzzy": "^0.1.3",
+ "geojson-normalize": "0.0.1",
+ "global": "^4.3.0",
+ "keymirror": "^0.1.1",
+ "lodash.clonedeep": "^4.0.1",
+ "lodash.flattendeep": "^4.2.0",
+ "lodash.memoize": "^4.1.2",
+ "lodash.pick": "^4.4.0",
+ "lodash.throttle": "^4.1.1",
+ "lodash.uniq": "^4.0.1",
+ "luma.gl": "4.0.6",
+ "moment": "^2.10.6",
+ "prop-types": "^15.6.0",
+ "react-anything-sortable": "^1.7.2",
+ "react-data-grid": "2.0.80-am-fix-defaultprops-warnings3337",
+ "react-file-drop": "^0.1.8",
+ "react-map-gl": "^3.2.1",
+ "react-modal": "^3.1.10",
+ "react-onclickoutside": "https://unpm.uberinternal.com/react-onclickoutside/-/react-onclickoutside-4.9.0.tgz",
+ "react-palm": "^0.8.1",
+ "react-redux": "^4.0.0",
+ "react-tooltip": "https://registry.npmjs.org/react-tooltip/-/react-tooltip-3.3.0.tgz",
+ "react-vis": "^1.8.0",
+ "redux": "^3.0.4",
+ "redux-actions": "^2.2.1",
+ "reselect": "^3.0.1",
+ "styled-components": "^2.2.4",
+ "supercluster": "^3.0.0",
+ "type-analyzer": "https://registry.npmjs.org/uber-web/-/type-analyzer-0.1.4.tgz",
+ "uber-licence": "^3.1.1",
+ "wellknown": "^0.5.0"
},
"devDependencies": {
- "autoprefixer-loader": "^3.2.0",
- "babel-core": "^6.25.0",
- "babel-loader": "^7.1.1",
- "babel-preset-es2015": "^6.24.1",
- "babel-preset-react": "^6.24.1",
+ "babel-cli": "^6.7.7",
+ "babel-core": "^6.7.7",
+ "babel-eslint": "6.1.0",
+ "babel-istanbul": "^0.6.0",
+ "babel-loader": "^6.2.10",
+ "babel-plugin-inline-json-import": "^0.2.1",
+ "babel-plugin-istanbul": "^4.1.4",
+ "babel-plugin-module-resolver": "^3.0.0",
+ "babel-plugin-transform-builtin-extend": "^1.1.0",
+ "babel-plugin-transform-decorators-legacy": "^1.3.4",
+ "babel-plugin-transform-es2015-modules-commonjs": "^6.26.0",
+ "babel-plugin-transform-runtime": "^6.23.0",
+ "babel-polyfill": "^6.26.0",
+ "babel-preset-es2015": "^6.3.13",
+ "babel-preset-react": "^6.3.13",
"babel-preset-stage-0": "^6.24.1",
- "path-exists-cli": "^1.0.0",
- "url-loader": "^0.5.9",
- "webpack": "^2.2.0",
- "webpack-dev-server": "^2.2.0"
+ "babel-register": "^6.24.1",
+ "babel-runtime": "^6.26.0",
+ "babel-tape-runner": "^2.0.1",
+ "babelify": "^8.0.0",
+ "enzyme": "^3.2.0",
+ "enzyme-adapter-react-15.4": "^1.0.5",
+ "eslint": "^3.0.0",
+ "eslint-config-prettier": "^2.4.0",
+ "eslint-config-uber-es2015": "^3.0.0",
+ "eslint-config-uber-jsx": "^3.0.0",
+ "eslint-plugin-babel": "^4.1.2",
+ "eslint-plugin-prettier": "^2.2.0",
+ "eslint-plugin-react": "~6.7.0",
+ "jsdom": "^11.1.0",
+ "json-loader": "^0.5.4",
+ "nyc": "^11.4.1",
+ "prettier": "^1.7.0",
+ "progress-bar-webpack-plugin": "^1.9.3",
+ "react": "^15.3.1",
+ "react-addons-test-utils": "^15.6.2",
+ "react-dom": "^15.6.1",
+ "react-hot-loader": "^3.0.0-beta.6",
+ "redux-mock-store": "^1.2.1",
+ "sinon": "^2.4.1",
+ "source-map-loader": "^0.2.1",
+ "tap-spec": "^4.1.1",
+ "tape": "4.8.0",
+ "tape-catch": "^1.0.6",
+ "url-loader": "^0.5.7",
+ "watchify": "^3.6.1",
+ "webpack": "^2.6.1",
+ "webpack-dev-middleware": "^1.9.0",
+ "webpack-hot-middleware": "^2.15.0",
+ "webpack-stats-plugin": "^0.1.4"
},
"peerDependencies": {
"react": "0.14.x - 16.x",
"react-dom": "0.14.x - 16.x"
- }
+ },
+ "nyc": {
+ "sourceMap": false,
+ "instrument": false,
+ "exclude": [
+ "test/**/*.js"
+ ]
+ },
+ "maintainers": [
+ "Shan He [email protected]>",
+ "Giuseppe Macri [email protected]"
+ ]
}
diff --git a/processors.js b/processors.js
new file mode 100644
index 000000000..127b2354c
--- /dev/null
+++ b/processors.js
@@ -0,0 +1,21 @@
+// Copyright (c) 2018 Uber Technologies, Inc.
+//
+// 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.
+
+module.exports = require('./dist/processors');
diff --git a/reducers.js b/reducers.js
new file mode 100644
index 000000000..47f08b140
--- /dev/null
+++ b/reducers.js
@@ -0,0 +1,21 @@
+// Copyright (c) 2018 Uber Technologies, Inc.
+//
+// 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.
+
+module.exports = require('./dist/reducers');
diff --git a/schemas.js b/schemas.js
new file mode 100644
index 000000000..53082d2f7
--- /dev/null
+++ b/schemas.js
@@ -0,0 +1,21 @@
+// Copyright (c) 2018 Uber Technologies, Inc.
+//
+// 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.
+
+module.exports = require('./dist/schemas');
\ No newline at end of file
diff --git a/styles.js b/styles.js
new file mode 100644
index 000000000..c004a444c
--- /dev/null
+++ b/styles.js
@@ -0,0 +1,21 @@
+// Copyright (c) 2018 Uber Technologies, Inc.
+//
+// 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.
+
+module.exports = require('./dist/styles/base');
diff --git a/webpack.config.js b/webpack.config.js
new file mode 100644
index 000000000..745bf79f8
--- /dev/null
+++ b/webpack.config.js
@@ -0,0 +1,129 @@
+// Copyright (c) 2018 Uber Technologies, Inc.
+//
+// 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.
+
+const resolve = require('path').resolve;
+const webpack = require('webpack');
+
+const SRC_DIR = resolve('./src');
+const LIBRARY_BUNDLE_CONFIG = env => ({
+ // Bundle the source code
+ entry: {
+ lib: SRC_DIR + '/index.js'
+ },
+
+ // Silence warnings about big bundles
+ stats: {
+ warnings: false
+ },
+
+ output: {
+ // Generate the bundle in dist folder
+ path: resolve('./dist'),
+ filename: 'index.js',
+ library: 'kepler.gl'
+ // libraryTarget: 'umd'
+ },
+
+ // Exclude any non-relative imports from resulting bundle
+ externals: [
+ /^[a-z\.\-0-9]+$/
+ ],
+
+ module: {
+ rules: [{
+ test: /\.js$/,
+ loader: 'babel-loader',
+ include: [SRC_DIR]
+ }, {
+ test: /\.json$/,
+ loader: 'json-loader'
+ }, {
+ test: /\.scss$/,
+ use: ['style-loader', 'css-loader', 'sass-loader'],
+ include: [SRC_DIR]
+ }]
+ },
+
+ node: {
+ fs: 'empty'
+ },
+
+ plugins: [
+ // leave minification to app
+ // new webpack.optimize.UglifyJsPlugin({comments: false}),
+ new webpack.DefinePlugin({
+ 'process.env': {
+ NODE_ENV: JSON.stringify(env),
+ BROWSER: JSON.stringify(true),
+ }
+ })
+ ]
+});
+
+const TEST_BROWSER_CONFIG = {
+ devServer: {
+ stats: {
+ warnings: false
+ },
+ quiet: true
+ },
+
+ // Bundle the tests for running in the browser
+ entry: {
+ 'test-browser': resolve('./test/browser.js')
+ },
+
+ // Generate a bundle in dist folder
+ output: {
+ path: resolve('./dist'),
+ filename: '[name]-bundle.js'
+ },
+
+ devtool: '#inline-source-maps',
+
+ resolve: {
+ alias: {
+ 'kepler.gl/test': resolve('./test'),
+ 'kepler.gl': resolve('./src')
+ }
+ },
+
+ module: {
+ rules: []
+ },
+
+ node: {
+ fs: 'empty'
+ },
+
+ plugins: []
+};
+
+
+module.exports = env => {
+ env = env || {};
+ if (env.test) {
+ return TEST_BROWSER_CONFIG;
+ }
+
+ console.log(
+ JSON.stringify(LIBRARY_BUNDLE_CONFIG(env), null, 2));
+ return LIBRARY_BUNDLE_CONFIG(env);
+};