Upgrade to Gatsby v2 (#1104)

* Upgrade to Gatsby v2

* Remove unnecessary polyfills since gatsby already provides them

* Move global styles to gatsby-browser

* Add fb comment and convert to cjs

* Revert to use pageQuery again

* Add back html.js

* Update dependencies

* Move TitleAndMetaTags

* Replace glamor/reset with normalize.css which fixes style order in prod

* Prettier formatting

* Remove unused types

* Remove old layout

* Fix versions link

* Update deps

* Update deps

* Remove hack since it's no longer needed

* Update dependencies

* Fix build error

* Fix prettier config resolution

* Update gatsby

* Remove custom onCreatePage logic

* Update dependencies

* Fix build

* Update dependencies

* prettier formatting

* update dependencies

* add custom babel config for flow

* upgrade dependencies

* update dependencies

* use stable gatsby release
This commit is contained in:
Alexander Nanberg
2018-09-19 14:11:19 +02:00
committed by Dan Abramov
parent 12f003c32d
commit 71b03486c0
41 changed files with 4281 additions and 4195 deletions

View File

@@ -1,41 +1,17 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* @emails react-core
*/
import React, {Component} from 'react';
let stylesStr;
if (process.env.NODE_ENV === `production`) {
try {
stylesStr = require(`!raw-loader!../public/styles.css`);
} catch (e) {
console.error(e);
}
}
import React from 'react';
const JS_NPM_URLS = [
'//unpkg.com/docsearch.js@2.4.1/dist/cdn/docsearch.min.js',
];
export default class HTML extends Component {
export default class HTML extends React.Component {
render() {
let css;
if (process.env.NODE_ENV === 'production') {
css = (
<style
id="gatsby-inlined-css"
dangerouslySetInnerHTML={{__html: stylesStr}}
/>
);
}
const js = JS_NPM_URLS.map(url => <script key={url} src={url} />);
return (
<html lang="en">
<html lang="en" {...this.props.htmlAttributes}>
<head>
{JS_NPM_URLS.map(url => (
<link key={url} rel="preload" href={url} as="script" />
))}
<meta charSet="utf-8" />
<meta httpEquiv="X-UA-Compatible" content="IE=edge" />
<meta
@@ -44,15 +20,16 @@ export default class HTML extends Component {
/>
<link rel="icon" href="/favicon.ico" />
{this.props.headComponents}
{css}
</head>
<body>
<body {...this.props.bodyAttributes}>
<div
id="___gatsby"
dangerouslySetInnerHTML={{__html: this.props.body}}
/>
{this.props.postBodyComponents}
{js}
{JS_NPM_URLS.map(url => (
<script key={url} src={url} />
))}
</body>
</html>
);