Skip to content

Commit 6a6f811

Browse files
authored
Chore: Misc bug bix travis node upgrade (#305)
* Add logError utility * Improve development logging for isNodeVisible in collapse.helper * Update node versions in .travis.yml * Update CHANGELOG.md with some ecosystem update * Update missing docs on renderLabel * Delete yarn.lock * Update misc dependencies patch, minors. Fix security vulnerability * Set link.highlightColor default as 'SAME' * Generate anchor links for each react-d3-graph documented configuration property * Move analytics to separate JS file to toggle off in development mode
1 parent 2063352 commit 6a6f811

15 files changed

+2291
-13376
lines changed

.eslintrc.js

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ module.exports = {
99
Reflect: true,
1010
window: true,
1111
__dirname: true,
12+
process: true,
1213
},
1314
parser: "babel-eslint",
1415
parserOptions: {

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,4 @@ gen-docs
7171
.DS_Store
7272
cypress/videos/
7373
cypress/screenshots/
74+
yarn.lock # prevent yarn.lock to be pushed, please use npm instead

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ addons:
44
packages:
55
- libgconf-2-4
66
node_js:
7-
- "8.9.0"
87
- "10.14.0"
8+
- "12.13.0"
99
install:
1010
- npm install
1111
before_script:

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Change Log
22

3+
## Next up
4+
5+
- https://github.com/DefinitelyTyped/DefinitelyTyped/pull/42240
6+
thanks to @\hrngoode `react-d3-graph` is not on [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped)
7+
38
## [2.3.0](https://github.com/danielcaldas/react-d3-graph/tree/2.3.0)
49

510
[Full Changelog](https://github.com/danielcaldas/react-d3-graph/compare/2.2.0...2.3.0)

package-lock.json

+2,115-1,939
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"babel-loader": "8.0.6",
5151
"cross-env": "5.2.1",
5252
"css-loader": "2.0.2",
53-
"cypress": "3.4.1",
53+
"cypress": "3.8.3",
5454
"d3": "^5.5.0",
5555
"documentation": "12.1.2",
5656
"eslint": "6.3.0",
@@ -63,24 +63,24 @@
6363
"eslint-plugin-react": "7.14.3",
6464
"eslint-plugin-standard": "4.0.1",
6565
"html-webpack-plugin": "2.30.1",
66-
"http-server": "0.11.1",
66+
"http-server": "^0.12.1",
6767
"husky": "3.0.5",
6868
"jest": "24.9.0",
6969
"jsdoc": "^3.6.3",
7070
"lint-staged": "9.2.5",
7171
"npm-run-all": "4.1.5",
72-
"prettier": "1.18.2",
72+
"prettier": "1.19.1",
7373
"query-string": "6.8.3",
7474
"react": "^16.4.1",
7575
"react-addons-test-utils": "15.6.2",
7676
"react-dom": "^16.4.2",
7777
"react-editable-json-tree": "2.2.1",
7878
"react-jsonschema-form": "1.0.4",
7979
"react-test-renderer": "16.9.0",
80-
"react-toastify": "5.4.0",
80+
"react-toastify": "5.5.0",
8181
"style-loader": "0.18.2",
82-
"typescript": "3.6.2",
83-
"webpack": "4.28.1",
82+
"typescript": "3.8.3",
83+
"webpack": "4.41.6",
8484
"webpack-bundle-analyzer": "^3.0.3",
8585
"webpack-cli": "3.3.8",
8686
"webpack-dev-server": "^3.1.14",

sandbox/Sandbox.jsx

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { JsonTree } from "react-editable-json-tree";
44
import Form from "react-jsonschema-form";
55
import ReactTooltip from "react-tooltip";
66
import { toast } from "react-toastify";
7+
import "./analytics";
78
import defaultConfig from "../src/components/graph/graph.config";
89
import { Graph } from "../src";
910
import { generateFormSchema, loadDataset, setValue, tooltipReducer } from "./utils";

sandbox/analytics.js

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
if (process.env.NODE_ENV !== "development") {
2+
(function(i, s, o, g, r, a, m) {
3+
i["GoogleAnalyticsObject"] = r;
4+
(i[r] =
5+
i[r] ||
6+
function() {
7+
(i[r].q = i[r].q || []).push(arguments);
8+
}),
9+
(i[r].l = 1 * new Date());
10+
(a = s.createElement(o)), (m = s.getElementsByTagName(o)[0]);
11+
a.async = 1;
12+
a.src = g;
13+
m.parentNode.insertBefore(a, m);
14+
})(window, document, "script", "https://www.google-analytics.com/analytics.js", "ga");
15+
try {
16+
// eslint-disable-next-line no-undef
17+
ga("create", "UA-121685077-2", "auto");
18+
// eslint-disable-next-line no-undef
19+
ga("send", "pageview");
20+
} catch (error) {
21+
if (process.env.NODE_ENV === "development") {
22+
console.error("react-d3-graph :: ", error);
23+
}
24+
}
25+
}

sandbox/index.html

-10
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,6 @@
55
<title>react-d3-graph</title>
66
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
77
<link rel="shortcut icon" href="https://danielcaldas.github.io/react-d3-graph/sandbox/favicon.ico">
8-
<script>
9-
(function (i, s, o, g, r, a, m) {
10-
i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
11-
(i[r].q = i[r].q || []).push(arguments)
12-
}, i[r].l = 1 * new Date(); a = s.createElement(o),
13-
m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m)
14-
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
15-
ga('create', 'UA-121685077-2', 'auto');
16-
ga('send', 'pageview');
17-
</script>
188
</head>
199
<body>
2010
<div id="app"></div>

src/components/graph/collapse.helper.js

+13
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* the links matrix.
77
*/
88
import { getId } from "./graph.helper";
9+
import { logError } from "../../utils";
910

1011
/**
1112
* For directed graphs.
@@ -125,6 +126,18 @@ function getTargetLeafConnections(rootNodeId, linksMatrix = {}, { directed }) {
125126
* @memberof Graph/collapse-helper
126127
*/
127128
function isNodeVisible(nodeId, nodes, linksMatrix) {
129+
const node = nodes[nodeId];
130+
131+
if (!node) {
132+
if (process.env.NODE_ENV === "development") {
133+
logError(
134+
"graph/collapse.helper",
135+
`Trying to check if node ${nodeId} is visible but its not present in nodes: `,
136+
nodes
137+
);
138+
}
139+
return false;
140+
}
128141
if (nodes[nodeId]._orphan) {
129142
return true;
130143
}

0 commit comments

Comments
 (0)