Skip to content

Commit 8a21a8e

Browse files
authored
Merge pull request #85 from opentripplanner/fix-IE-compatibility
Replace hash-obj w object-hash
2 parents 77952d7 + a7d0801 commit 8a21a8e

File tree

9 files changed

+1307
-1719
lines changed

9 files changed

+1307
-1719
lines changed

Diff for: .travis.yml

+8-5
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@ notifications:
66
webhooks: https://outlook.office.com/webhook/03fa4a79-572f-4c68-b756-e4e851d0215a@9093f1a3-8771-4fb7-8596-d51eeef18cda/TravisCI/449087910d3647598cf3d7c6387fb8fc/286c079f-6085-4aa0-8f8d-e2a3e8d1f568
77
node_js:
88
- '12' # mastarm 5 requires node.js 10 or greater
9+
# Copy example config for use in build.
10+
before_script:
11+
- cp example-config.yml config.yml
12+
script:
13+
- yarn lint
14+
- yarn lint-docs
15+
- yarn cover
16+
- yarn build
917
after_success:
1018
- bash <(curl -s https://codecov.io/bash)
1119
- semantic-release
12-
script:
13-
- yarn run lint
14-
- yarn run lint-docs
15-
- yarn run cover
16-
- yarn run build
1720
branches:
1821
except:
1922
- /^v\d+\.\d+\.\d+$/

Diff for: configurations/default/settings.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
entries:
2-
- lib/index.js:dist/index.js
2+
- example.js:dist/index.js
33
- lib/index.css:dist/index.css

Diff for: example.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
// import necessary React/Redux libraries
1+
// import this polyfill in order to make webapp compatible with IE 11
2+
import 'es6-math'
3+
24
import { createHashHistory } from 'history'
35
import { connectRouter, routerMiddleware } from 'connected-react-router'
46
import React, { Component } from 'react'

Diff for: index.html

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
<!DOCTYPE html>
22
<html>
33
<head>
4+
<meta charset="utf-8">
45
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
5-
<title>OTP R.R.</title>
6-
76
<link rel="stylesheet" href="dist/index.css">
8-
<link rel="stylesheet" href="node_modules/transitive-js/lib/transitive.css">
97
<link rel="stylesheet" href="example.css">
10-
<link rel="stylesheet" href="node_modules/leaflet.polylinemeasure/Leaflet.PolylineMeasure.css" />
11-
8+
<title>OTP R.R.</title>
129
</head>
1310
<body>
1411
<div id="root"></div>
15-
<script src="/example.js"></script>
12+
<script src="dist/index.js"></script>
1613
</body>
1714
</html>

Diff for: lib/actions/api.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* globals fetch */
22
import { push, replace } from 'connected-react-router'
3-
import hashObject from 'hash-obj'
3+
import hash from 'object-hash'
44
import { createAction } from 'redux-actions'
55
import qs from 'qs'
66
import moment from 'moment'
@@ -853,7 +853,7 @@ function createQueryAction (endpoint, responseAction, errorAction, options = {})
853853
// don't make a request to a URL that has already seen the same request
854854
// within the last 10 seconds
855855
const throttleKey = options.fetchOptions
856-
? `${url}-${hashObject(options.fetchOptions)}`
856+
? `${url}-${hash(options.fetchOptions)}`
857857
: url
858858
if (throttledUrls[throttleKey] && throttledUrls[throttleKey] > now() - TEN_SECONDS) {
859859
// URL already had a request within last 10 seconds, warn and exit

Diff for: lib/index.css

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
@import url(https://unpkg.com/[email protected]/dist/leaflet.css);
44
@import url(node_modules/font-awesome/css/font-awesome.css);
55
@import url(node_modules/react-dates/lib/css/_datepicker.css);
6+
@import url(node_modules/transitive-js/lib/transitive.css);
7+
@import url(node_modules/leaflet.polylinemeasure/Leaflet.PolylineMeasure.css);
68

79
@import url(lib/components/app/app.css);
810
@import url(lib/components/map/map.css);

Diff for: lib/reducers/create-otp-reducer.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import AggregateError from 'aggregate-error'
21
import clone from 'clone'
32
import update from 'immutability-helper'
43
import isEqual from 'lodash.isequal'
@@ -76,7 +75,14 @@ function validateInitalState (initialState) {
7675
}
7776

7877
if (errors.length > 0) {
79-
throw new AggregateError(errors)
78+
throw new Error(
79+
errors.reduce(
80+
(message, error) => {
81+
return `${message}\n- ${error.message}`
82+
},
83+
'Encountered the following configuration errors:'
84+
)
85+
)
8086
}
8187
}
8288

Diff for: package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "A library for writing modern OpenTripPlanner-compatible multimodal journey planning web applications using React and Redux",
44
"main": "build/index.js",
55
"scripts": {
6-
"build": "mastarm build",
6+
"build": "mastarm build --env production",
77
"cover": "mastarm test --coverage",
88
"jest": "mastarm test",
99
"lint": "mastarm lint lib __tests__ --quiet",
@@ -30,7 +30,6 @@
3030
"@conveyal/geocoder-arcgis-geojson": "^0.0.2",
3131
"@conveyal/lonlat": "^1.1.0",
3232
"@mapbox/polyline": "^0.2.0",
33-
"aggregate-error": "^3.0.0",
3433
"bootstrap": "^3.3.7",
3534
"bowser": "^1.9.3",
3635
"clone": "^2.1.0",
@@ -41,7 +40,6 @@
4140
"d3-zoom": "^1.7.1",
4241
"deep-equal": "^1.0.1",
4342
"font-awesome": "^4.7.0",
44-
"hash-obj": "^2.0.0",
4543
"haversine": "^1.1.0",
4644
"history": "^4.7.2",
4745
"immutability-helper": "^2.1.1",
@@ -54,6 +52,7 @@
5452
"lodash.memoize": "^4.1.2",
5553
"moment": "^2.17.1",
5654
"moment-timezone": "^0.5.23",
55+
"object-hash": "^1.3.1",
5756
"object-path": "^0.11.3",
5857
"prop-types": "^15.6.0",
5958
"qs": "^6.3.0",
@@ -79,7 +78,8 @@
7978
},
8079
"devDependencies": {
8180
"documentation": "^12.0.3",
82-
"mastarm": "^5.1.0",
81+
"es6-math": "^1.0.0",
82+
"mastarm": "https://github.com/conveyal/mastarm/#8fa45b8c22594adfd2aa66d529a1b57904a8cbee",
8383
"nock": "^9.0.9",
8484
"react": "^15.4.2",
8585
"react-dom": "^15.4.2",

0 commit comments

Comments
 (0)