Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace hash-obj w object-hash #85

Merged
merged 10 commits into from
Jul 30, 2019
13 changes: 8 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@ notifications:
webhooks: https://outlook.office.com/webhook/03fa4a79-572f-4c68-b756-e4e851d0215a@9093f1a3-8771-4fb7-8596-d51eeef18cda/TravisCI/449087910d3647598cf3d7c6387fb8fc/286c079f-6085-4aa0-8f8d-e2a3e8d1f568
node_js:
- '12' # mastarm 5 requires node.js 10 or greater
# Copy example config for use in build.
before_script:
- cp example-config.yml config.yml
script:
- yarn lint
- yarn lint-docs
- yarn cover
- yarn build
after_success:
- bash <(curl -s https://codecov.io/bash)
- semantic-release
script:
- yarn run lint
- yarn run lint-docs
- yarn run cover
- yarn run build
branches:
except:
- /^v\d+\.\d+\.\d+$/
2 changes: 1 addition & 1 deletion configurations/default/settings.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
entries:
- lib/index.js:dist/index.js
- example.js:dist/index.js
- lib/index.css:dist/index.css
4 changes: 3 additions & 1 deletion example.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// import necessary React/Redux libraries
// import this polyfill in order to make webapp compatible with IE 11
import 'es6-math'

import { createHashHistory } from 'history'
import { connectRouter, routerMiddleware } from 'connected-react-router'
import React, { Component } from 'react'
Expand Down
9 changes: 3 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
<title>OTP R.R.</title>

<link rel="stylesheet" href="dist/index.css">
<link rel="stylesheet" href="node_modules/transitive-js/lib/transitive.css">
<link rel="stylesheet" href="example.css">
<link rel="stylesheet" href="node_modules/leaflet.polylinemeasure/Leaflet.PolylineMeasure.css" />

<title>OTP R.R.</title>
</head>
<body>
<div id="root"></div>
<script src="/example.js"></script>
<script src="dist/index.js"></script>
</body>
</html>
4 changes: 2 additions & 2 deletions lib/actions/api.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* globals fetch */
import { push, replace } from 'connected-react-router'
import hashObject from 'hash-obj'
import hash from 'object-hash'
import { createAction } from 'redux-actions'
import qs from 'qs'
import moment from 'moment'
Expand Down Expand Up @@ -853,7 +853,7 @@ function createQueryAction (endpoint, responseAction, errorAction, options = {})
// don't make a request to a URL that has already seen the same request
// within the last 10 seconds
const throttleKey = options.fetchOptions
? `${url}-${hashObject(options.fetchOptions)}`
? `${url}-${hash(options.fetchOptions)}`
: url
if (throttledUrls[throttleKey] && throttledUrls[throttleKey] > now() - TEN_SECONDS) {
// URL already had a request within last 10 seconds, warn and exit
Expand Down
2 changes: 2 additions & 0 deletions lib/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
@import url(https://unpkg.com/[email protected]/dist/leaflet.css);
@import url(node_modules/font-awesome/css/font-awesome.css);
@import url(node_modules/react-dates/lib/css/_datepicker.css);
@import url(node_modules/transitive-js/lib/transitive.css);
@import url(node_modules/leaflet.polylinemeasure/Leaflet.PolylineMeasure.css);

@import url(lib/components/app/app.css);
@import url(lib/components/map/map.css);
Expand Down
10 changes: 8 additions & 2 deletions lib/reducers/create-otp-reducer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import AggregateError from 'aggregate-error'
import clone from 'clone'
import update from 'immutability-helper'
import isEqual from 'lodash.isequal'
Expand Down Expand Up @@ -76,7 +75,14 @@ function validateInitalState (initialState) {
}

if (errors.length > 0) {
throw new AggregateError(errors)
throw new Error(
errors.reduce(
(message, error) => {
return `${message}\n- ${error.message}`
},
'Encountered the following configuration errors:'
)
)
}
}

Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "A library for writing modern OpenTripPlanner-compatible multimodal journey planning web applications using React and Redux",
"main": "build/index.js",
"scripts": {
"build": "mastarm build",
"build": "mastarm build --env production",
"cover": "mastarm test --coverage",
"jest": "mastarm test",
"lint": "mastarm lint lib __tests__ --quiet",
Expand All @@ -30,7 +30,6 @@
"@conveyal/geocoder-arcgis-geojson": "^0.0.2",
"@conveyal/lonlat": "^1.1.0",
"@mapbox/polyline": "^0.2.0",
"aggregate-error": "^3.0.0",
"bootstrap": "^3.3.7",
"bowser": "^1.9.3",
"clone": "^2.1.0",
Expand All @@ -41,7 +40,6 @@
"d3-zoom": "^1.7.1",
"deep-equal": "^1.0.1",
"font-awesome": "^4.7.0",
"hash-obj": "^2.0.0",
"haversine": "^1.1.0",
"history": "^4.7.2",
"immutability-helper": "^2.1.1",
Expand All @@ -54,6 +52,7 @@
"lodash.memoize": "^4.1.2",
"moment": "^2.17.1",
"moment-timezone": "^0.5.23",
"object-hash": "^1.3.1",
"object-path": "^0.11.3",
"prop-types": "^15.6.0",
"qs": "^6.3.0",
Expand All @@ -79,7 +78,8 @@
},
"devDependencies": {
"documentation": "^12.0.3",
"mastarm": "^5.1.0",
"es6-math": "^1.0.0",
"mastarm": "https://github.com/conveyal/mastarm/#8fa45b8c22594adfd2aa66d529a1b57904a8cbee",
"nock": "^9.0.9",
"react": "^15.4.2",
"react-dom": "^15.4.2",
Expand Down
Loading