Skip to content

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

[Chore] Upgrade to Node 10 (#1009)

Giuseppe Macrìee9e460f6aac
diff --git a/.github/workflows/npmpublish.yml b/.github/workflows/npmpublish.yml
index 59aade454..924e3c7c5 100644
--- a/.github/workflows/npmpublish.yml
+++ b/.github/workflows/npmpublish.yml
@@ -11,7 +11,7 @@ jobs:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
- node-version: 8
+ node-version: 10
registry-url: https://registry.npmjs.org/
- run: npm install -g yarn
- run: yarn
diff --git a/.nvmrc b/.nvmrc
index df5119ec6..f9fb144f9 100644
--- a/.nvmrc
+++ b/.nvmrc
@@ -1 +1 @@
-8.7.0
+10.15.0
diff --git a/.travis.yml b/.travis.yml
index 9c61a58f1..041aacb49 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -17,9 +17,8 @@ addons:
services:
- xvfb
install:
- - yarn --ignore-engines
+ - yarn
node_js:
- - 8
- 10
before_script:
- "curl -H 'Cache-Control: no-cache' https://raw.githubusercontent.com/fossas/fossa-cli/master/install.sh | sudo bash"
diff --git a/bindings/kepler.gl-jupyter/README.md b/bindings/kepler.gl-jupyter/README.md
index 32b7a1139..f27910ca8 100644
--- a/bindings/kepler.gl-jupyter/README.md
+++ b/bindings/kepler.gl-jupyter/README.md
@@ -134,7 +134,7 @@ Python 2
```sh
$ cd bindings/kepler.gl-jupyter
$ cd js
- $ yarn --ignore-engines
+ $ yarn
```
#### 2. Load mapbox token
diff --git a/contributing/DEVELOPERS.md b/contributing/DEVELOPERS.md
index 1c018391c..458da0293 100644
--- a/contributing/DEVELOPERS.md
+++ b/contributing/DEVELOPERS.md
@@ -51,7 +51,7 @@ cd kepler.gl
git remote add upstream "[email protected]:keplergl/kepler.gl.git"
# Install JavaScript dependencies:
-yarn --ignore-engines
+yarn
# Setup mapbox access token locally
export MapboxAccessToken=<insert_your_token>
diff --git a/examples/README.md b/examples/README.md
index d9f6fdcec..df8068d03 100644
--- a/examples/README.md
+++ b/examples/README.md
@@ -5,7 +5,7 @@ A list of examples to demonstrate adding `kepler.gl` to your app. Each of the ex
To start each example, cd into the folder then run:
```
-yarn --ignore-engines && yarn start
+yarn && yarn start
```
- ### [demo-app][demo-app]
diff --git a/examples/custom-reducer/README.md b/examples/custom-reducer/README.md
index 4a68e6b91..f38d0552d 100644
--- a/examples/custom-reducer/README.md
+++ b/examples/custom-reducer/README.md
@@ -10,7 +10,7 @@ npm install
```
or
```
-yarn --ignore-engines
+yarn
```
add mapbox access token to node env
diff --git a/examples/custom-theme/README.md b/examples/custom-theme/README.md
index fa4b00563..f727d0b9a 100644
--- a/examples/custom-theme/README.md
+++ b/examples/custom-theme/README.md
@@ -13,7 +13,7 @@ npm install
or
```sh
-yarn --ignore-engines
+yarn
```
diff --git a/examples/demo-app/README.md b/examples/demo-app/README.md
index 68209b619..b97f7a5e8 100644
--- a/examples/demo-app/README.md
+++ b/examples/demo-app/README.md
@@ -11,7 +11,7 @@ npm install
or
```sh
-yarn --ignore-engines
+yarn
```
diff --git a/examples/demo-app/src/store.js b/examples/demo-app/src/store.js
index 75dfa888f..12c624b4a 100644
--- a/examples/demo-app/src/store.js
+++ b/examples/demo-app/src/store.js
@@ -53,7 +53,7 @@ if (window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) {
'@@kepler.gl/UPDATE_MAP',
'@@kepler.gl/LAYER_HOVER'
]
- })
+ });
}
*/
diff --git a/examples/node-app/README.md b/examples/node-app/README.md
index 0b29a3a6b..9edfb3e04 100644
--- a/examples/node-app/README.md
+++ b/examples/node-app/README.md
@@ -11,7 +11,7 @@ npm install
or
```sh
-yarn --ignore-engines
+yarn
```
diff --git a/examples/open-modal/README.md b/examples/open-modal/README.md
index 8e2e91e71..3ed2ecfdc 100644
--- a/examples/open-modal/README.md
+++ b/examples/open-modal/README.md
@@ -11,7 +11,7 @@ npm install
or
```sh
-yarn --ignore-engines
+yarn
```
diff --git a/examples/replace-component/README.md b/examples/replace-component/README.md
index 85595a4e9..3f899ad1b 100644
--- a/examples/replace-component/README.md
+++ b/examples/replace-component/README.md
@@ -11,7 +11,7 @@ npm install
or
```sh
-yarn --ignore-engines
+yarn
```
diff --git a/package.json b/package.json
index bec73e605..a932cb69c 100644
--- a/package.json
+++ b/package.json
@@ -6,9 +6,9 @@
"license": "MIT",
"main": "dist/index.js",
"engines": {
- "node": ">=8.15.0",
- "npm": ">=6.1.0",
- "yarn": ">=1.6.0"
+ "node": ">=10.15.0",
+ "npm": ">=6.4.0",
+ "yarn": ">=1.13.0"
},
"keywords": [
"babel",
@@ -23,8 +23,8 @@
"url": "https://github.com/keplergl/kepler.gl.git"
},
"scripts": {
- "install:example": "cd examples/demo-app && yarn --ignore-engines",
- "install:web": "yarn install:example && cd website && yarn --ignore-engines",
+ "install:example": "cd examples/demo-app && yarn",
+ "install:web": "yarn install:example && cd website && yarn",
"install-and-start": "node ./scripts/install-and-start",
"fast-test": "npm run test-node && npm run test-browser",
"test-browser": "NODE_ENV=test babel-tape-runner -r ./test/setup-browser-env.js ./test/browser.js | tap-spec",
@@ -101,6 +101,7 @@
"d3-hexbin": "^0.2.2",
"d3-request": "^1.0.6",
"d3-scale": "^1.0.6",
+ "decimal.js": "^10.2.0",
"fuzzy": "^0.1.3",
"global": "^4.3.0",
"h3-js": "^3.1.0",
diff --git a/scripts/install-and-start.js b/scripts/install-and-start.js
index 25c868d3a..e6fd898d8 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`)
- ? `yarn --ignore-engines && npm run ${script}`
+ ? `yarn && npm run ${script}`
: `npm run ${script}`;
execSync(cmd, {
diff --git a/src/utils/filter-utils.js b/src/utils/filter-utils.js
index 0cfde72bd..029340f22 100644
--- a/src/utils/filter-utils.js
+++ b/src/utils/filter-utils.js
@@ -23,6 +23,7 @@ import keyMirror from 'keymirror';
import get from 'lodash.get';
import booleanWithin from '@turf/boolean-within';
import {point as turfPoint} from '@turf/helpers';
+import {Decimal} from 'decimal.js';
import {ALL_FIELD_TYPES, FILTER_TYPES} from 'constants/default-settings';
import {maybeToDate, notNullorUndefined, unique, timeToUnixMilli} from './data-utils';
import * as ScaleUtils from './data-scale-utils';
@@ -697,10 +698,18 @@ export function getNumericStepSize(diff) {
// Try to get at least 1000 steps - and keep the step size below that of
// the (diff > 1) case.
const x = diff / 1000;
- // Find the exponent and truncate to 10 to the power of that exponent.
+ // Find the exponent and truncate to 10 to the power of that exponent
+
const exponentialForm = x.toExponential();
const exponent = parseFloat(exponentialForm.split('e')[1]);
- return Math.pow(10, exponent);
+
+ // Getting ready for node 12
+ // this is why we need decimal.js
+ // Math.pow(10, -5) = 0.000009999999999999999
+ // the above result shows in browser and node 10
+ // node 12 behaves correctly
+
+ return new Decimal(10).pow(exponent).toNumber();
}
}
diff --git a/test/node/processors/file-handler-test.js b/test/node/processors/file-handler-test.js
new file mode 100644
index 000000000..591e44c51
--- /dev/null
+++ b/test/node/processors/file-handler-test.js
@@ -0,0 +1,58 @@
+// Copyright (c) 2020 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.
+
+import test from 'tape';
+import {getFileType, isKeplerGlMap} from 'processors/file-handler';
+
+test('#file-handler -> getFileType', t => {
+ t.equal(getFileType('filename.csv'), 'csv');
+
+ t.equal(getFileType('filename.json'), 'json');
+
+ t.equal(getFileType('filename.json.csv'), 'csv');
+
+ t.equal(getFileType('filename.geojson'), 'json');
+
+ t.equal(getFileType('filename.excel'), 'other');
+
+ t.end();
+});
+
+test('#file-handler -> isKeplerGlMap', t => {
+ t.equal(
+ isKeplerGlMap('{datasets: [], info: {app: "kepler.gl"}, config: {}}'),
+ false,
+ 'Should return false when passing a json string'
+ );
+
+ t.equal(
+ isKeplerGlMap({datasets: [], info: {app: 'kepler.gl'}, config: {}}),
+ true,
+ 'Should return true when object is a kepler map'
+ );
+
+ t.equal(
+ isKeplerGlMap({datasets: [], info: {app: 'kepler.gl'}}),
+ false,
+ 'Should return false when object is not a kepler map'
+ );
+
+ t.end();
+});
diff --git a/test/node/reducers/vis-state-test.js b/test/node/reducers/vis-state-test.js
index c89169468..c765f8666 100644
--- a/test/node/reducers/vis-state-test.js
+++ b/test/node/reducers/vis-state-test.js
@@ -172,7 +172,6 @@ const mockRawData = {
]
};
-// const InitialVisState = reducer(undefined, {});
test('#visStateReducer', t => {
t.deepEqual(
reducer(undefined, {}),
diff --git a/website/README.md b/website/README.md
index 75b64366a..e97af344d 100644
--- a/website/README.md
+++ b/website/README.md
@@ -2,5 +2,5 @@ This is the source code of the demo website for kepler.gl.
## Developing
- npm install // or yarn --ignore-engies
+ npm install // or yarn
export MapboxAccessToken=<insert_your_token> && npm start
diff --git a/website/package.json b/website/package.json
index 3f9b69d28..51b0fe87f 100644
--- a/website/package.json
+++ b/website/package.json
@@ -6,9 +6,9 @@
"main": "dist/index.js",
"version": "0.0.1",
"engines": {
- "node": ">=8.1.0",
- "npm": ">=6.1.0",
- "yarn": ">=1.6.0"
+ "node": ">=10.15.0",
+ "npm": ">=6.4.0",
+ "yarn": ">=1.13.0"
},
"scripts": {
"start": "webpack-dev-server --mode development --env.prod --content-base ./src/static --progress --open",
diff --git a/yarn.lock b/yarn.lock
index fff2b7974..fec24e8b8 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -4786,6 +4786,11 @@ decamelize@^1.1.0, decamelize@^1.1.1, decamelize@^1.1.2, decamelize@^1.2.0:
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=
+decimal.js@^10.2.0:
+ version "10.2.0"
+ resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-10.2.0.tgz#39466113a9e036111d02f82489b5fd6b0b5ed231"
+ integrity sha512-vDPw+rDgn3bZe1+F/pyEwb1oMG2XTlRVgAa6B4KccTEpYgF8w6eQllVbQcfIJnZyvzFtFpxnpGtx8dd7DJp/Rw==
+
decode-uri-component@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545"