feat: add support for react-helmet

This commit is contained in:
Sérgio Ramos 2018-04-24 14:17:26 +01:00 committed by Sérgio Ramos
parent 25223e7324
commit 3f75f812fa
17 changed files with 101 additions and 41 deletions

1
.gitignore vendored
View File

@ -165,3 +165,4 @@ prototypes/*/package-lock.json
_env*
keys*
/packages/*/public/index.html

View File

@ -31,7 +31,7 @@
"babel-preset-joyent-portal": "^7.0.1",
"eslint": "^4.19.1",
"eslint-config-joyent-portal": "^3.3.1",
"joyent-react-scripts": "^8.0.3",
"joyent-react-scripts": "^8.2.0",
"react": "^16.3.1",
"redrun": "^6.0.2"
},

View File

@ -31,7 +31,7 @@
"execa": "^0.10.0",
"globby": "^8.0.1",
"htmltojsx": "^0.3.0",
"joyent-react-scripts": "^8.0.3",
"joyent-react-scripts": "^8.2.0",
"mz": "^2.7.0",
"react": "^16.3.1",
"redrun": "^6.0.2"

View File

@ -33,7 +33,7 @@
"force-array": "^3.1.0",
"fuse.js": "^3.2.0",
"hapi-render-react": "^2.5.2",
"hapi-render-react-joyent-document": "^5.0.0",
"hapi-render-react-joyent-document": "^7.0.1",
"inert": "^5.1.0",
"joyent-logo-assets": "^1.1.0",
"joyent-react-styled-flexboxgrid": "^2.2.3",
@ -52,6 +52,7 @@
"react": "^16.3.1",
"react-apollo": "^2.1.2",
"react-dom": "^16.3.1",
"react-helmet-async": "0.0.5",
"react-redux": "^5.0.7",
"react-redux-values": "^1.1.2",
"react-router": "^4.2.0",
@ -73,7 +74,7 @@
"eslint-config-joyent-portal": "^3.3.1",
"jest-image-snapshot": "^2.4.0",
"jest-styled-components": "^5.0.1",
"joyent-react-scripts": "^8.0.3",
"joyent-react-scripts": "^8.2.0",
"react-screenshot-renderer": "^1.1.2",
"react-test-renderer": "^16.3.1",
"redrun": "^6.0.2"

View File

@ -51,6 +51,7 @@ const getState = request => {
module.exports = Document({
namespace: 'images/',
assets,
Html: require('./html'),
indexFile,
getState
});

View File

@ -1,10 +1,14 @@
import React from 'react';
import Helmet from 'react-helmet-async';
import { RootContainer } from 'joyent-ui-toolkit';
import Routes from '@root/routes';
export default () => (
<RootContainer>
<Helmet>
<title>Images</title>
</Helmet>
<Routes />
</RootContainer>
);

View File

@ -0,0 +1,20 @@
const React = require('react');
module.exports = ({ htmlAttrs = {}, bodyAttrs = {}, head = [], children = null }) => (
<html {...htmlAttrs}>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<meta name="theme-color" content="#1E313B" />
{head}
</head>
<body {...bodyAttrs}>
<div id="header" />
<div id="root" />
{children}
<script src="/navigation/static/main.js" />
</body>
</html>
);

View File

@ -34,7 +34,7 @@
"exenv": "^1.2.2",
"fuse.js": "^3.2.0",
"hapi-render-react": "^2.5.2",
"hapi-render-react-joyent-document": "^5.0.0",
"hapi-render-react-joyent-document": "^7.0.1",
"inert": "^5.1.0",
"joyent-logo-assets": "^1.1.0",
"joyent-manifest-editor": "^1.4.0",
@ -64,6 +64,7 @@
"react": "^16.3.1",
"react-apollo": "^2.1.2",
"react-dom": "^16.3.1",
"react-helmet-async": "0.0.5",
"react-redux": "^5.0.7",
"react-redux-values": "^1.1.2",
"react-router": "^4.2.0",
@ -84,7 +85,7 @@
"eslint-config-joyent-portal": "^3.3.1",
"jest-image-snapshot": "^2.4.0",
"jest-styled-components": "^5.0.1",
"joyent-react-scripts": "^8.0.3",
"joyent-react-scripts": "^8.2.0",
"react-screenshot-renderer": "^1.1.2",
"react-test-renderer": "^16.3.1",
"redrun": "^6.0.2"

View File

@ -1,18 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="theme-color" content="#1E313B">
<!-- <link rel="manifest" href="%PUBLIC_URL%/manifest.json"> -->
<!-- <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico"> -->
<title>My Joyent &beta;</title>
</head>
<body>
<div id="header"></div>
<div id="root"></div>
<script src="/navigation/static/main.js"></script>
</body>
</html>

View File

@ -7,7 +7,6 @@ const { theme } = require('joyent-ui-toolkit');
const { default: createClient } = require('./state/apollo-client');
const { default: createStore } = require('./state/redux-store');
const indexFile = path.join(__dirname, '../../build/index.html');
const assets = require('../../build/asset-manifest.json');
const { NODE_ENV = 'development' } = process.env;
@ -51,6 +50,6 @@ const getState = request => {
module.exports = Document({
namespace: 'instances/',
assets,
indexFile,
Html: require('./html'),
getState
});

View File

@ -1,10 +1,14 @@
import React from 'react';
import Helmet from 'react-helmet-async';
import { RootContainer } from 'joyent-ui-toolkit';
import Routes from '@root/routes';
export default () => (
<RootContainer>
<Helmet>
<title>Instances</title>
</Helmet>
<Routes />
</RootContainer>
);

View File

@ -0,0 +1,20 @@
const React = require('react');
module.exports = ({ htmlAttrs = {}, bodyAttrs = {}, head = [], children = null }) => (
<html {...htmlAttrs}>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<meta name="theme-color" content="#1E313B" />
{head}
</head>
<body {...bodyAttrs}>
<div id="header" />
<div id="root" />
{children}
<script src="/navigation/static/main.js" />
</body>
</html>
);

View File

@ -1,5 +1,6 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { HelmetProvider } from 'react-helmet-async';
import { ThemeProvider } from 'styled-components';
import { Provider as ReduxProvider } from 'react-redux';
import { ApolloProvider } from 'react-apollo';
@ -22,7 +23,9 @@ ReactDOM.hydrate(
<ThemeProvider theme={theme}>
<ReduxProvider store={createStore()}>
<BrowserRouter>
<App />
<HelmetProvider context={{}}>
<App />
</HelmetProvider>
</BrowserRouter>
</ReduxProvider>
</ThemeProvider>

View File

@ -49,7 +49,7 @@
"babel-preset-joyent-portal": "^7.0.1",
"eslint": "^4.19.1",
"eslint-config-joyent-portal": "^3.3.1",
"joyent-react-scripts": "^8.0.3",
"joyent-react-scripts": "^8.2.0",
"redrun": "^6.0.2"
}
}

View File

@ -58,7 +58,7 @@
"eslint": "^4.19.1",
"eslint-config-joyent-portal": "^3.3.1",
"jest-styled-components": "^5.0.1",
"joyent-react-scripts": "^8.0.3",
"joyent-react-scripts": "^8.2.0",
"react": "^16.3.1",
"react-docgen": "^3.0.0-beta8",
"react-docgen-displayname-handler": "^1.0.1",

View File

@ -31,7 +31,7 @@
"babel-preset-joyent-portal": "^7.0.0",
"eslint": "^4.11.0",
"eslint-config-joyent-portal": "^3.2.0",
"joyent-react-scripts": "^8.0.2",
"joyent-react-scripts": "^8.2.0",
"stylelint": "^8.4.0",
"stylelint-config-joyent-portal": "^2.0.1"
}

View File

@ -3742,7 +3742,7 @@ duplexer@^0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/duplexer/-/duplexer-0.1.1.tgz#ace6ff808c1ce66b57d1ebf97977acb02334cfc1"
duplexify@^3.4.2, duplexify@^3.5.3:
duplexify@^3.4.2, duplexify@^3.5.3, duplexify@^3.5.4:
version "3.5.4"
resolved "https://registry.yarnpkg.com/duplexify/-/duplexify-3.5.4.tgz#4bb46c1796eabebeec4ca9a2e66b808cb7a3d8b4"
dependencies:
@ -5205,11 +5205,14 @@ handlebars@^4.0.2, handlebars@^4.0.3:
optionalDependencies:
uglify-js "^2.6"
hapi-render-react-joyent-document@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/hapi-render-react-joyent-document/-/hapi-render-react-joyent-document-5.0.0.tgz#3e182a1afdae8e1874d322caed3d883bfd85efde"
hapi-render-react-joyent-document@^7.0.1:
version "7.0.1"
resolved "https://registry.yarnpkg.com/hapi-render-react-joyent-document/-/hapi-render-react-joyent-document-7.0.1.tgz#3c7846547f7bcdab668c5d94b748a3d769828ac6"
dependencies:
through2 "^2.0.3"
duplexify "^3.5.4"
pumpify "^1.4.0"
react-helmet-async "0.0.5"
string-to-stream "^1.1.0"
hapi-render-react@^2.5.2:
version "2.5.2"
@ -6527,13 +6530,14 @@ joyent-manifest-editor@^1.4.0:
prop-types "^15.6.0"
react-codemirror "^1.0.0"
joyent-react-scripts@^8.0.3:
version "8.0.3"
resolved "https://registry.yarnpkg.com/joyent-react-scripts/-/joyent-react-scripts-8.0.3.tgz#0fa8684c924dbc582711c948167234278d925c5f"
joyent-react-scripts@^8.2.0:
version "8.2.0"
resolved "https://registry.yarnpkg.com/joyent-react-scripts/-/joyent-react-scripts-8.2.0.tgz#fb6d96e59775945d45264577e379c108a06b8cc6"
dependencies:
apr-for-each "^3.0.3"
apr-main "^4.0.3"
babel-minify-webpack-plugin "^0.3.1"
babel-register "^6.26.0"
duplicate-package-checker-webpack-plugin "^2.1.0"
execa "^0.10.0"
graphql "^0.13.1"
@ -8682,7 +8686,7 @@ pump@^2.0.0, pump@^2.0.1:
end-of-stream "^1.1.0"
once "^1.3.1"
pumpify@^1.3.3:
pumpify@^1.3.3, pumpify@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/pumpify/-/pumpify-1.4.0.tgz#80b7c5df7e24153d03f0e7ac8a05a5d068bd07fb"
dependencies:
@ -8947,6 +8951,15 @@ react-group@^1.0.5:
dependencies:
prop-types "^15.5.10"
react-helmet-async@0.0.5:
version "0.0.5"
resolved "https://registry.yarnpkg.com/react-helmet-async/-/react-helmet-async-0.0.5.tgz#c751aa6caba95b60d31eff9ff1283cb6fa284dba"
dependencies:
deep-equal "^1.0.1"
invariant "^2.2.2"
prop-types "^15.6.0"
shallowequal "^1.0.2"
react-icon-base@2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/react-icon-base/-/react-icon-base-2.1.0.tgz#a196e33fdf1e7aaa1fda3aefbb68bdad9e82a79d"
@ -9207,7 +9220,7 @@ read-pkg@^3.0.0:
normalize-package-data "^2.3.2"
path-type "^3.0.0"
"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.4, readable-stream@^2.0.6, readable-stream@^2.1.4, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.2.9, readable-stream@^2.3.3:
"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.4, readable-stream@^2.0.6, readable-stream@^2.1.0, readable-stream@^2.1.4, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.2.9, readable-stream@^2.3.3:
version "2.3.6"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf"
dependencies:
@ -9932,6 +9945,10 @@ sha.js@^2.4.0, sha.js@^2.4.8:
inherits "^2.0.1"
safe-buffer "^5.0.1"
shallowequal@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/shallowequal/-/shallowequal-1.0.2.tgz#1561dbdefb8c01408100319085764da3fcf83f8f"
shebang-command@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea"
@ -10306,6 +10323,13 @@ string-length@^1.0.1:
dependencies:
strip-ansi "^3.0.0"
string-to-stream@^1.1.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/string-to-stream/-/string-to-stream-1.1.1.tgz#aba78f73e70661b130ee3e1c0192be4fef6cb599"
dependencies:
inherits "^2.0.1"
readable-stream "^2.1.0"
string-width@^1.0.1, string-width@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3"
@ -10695,7 +10719,7 @@ throat@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/throat/-/throat-4.1.0.tgz#89037cbc92c56ab18926e6ba4cbb200e15672a6a"
through2@^2.0.0, through2@^2.0.2, through2@^2.0.3:
through2@^2.0.0, through2@^2.0.2:
version "2.0.3"
resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.3.tgz#0004569b37c7c74ba39c43f3ced78d1ad94140be"
dependencies: