Skip to content

Commit

Permalink
fix: switch to react-helmet-async
Browse files Browse the repository at this point in the history
  • Loading branch information
ZauberNerd committed Oct 25, 2019
1 parent dd0ccf2 commit f1c61d1
Show file tree
Hide file tree
Showing 19 changed files with 68 additions and 43 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ Now you can `import`/`require` your web app manifest and render a `<link />` tag
```javascript
import { render } from 'hops';
import React from 'react';
import Helmet from 'react-helmet';
import { Helmet } from 'react-helmet-async';
import manifest from './manifest.webmanifest';

export default render(
Expand Down
4 changes: 2 additions & 2 deletions packages/graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@
"react": "^16.8.0",
"react-apollo": "^3.1.0",
"react-dom": "^16.8.0",
"react-helmet": "^5.2.0",
"react-helmet-async": "^1.0.4",
"react-router-dom": "^5.1.0"
},
"devDependencies": {
"graphql-tag": "^2.10.1",
"react": "^16.10.2",
"react-apollo": "^3.1.2",
"react-dom": "^16.10.2",
"react-helmet": "^5.2.1",
"react-helmet-async": "^1.0.4",
"react-router-dom": "^5.1.2"
},
"homepage": "https://github.com/xing/hops/tree/master/packages/graphql#readme"
Expand Down
4 changes: 2 additions & 2 deletions packages/hops/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@
"peerDependencies": {
"react": "^16.8.0",
"react-dom": "^16.8.0",
"react-helmet": "^5.2.0",
"react-helmet-async": "^1.0.4",
"react-router-dom": "^5.1.0"
},
"devDependencies": {
"@types/react": "*",
"@types/react-router-dom": "*",
"react": "^16.10.2",
"react-dom": "^16.10.2",
"react-helmet": "^5.2.1",
"react-helmet-async": "^1.0.4",
"react-router-dom": "^5.1.2"
}
}
4 changes: 2 additions & 2 deletions packages/jest-preset/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@
"jest": "^24.9.0",
"react": "^16.8.0",
"react-dom": "^16.8.0",
"react-helmet": "^5.2.0",
"react-helmet-async": "^1.0.4",
"react-router-dom": "^5.1.0"
},
"devDependencies": {
"jest": "^24.9.0",
"react": "^16.10.2",
"react-dom": "^16.10.2",
"react-helmet": "^5.2.1",
"react-helmet-async": "^1.0.4",
"react-router-dom": "^5.1.2"
},
"homepage": "https://github.com/xing/hops/tree/master/packages/jest-preset#readme"
Expand Down
2 changes: 1 addition & 1 deletion packages/pwa/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ If you don't already have an existing Hops project read this section [on how to

#### Web App Manifest

When you `import` / `require` a web app manifest in your application code you will get an URL to the web app manifet which you can, for example, render in a `<link />` element via [Helmet](https://github.com/nfl/react-helmet).
When you `import` / `require` a web app manifest in your application code you will get an URL to the web app manifet which you can, for example, render in a `<link />` element via [React Helmet Async](https://github.com/staylor/react-helmet-async).

```javascript
import manifest from './manifest.webmanifest';
Expand Down
6 changes: 3 additions & 3 deletions packages/react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

**Please see the [main Hops Readme](https://github.com/xing/hops/blob/master/README.md) for general information and a Getting Started Guide.**

This is a [preset for Hops](https://github.com/xing/hops/tree/master#presets) that enables React, JSX, React-Helmet and React-Router support in Hops applications.
This is a [preset for Hops](https://github.com/xing/hops/tree/master#presets) that enables React, JSX, React-Helmet Async and React-Router support in Hops applications.

### Installation

Add this preset and its peer dependencies `react`, `react-dom`, `react-helmet` and `react-router-dom` to your existing Hops React project:
Add this preset and its peer dependencies `react`, `react-dom`, `react-helmet-async` and `react-router-dom` to your existing Hops React project:

```bash
npm install --save hops-react react react-dom react-helmet react-router-dom
npm install --save hops-react react react-dom react-helmet-async react-router-dom
```

If you don't already have an existing Hops project read this section [on how to set up your first Hops project.](https://github.com/xing/hops/tree/master#quick-start)
Expand Down
4 changes: 2 additions & 2 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
"peerDependencies": {
"react": "^16.8.0",
"react-dom": "^16.8.0",
"react-helmet": "^5.2.0",
"react-helmet-async": "^1.0.4",
"react-router-dom": "^5.1.0"
},
"devDependencies": {
"react": "^16.10.2",
"react-dom": "^16.10.2",
"react-helmet": "^5.2.1",
"react-helmet-async": "^1.0.4",
"react-router-dom": "^5.1.2"
},
"homepage": "https://github.com/xing/hops/tree/master/packages/react#readme"
Expand Down
2 changes: 1 addition & 1 deletion packages/spec/integration/lambda/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"hops-lambda": "*",
"react": "*",
"react-dom": "*",
"react-helmet": "*",
"react-helmet-async": "*",
"react-router-dom": "*"
}
}
2 changes: 1 addition & 1 deletion packages/spec/integration/pwa/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import installServiceWorker from 'hops-pwa';
import { render } from 'hops';
import React from 'react';
import Helmet from 'react-helmet';
import { Helmet } from 'react-helmet-async';

import manifest from './manifest.webmanifest';

Expand Down
2 changes: 1 addition & 1 deletion packages/template-graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"react": "^16.10.2",
"react-apollo": "^3.1.2",
"react-dom": "^16.10.2",
"react-helmet": "^5.2.1",
"react-helmet-async": "^1.0.4",
"react-router-dom": "^5.1.2"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/template-graphql/src/home/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { graphql } from 'react-apollo';
import Helmet from 'react-helmet';
import { Helmet } from 'react-helmet-async';
import query from './commits.gql';
import styles from './styles.css';

Expand Down
17 changes: 15 additions & 2 deletions packages/template-graphql/src/home/spec/index.spec.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
import React from 'react';
import renderer from 'react-test-renderer';
import { HelmetProvider } from 'react-helmet-async';
import { Home } from '../';

HelmetProvider.canUseDOM = false;

it('renders loading state correctly', () => {
const tree = renderer.create(<Home data={{ loading: true }} />).toJSON();
const tree = renderer
.create(
<HelmetProvider>
<Home data={{ loading: true }} />
</HelmetProvider>
)
.toJSON();
expect(tree).toMatchSnapshot();
});

Expand Down Expand Up @@ -35,6 +44,10 @@ it('renders loaded state correctly', () => {
},
},
};
const tree = renderer.create(<Home data={data} />);
const tree = renderer.create(
<HelmetProvider>
<Home data={data} />
</HelmetProvider>
);
expect(tree).toMatchSnapshot();
});
2 changes: 1 addition & 1 deletion packages/template-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"prop-types": "^15.7.2",
"react": "^16.10.2",
"react-dom": "^16.10.2",
"react-helmet": "^5.2.1",
"react-helmet-async": "^1.0.4",
"react-router-dom": "^5.1.2"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/template-react/src/home/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import Helmet from 'react-helmet';
import { Helmet } from 'react-helmet-async';
import styles from './styles.css';

export default function Home() {
Expand Down
11 changes: 10 additions & 1 deletion packages/template-react/src/home/spec/index.spec.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
import React from 'react';
import renderer from 'react-test-renderer';
import { HelmetProvider } from 'react-helmet-async';
import Home from '../';

HelmetProvider.canUseDOM = false;

it('renders correctly', () => {
const tree = renderer.create(<Home />).toJSON();
const tree = renderer
.create(
<HelmetProvider>
<Home />
</HelmetProvider>
)
.toJSON();
expect(tree).toMatchSnapshot();
});
2 changes: 1 addition & 1 deletion packages/template-redux/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"prop-types": "^15.7.2",
"react": "^16.10.2",
"react-dom": "^16.10.2",
"react-helmet": "^5.2.1",
"react-helmet-async": "^1.0.4",
"react-redux": "^7.1.1",
"react-router-dom": "^5.1.2",
"redux": "^4.0.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/template-redux/src/home/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import Helmet from 'react-helmet';
import { Helmet } from 'react-helmet-async';
import styles from './styles.css';

export default function Home() {
Expand Down
11 changes: 10 additions & 1 deletion packages/template-redux/src/home/spec/index.spec.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
import React from 'react';
import renderer from 'react-test-renderer';
import { HelmetProvider } from 'react-helmet-async';
import Home from '../';

HelmetProvider.canUseDOM = false;

it('renders correctly', () => {
const tree = renderer.create(<Home />).toJSON();
const tree = renderer
.create(
<HelmetProvider>
<Home />
</HelmetProvider>
)
.toJSON();
expect(tree).toMatchSnapshot();
});
30 changes: 12 additions & 18 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@
"@babel/plugin-transform-react-jsx-self" "^7.0.0"
"@babel/plugin-transform-react-jsx-source" "^7.0.0"

"@babel/runtime@^7.1.2", "@babel/runtime@^7.4.0", "@babel/runtime@^7.5.5", "@babel/runtime@^7.6.2":
"@babel/runtime@^7.1.2", "@babel/runtime@^7.3.4", "@babel/runtime@^7.4.0", "@babel/runtime@^7.5.5", "@babel/runtime@^7.6.2":
version "7.6.3"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.6.3.tgz#935122c74c73d2240cafd32ddb5fc2a6cd35cf1f"
integrity sha512-kq6anf9JGjW8Nt5rYfEuGRaEAaH1mkv3Bbu6rYvLOpPh/RusSJXuKPEAoZ7L7gybZkchE8+NV5g9vKF4AGAtsA==
Expand Down Expand Up @@ -10846,20 +10846,21 @@ react-dom@^16.10.2:
prop-types "^15.6.2"
scheduler "^0.16.2"

react-fast-compare@^2.0.2:
react-fast-compare@^2.0.4:
version "2.0.4"
resolved "https://registry.yarnpkg.com/react-fast-compare/-/react-fast-compare-2.0.4.tgz#e84b4d455b0fec113e0402c329352715196f81f9"
integrity sha512-suNP+J1VU1MWFKcyt7RtjiSWUjvidmQSlqu+eHslq+342xCbGTYmC0mEhPCOHxlW0CywylOC1u2DFAT+bv4dBw==

react-helmet@^5.2.1:
version "5.2.1"
resolved "https://registry.yarnpkg.com/react-helmet/-/react-helmet-5.2.1.tgz#16a7192fdd09951f8e0fe22ffccbf9bb3e591ffa"
integrity sha512-CnwD822LU8NDBnjCpZ4ySh8L6HYyngViTZLfBBb3NjtrpN8m49clH8hidHouq20I51Y6TpCTISCBbqiY5GamwA==
react-helmet-async@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/react-helmet-async/-/react-helmet-async-1.0.4.tgz#079ef10b7fefcaee6240fefd150711e62463cc97"
integrity sha512-KTGHE9sz8N7+fCkZ2a3vzXH9eIkiTNhL2NhKR7XzzQl3WsGlCHh76arauJUIiGdfhjeMp7DY7PkASAmYFXeJYg==
dependencies:
object-assign "^4.1.1"
prop-types "^15.5.4"
react-fast-compare "^2.0.2"
react-side-effect "^1.1.0"
"@babel/runtime" "^7.3.4"
invariant "^2.2.4"
prop-types "^15.7.2"
react-fast-compare "^2.0.4"
shallowequal "^1.1.0"

react-is@^16.6.0, react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.4, react-is@^16.8.6, react-is@^16.9.0:
version "16.10.2"
Expand Down Expand Up @@ -10907,13 +10908,6 @@ [email protected]:
tiny-invariant "^1.0.2"
tiny-warning "^1.0.0"

react-side-effect@^1.1.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/react-side-effect/-/react-side-effect-1.2.0.tgz#0e940c78faba0c73b9b0eba9cd3dda8dfb7e7dae"
integrity sha512-v1ht1aHg5k/thv56DRcjw+WtojuuDHFUgGfc+bFHOWsF4ZK6C2V57DO0Or0GPsg6+LSTE0M6Ry/gfzhzSwbc5w==
dependencies:
shallowequal "^1.0.1"

react-test-renderer@^16.10.2:
version "16.10.2"
resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-16.10.2.tgz#4d8492f8678c9b43b721a7d79ed0840fdae7c518"
Expand Down Expand Up @@ -11669,7 +11663,7 @@ sha.js@^2.4.0, sha.js@^2.4.11, sha.js@^2.4.8:
inherits "^2.0.1"
safe-buffer "^5.0.1"

shallowequal@^1.0.1:
shallowequal@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/shallowequal/-/shallowequal-1.1.0.tgz#188d521de95b9087404fd4dcb68b13df0ae4e7f8"
integrity sha512-y0m1JoUZSlPAjXVtPPW70aZWfIL/dSP7AFkRnniLCrK/8MDKog3TySTBmckD+RObVxH0v4Tox67+F14PdED2oQ==
Expand Down

0 comments on commit f1c61d1

Please sign in to comment.