Skip to content

Commit cc84437

Browse files
authored
feat(dependency): do not require peer deps (#288)
* feat(dependencies): peer to actual * fix(mui): updates require patching * test(node): unpin node version * fix(react): must be a peer dep for create-react-app
1 parent eca3250 commit cc84437

File tree

6 files changed

+4665
-5076
lines changed

6 files changed

+4665
-5076
lines changed

.circleci/config.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ jobs:
66
working_directory: ~/mson-react
77

88
docker:
9-
# TODO: restore after https://github.com/facebook/jest/issues/8069 has been resolved
10-
# - image: circleci/node:stretch-browsers
11-
- image: circleci/node:10-stretch-browsers
9+
- image: circleci/node:stretch-browsers
1210

1311
steps:
1412
- checkout

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ Implementing great forms can be a real time-waster. With just a few lines of JSO
1515

1616
### Adding MSON-React to Your Existing React Project
1717

18-
- `yarn add @date-io/date-fns @material-ui/core date-fns @material-ui/pickers mson mson-react typeface-roboto`
19-
- Note: this is needed as MSON and MSON-React are libraries that work in conjunction with React, Material UI and Date-IO. As such, these dependencies are peer dependencies.
18+
- `yarn add mson-react` or `npm install mson-react`
2019
- Add the following to the head section of your index.html:
2120
```html
2221
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

package.json

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,16 @@
77
"main": "lib/bundle.js",
88
"homepage": "https://redgeoff.github.io/mson-react",
99
"peerDependencies": {
10-
"@date-io/date-fns": "^1.3.13",
11-
"@material-ui/core": "^4.11.0",
12-
"@material-ui/pickers": "^3.2.10",
13-
"date-fns": "^2.15.0",
14-
"mson": "^2.9.0",
15-
"prop-types": "^15.6.2",
16-
"react": "^16.13.1",
17-
"react-dom": "^16.13.1"
10+
"react": ">= 16"
1811
},
1912
"dependencies": {
13+
"@date-io/date-fns": "^1.3.13",
14+
"@material-ui/core": "^4.11.0",
2015
"@material-ui/pickers": "^3.2.10",
2116
"classnames": "^2.2.6",
17+
"date-fns": "^2.15.0",
2218
"lodash": "^4.17.20",
19+
"mson": "^2.9.0",
2320
"react-beautiful-dnd": "^13.0.0",
2421
"react-google-recaptcha": "^2.1.0",
2522
"react-markdown": "^5.0.3",
@@ -35,8 +32,6 @@
3532
"@babel/plugin-transform-runtime": "^7.12.10",
3633
"@babel/preset-env": "^7.12.11",
3734
"@babel/preset-react": "^7.12.10",
38-
"@date-io/date-fns": "^1.3.13",
39-
"@material-ui/core": "^4.11.2",
4035
"@testing-library/jest-dom": "^5.11.6",
4136
"@testing-library/react": "^11.2.2",
4237
"babel-loader": "8.1.0",
@@ -46,16 +41,14 @@
4641
"css-loader": "^5.0.1",
4742
"css-mediaquery": "^0.1.2",
4843
"cz-conventional-changelog": "^3.3.0",
49-
"date-fns": "^2.16.1",
5044
"gh-pages": "^3.1.0",
5145
"jest-environment-jsdom-fourteen": "^1.0.1",
5246
"lint-staged": "^10.5.3",
53-
"mson": "^2.9.0",
5447
"prettier": "^2.2.1",
5548
"prop-types": "^15.6.2",
5649
"react": "^17.0.1",
57-
"react-beautiful-dnd-test-utils": "^3.2.1",
5850
"react-dom": "^17.0.1",
51+
"react-beautiful-dnd-test-utils": "^3.2.1",
5952
"react-scripts": "^4.0.1",
6053
"semantic-release": "^17.3.0",
6154
"style-loader": "^2.0.0",

src/app-container.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ import React from 'react';
22
import AppUI from './app';
33
import CssBaseline from '@material-ui/core/CssBaseline';
44
import { ThemeProvider as MuiThemeProvider } from '@material-ui/core/styles';
5-
import createMuiTheme from '@material-ui/core/styles/createMuiTheme';
5+
import { createTheme } from '@material-ui/core/styles';
66
import blueGrey from '@material-ui/core/colors/blueGrey';
77
import lightBlue from '@material-ui/core/colors/lightBlue';
88
import { BrowserRouter, Prompt } from 'react-router-dom';
99
import globals from 'mson/lib/globals';
1010
import attach from './attach';
1111

12-
const theme = createMuiTheme({
12+
const theme = createTheme({
1313
palette: {
1414
primary: blueGrey,
1515
// primary: blue,

src/fields/url-field.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,8 @@ import attach from '../attach';
44

55
class URLField extends React.PureComponent {
66
render() {
7-
const {
8-
component,
9-
value,
10-
editable,
11-
useDisplayValue,
12-
newWindow,
13-
} = this.props;
7+
const { component, value, editable, useDisplayValue, newWindow } =
8+
this.props;
149

1510
let displayValue = null;
1611

@@ -20,8 +15,11 @@ class URLField extends React.PureComponent {
2015
if (href.indexOf('http') !== 0) {
2116
href = 'http://' + href;
2217
}
18+
19+
// Using target=_blank without rel=noreferrer is a security risk:
20+
// https://html.spec.whatwg.org/multipage/links.html#link-type-noopener
2321
displayValue = (
24-
<a href={href} target={newWindow ? '_blank' : '_self'}>
22+
<a href={href} rel="noreferrer" target={newWindow ? '_blank' : '_self'}>
2523
{value}
2624
</a>
2725
);

0 commit comments

Comments
 (0)