Skip to content

Commit 648ee2f

Browse files
Fix audit failures (#388)
* differentiate between dependencies used by the web app and those used in development * only run audit against web app deps * fix issues with medium (or greater) severity Signed-off-by: James Phillips <jamesdphillips@gmail.com>
1 parent 1446f63 commit 648ee2f

File tree

7 files changed

+1624
-226
lines changed

7 files changed

+1624
-226
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ executors:
88
build_env:
99
resource_class: medium
1010
docker:
11-
- image: circleci/node:lts
11+
- image: cimg/node:14.18
1212

1313
commands:
1414
install_deps:

config/jest/cssTransform.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
// This is a custom Jest transformer turning style imports into empty objects.
22
// http://facebook.github.io/jest/docs/tutorial-webpack.html
33

4-
export function process() {
5-
return "module.exports = {};";
6-
}
7-
export function getCacheKey() {
8-
// The output is always the same.
9-
return "cssTransform";
10-
}
4+
module.exports = {
5+
process() {
6+
return "module.exports = {};";
7+
},
8+
getCacheKey() {
9+
// The output is always the same.
10+
return "cssTransform";
11+
},
12+
};

config/jest/fileTransform.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
import path from "path";
1+
const path = require("path");
22

33
// This is a custom Jest transformer turning file imports into filenames.
44
// http://facebook.github.io/jest/docs/tutorial-webpack.html
55

6-
export function process(src, filename) {
7-
return `module.exports = ${JSON.stringify(path.basename(filename))};`;
8-
}
6+
module.exports = {
7+
process(src, filename) {
8+
return `module.exports = ${JSON.stringify(path.basename(filename))};`;
9+
},
10+
};

package.json

Lines changed: 60 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"tsconfig.json"
1414
],
1515
"engines": {
16-
"node": ">= 8",
16+
"node": ">=14 <16",
1717
"npm": ">= 5.2.0",
1818
"yarn": "^1.13.0"
1919
},
@@ -45,18 +45,70 @@
4545
"dependencies": {
4646
"@10xjs/date-input-controller": "0.1.6",
4747
"@10xjs/form": "^0.1.7",
48+
"@material-ui/core": "^4.9.4",
49+
"@material-ui/icons": "^4.9.1",
50+
"@material-ui/styles": "^4.9.0",
51+
"@material-ui/system": "^4.9.3",
52+
"@material-ui/utils": "^4.7.1",
53+
"@vx/axis": "^0.0.190",
54+
"apollo-cache": "^1.3.0",
55+
"apollo-cache-inmemory": "^1.5.1",
56+
"apollo-client": "^2.6.2",
57+
"apollo-link": "^1.2.11",
58+
"apollo-link-batch-http": "^1.2.11",
59+
"apollo-link-context": "^1.0.18",
60+
"autosuggest-highlight": "^3.1.1",
61+
"bluebird": "^3.5.1",
62+
"bugnet": "^0.1.1",
63+
"classnames": "^2.2.5",
64+
"connect-history-api-fallback": "^1.6.0",
65+
"core-js": "^2.5.6",
66+
"cronstrue": "^1.31.0",
67+
"d3-scale": "^3.0.0",
68+
"debounce": "^1.2.0",
69+
"deepmerge": "^3.2.0",
70+
"error-stack-parser": "^2.0.2",
71+
"es6-error": "^4.1.1",
72+
"express": "^4.16.4",
73+
"fbjs": "^1.0.0",
74+
"fuse.js": "^3.4.5",
75+
"git-rev-sync": "^1.12.0",
76+
"graphql": "^14.4.2",
77+
"graphql-tag": "^2.9.2",
78+
"highlight.js": "^10.4.1",
79+
"hoist-non-react-statics": "^2.5.0",
80+
"intl": "^1.2.5",
81+
"intl-relativeformat": "^2.1.0",
82+
"lodash": "^4.17.21",
83+
"material-ui-chip-input": "^1.0.0",
84+
"mousetrap": "^1.6.3",
85+
"prop-types": "^15.6.0",
86+
"react": "^16.8.6",
87+
"react-apollo": "^2.5.6",
88+
"react-autosuggest": "^10.1.0",
89+
"react-dom": "^16.8.6",
90+
"react-event-listener": "^0.6.3",
91+
"react-media": "^1.8.0",
92+
"react-resize-observer": "^1.1.1",
93+
"react-router": "^5.1.2",
94+
"react-router-dom": "^5.1.2",
95+
"react-spring": "^8.0.27",
96+
"regenerator-runtime": "^0.11.1",
97+
"seed-random": "^2.2.0",
98+
"ts-md5": "^1.2.4",
99+
"typeface-roboto": "^0.0.54",
100+
"url-search-params-polyfill": "^2.0.3",
101+
"warning": "^3.0.0",
102+
"whatwg-fetch": "^2.0.4"
103+
},
104+
"devDependencies": {
48105
"@babel/core": "^7.0.0",
49106
"@babel/plugin-proposal-class-properties": "^7.0.0",
50107
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
51108
"@babel/preset-env": "^7.0.0",
52109
"@babel/preset-flow": "^7.0.0",
53110
"@babel/preset-react": "^7.0.0",
54111
"@babel/preset-typescript": "^7.3.3",
55-
"@material-ui/core": "^4.9.4",
56-
"@material-ui/icons": "^4.9.1",
57-
"@material-ui/styles": "^4.9.0",
58-
"@material-ui/system": "^4.9.3",
59-
"@material-ui/utils": "^4.7.1",
60112
"@octokit/plugin-throttling": "^2.4.0",
61113
"@octokit/rest": "^16.23.2",
62114
"@sensuapp/eslint-plugin": "^1.0.0",
@@ -70,6 +122,7 @@
70122
"@storybook/core-events": "^5.3.21",
71123
"@storybook/react": "^5.3.21",
72124
"@storybook/theming": "^5.3.21",
125+
"@testing-library/jest-dom": "^5.15.0",
73126
"@testing-library/react": "^8.0.1",
74127
"@types/autosuggest-highlight": "^3.1.1",
75128
"@types/classnames": "^2.2.7",
@@ -85,39 +138,20 @@
85138
"@types/react-router-dom": "^5.1.3",
86139
"@typescript-eslint/eslint-plugin": "^1.9.0",
87140
"@typescript-eslint/parser": "^1.9.0",
88-
"@vx/axis": "^0.0.190",
89141
"add-asset-html-webpack-plugin": "^3.1.3",
90-
"apollo-cache": "^1.3.0",
91-
"apollo-cache-inmemory": "^1.5.1",
92-
"apollo-client": "^2.6.2",
93-
"apollo-link": "^1.2.11",
94-
"apollo-link-batch-http": "^1.2.11",
95-
"apollo-link-context": "^1.0.18",
96142
"autoprefixer": "^7.1.2",
97-
"autosuggest-highlight": "^3.1.1",
98143
"aws-sdk": "^2.437.0",
99144
"babel-eslint": "^10.0.1",
100145
"babel-jest": "^24.8.0",
101146
"babel-loader": "^8.0.0",
102147
"babel-plugin-module-resolver": "^3.1.1",
103148
"babel-plugin-transform-react-remove-prop-types": "^0.4.13",
104-
"bluebird": "^3.5.1",
105-
"bugnet": "^0.1.1",
106149
"case-sensitive-paths-webpack-plugin": "^2.1.2",
107150
"chalk": "^2.4.2",
108151
"circular-dependency-plugin": "^5.0.2",
109-
"classnames": "^2.2.5",
110152
"clean-webpack-plugin": "^0.1.19",
111153
"compression": "^1.7.4",
112-
"connect-history-api-fallback": "^1.6.0",
113-
"core-js": "^2.5.6",
114-
"cronstrue": "^1.31.0",
115154
"css-loader": "^2.0.0",
116-
"d3-scale": "^3.0.0",
117-
"debounce": "^1.2.0",
118-
"deepmerge": "^3.2.0",
119-
"error-stack-parser": "^2.0.2",
120-
"es6-error": "^4.1.1",
121155
"eslint": "^5.5.0",
122156
"eslint-config-prettier": "^4.1.0",
123157
"eslint-import-resolver-babel-module": "^5.1.0",
@@ -129,65 +163,34 @@
129163
"eslint-plugin-react": "^7.12.0",
130164
"eslint-plugin-react-hooks": "^1.6.0",
131165
"esm": "^3.2.16",
132-
"express": "^4.16.4",
133-
"fbjs": "^1.0.0",
134166
"file-loader": "^3.0.1",
135167
"flow-bin": "^0.84.0",
136-
"fuse.js": "^3.4.5",
137-
"git-rev-sync": "^1.12.0",
138168
"glob": "^7.1.2",
139169
"glob-to-regexp": "^0.4.1",
140-
"graphql": "^14.4.2",
141-
"graphql-tag": "^2.9.2",
142-
"highlight.js": "^10.4.1",
143-
"hoist-non-react-statics": "^2.5.0",
144170
"html-loader": "^0.5.5",
145171
"html-webpack-plugin": "^3.2.0",
146172
"http-proxy-middleware": "^1.0.5",
147-
"intl": "^1.2.5",
148-
"intl-relativeformat": "^2.1.0",
173+
"jest": "24",
149174
"jest-circus": "^24.8.0",
150175
"jest-dom": "^3.4.0",
151176
"jest-junit": "^6.4.0",
152177
"killable": "^1.0.0",
153178
"loader-utils": "^1.2.3",
154-
"lodash": "^4.17.21",
155-
"material-ui-chip-input": "^1.0.0",
156179
"mngen": "^1.1.0",
157180
"modernizr": "^3.6.0",
158-
"mousetrap": "^1.6.3",
159181
"prettier": "^1.16.4",
160-
"prop-types": "^15.6.0",
161182
"raw-loader": "^0.5.1",
162-
"react": "^16.8.6",
163-
"react-apollo": "^2.5.6",
164-
"react-autosuggest": "^10.1.0",
165-
"react-dom": "^16.8.6",
166-
"react-event-listener": "^0.6.3",
167-
"react-media": "^1.8.0",
168-
"react-resize-observer": "^1.1.1",
169-
"react-router": "^5.1.2",
170-
"react-router-dom": "^5.1.2",
171-
"react-spring": "^8.0.27",
172-
"regenerator-runtime": "^0.11.1",
173-
"seed-random": "^2.2.0",
174183
"semver": "^5.6.0",
175184
"style-loader": "^0.23.1",
176185
"terser-webpack-plugin": "^2.0.0",
177186
"ts-jest": "^24.0.2",
178-
"ts-md5": "^1.2.4",
179-
"typeface-roboto": "^0.0.54",
180187
"typescript": "^3.9.7",
181-
"uglifyjs-webpack-plugin": "^1.2.5",
182188
"url-loader": "^1.0.1",
183-
"url-search-params-polyfill": "^2.0.3",
184189
"value-loader": "^0.1.4",
185-
"warning": "^3.0.0",
186190
"webpack": "^4.43.0",
187191
"webpack-cli": "^3.2.3",
188192
"webpack-dev-middleware": "^4.0.0-rc.1",
189193
"webpack-stats-plugin": "^0.2.1",
190-
"whatwg-fetch": "^2.0.4",
191194
"worker-loader": "^2.0.0"
192195
},
193196
"jest": {

scripts/audit-deps.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const acceptable = ["info", "low"];
77
// Run report
88
let report;
99
try {
10-
report = execSync("yarn audit --json", { encoding: "utf-8" });
10+
report = execSync("yarn audit --groups dependencies --json", { encoding: "utf-8" });
1111
} catch (e) {
1212
report = e.stdout;
1313
}

src/lib/component/base/RelativeDate/RelativeDate.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from "/vendor/react";
22
import IntlRelativeFormat from "intl-relativeformat";
33
import { render } from "@testing-library/react";
4+
import '@testing-library/jest-dom'
45

56
import RelativeDate from "./RelativeDate";
67

0 commit comments

Comments
 (0)