Skip to content

Commit

Permalink
Merge pull request #9 from piglovesyou/upgrade-deps
Browse files Browse the repository at this point in the history
Upgrade deps
  • Loading branch information
piglovesyou authored Mar 21, 2019
2 parents 27ba7d3 + 1ad586c commit c15d8c9
Show file tree
Hide file tree
Showing 27 changed files with 3,626 additions and 3,071 deletions.
10 changes: 7 additions & 3 deletions flow-typed/npm/isomorphic-style-loader_vx.x.x.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ declare module 'isomorphic-style-loader/lib/insertCss' {
declare module.exports: any;
}

declare module 'isomorphic-style-loader/lib/withStyles' {
declare module 'isomorphic-style-loader/withStyles' {
// TODO: Using ComponentType<T> does not work so simply return T.
// import type {ComponentType} from 'react';
declare module.exports: (
Expand All @@ -42,13 +42,17 @@ declare module 'isomorphic-style-loader/lib/withStyles' {
) => (<T>(component: T) => T);
}

declare module 'isomorphic-style-loader/StyleContext' {
declare module.exports: any;
}

// Filename aliases
declare module 'isomorphic-style-loader/lib/index.js' {
declare module.exports: $Exports<'isomorphic-style-loader/lib/index'>;
}
declare module 'isomorphic-style-loader/lib/insertCss.js' {
declare module.exports: $Exports<'isomorphic-style-loader/lib/insertCss'>;
}
declare module 'isomorphic-style-loader/lib/withStyles.js' {
declare module.exports: $Exports<'isomorphic-style-loader/lib/withStyles'>;
declare module 'isomorphic-style-loader/withStyles.js' {
declare module.exports: $Exports<'isomorphic-style-loader/withStyles'>;
}
160 changes: 80 additions & 80 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,125 +13,125 @@
"not ie < 9"
],
"dependencies": {
"@babel/polyfill": "^7.0.0",
"apollo-cache-inmemory": "^1.5.0",
"apollo-client": "^2.5.0",
"apollo-link": "^1.2.8",
"apollo-link-error": "^1.1.7",
"apollo-link-http": "^1.5.11",
"@babel/polyfill": "^7.4.0",
"apollo-cache-inmemory": "^1.5.1",
"apollo-client": "^2.5.1",
"apollo-link": "^1.2.11",
"apollo-link-error": "^1.1.10",
"apollo-link-http": "^1.5.14",
"apollo-link-logger": "^1.2.3",
"apollo-link-schema": "^1.1.6",
"apollo-link-schema": "^1.2.2",
"apollo-server": "^2.4.8",
"apollo-server-express": "^2.4.8",
"body-parser": "^1.18.3",
"classnames": "^2.2.6",
"cookie-parser": "^1.4.3",
"express": "^4.16.3",
"cookie-parser": "^1.4.4",
"express": "^4.16.4",
"express-jwt": "^5.3.1",
"graphql": "^14.0.2",
"graphql-tag": "^2.9.2",
"history": "^4.7.2",
"isomorphic-style-loader": "^4.0.0",
"jsonwebtoken": "^8.3.0",
"graphql": "^14.0",
"graphql-tag": "^2.10.1",
"history": "^4.9.0",
"isomorphic-style-loader": "^5.0.1",
"jsonwebtoken": "^8.5.1",
"lodash.merge": "^4.6.1",
"node-fetch": "^2.2.0",
"normalize.css": "^8.0.0",
"node-fetch": "^2.3.0",
"normalize.css": "^8.0.1",
"passport": "^0.4.0",
"passport-facebook": "^2.1.1",
"passport-facebook": "^3.0.0",
"pretty-error": "^2.1.1",
"prop-types": "^15.6.2",
"query-string": "^6.1.0",
"react": "^16.5.2",
"react-apollo": "^2.5.0",
"react-dom": "^16.5.2",
"sequelize": "^4.38.1",
"serialize-javascript": "^1.5.0",
"source-map-support": "^0.5.9",
"sqlite3": "^4.0.2",
"universal-router": "^6.0.0",
"query-string": "^6.4.0",
"react": "^16.8.4",
"react-apollo": "^2.5.2",
"react-dom": "^16.8.4",
"sequelize": "^5.1.0",
"serialize-javascript": "^1.6.1",
"source-map-support": "^0.5.11",
"sqlite3": "^4.0.6",
"universal-router": "^8.1.0",
"whatwg-fetch": "^3.0.0"
},
"devDependencies": {
"@babel/core": "^7.0.0",
"@babel/node": "^7.0.0",
"@babel/plugin-proposal-class-properties": "^7.0.0",
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
"@babel/plugin-transform-react-constant-elements": "^7.0.0",
"@babel/plugin-transform-react-inline-elements": "^7.0.0",
"@babel/preset-env": "^7.1.0",
"@babel/core": "^7.4.0",
"@babel/node": "^7.2.2",
"@babel/plugin-proposal-class-properties": "^7.4.0",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/plugin-transform-react-constant-elements": "^7.2.0",
"@babel/plugin-transform-react-inline-elements": "^7.2.0",
"@babel/preset-env": "^7.4.1",
"@babel/preset-flow": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"apollo": "^2.4.4",
"autoprefixer": "^9.1.5",
"apollo": "^2.6.2",
"autoprefixer": "^9.5.0",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "^9.0.0",
"babel-jest": "^23.6.0",
"babel-loader": "^8.0.0",
"babel-plugin-transform-react-remove-prop-types": "^0.4.18",
"browser-sync": "^2.24.7",
"chokidar": "^2.0.4",
"css-loader": "^1.0.0",
"enzyme": "^3.6.0",
"eslint": "^5.6.0",
"babel-eslint": "^10.0.1",
"babel-jest": "^24.5.0",
"babel-loader": "^8.0.5",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"browser-sync": "^2.26.3",
"chokidar": "^2.1.2",
"css-loader": "^2.1.1",
"cssnano": "^4.1.10",
"enzyme": "^3.9.0",
"eslint": "^5.15.3",
"eslint-config-airbnb": "^17.1.0",
"eslint-config-prettier": "^3.0.1",
"eslint-config-prettier": "^4.1.0",
"eslint-import-resolver-node": "^0.3.2",
"eslint-loader": "^2.1.1",
"eslint-plugin-css-modules": "^2.9.1",
"eslint-plugin-flowtype": "^2.50.1",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jsx-a11y": "^6.1.1",
"eslint-plugin-prettier": "^2.6.2",
"eslint-plugin-react": "^7.11.1",
"file-loader": "^2.0.0",
"eslint-loader": "^2.1.2",
"eslint-plugin-css-modules": "^2.11.0",
"eslint-plugin-flowtype": "^3.4.2",
"eslint-plugin-import": "^2.16.0",
"eslint-plugin-jsx-a11y": "^6.2.1",
"eslint-plugin-prettier": "^3.0.1",
"eslint-plugin-react": "^7.12.4",
"file-loader": "^3.0.1",
"flow-bin": "^0.88.0",
"flow-typed": "^2.5.1",
"front-matter": "^2.3.0",
"front-matter": "^3.0.1",
"glob": "^7.1.3",
"husky": "^1.0.0-rc.15",
"husky": "^1.3.1",
"identity-obj-proxy": "^3.0.0",
"jest": "^24.5.0",
"jest-codemods": "^0.16.0",
"jest-codemods": "^0.19.1",
"jest-transform-graphql": "^2.1.0",
"lint-staged": "^7.3.0",
"lint-staged": "^8.1.5",
"markdown-it": "^8.4.2",
"mkdirp": "^0.5.1",
"null-loader": "^0.1.1",
"opn-cli": "^3.1.0",
"pixrem": "^4.0.1",
"opn-cli": "^4.0.0",
"pixrem": "^5.0.0",
"pleeease-filters": "^4.0.0",
"postcss": "^7.0.2",
"postcss-calc": "^6.0.1",
"postcss": "^7.0.14",
"postcss-calc": "^7.0.1",
"postcss-color-function": "^4.0.1",
"postcss-custom-media": "^7.0.3",
"postcss-custom-properties": "^8.0.5",
"postcss-custom-media": "^7.0.7",
"postcss-custom-properties": "^8.0.9",
"postcss-custom-selectors": "^5.1.2",
"postcss-flexbugs-fixes": "^4.1.0",
"postcss-import": "^12.0.0",
"postcss-import": "^12.0.1",
"postcss-loader": "^3.0.0",
"postcss-media-minmax": "^4.0.0",
"postcss-nested": "^4.1.0",
"postcss-nested": "^4.1.2",
"postcss-nesting": "^7.0.0",
"postcss-pseudoelements": "^5.0.0",
"postcss-selector-matches": "^4.0.0",
"postcss-selector-not": "^4.0.0",
"prettier": "^1.14.3",
"raw-loader": "^0.5.1",
"prettier": "^1.16.4",
"raw-loader": "^2.0.0",
"react-deep-force-update": "^2.1.3",
"react-dev-utils": "^5.0.2",
"react-error-overlay": "^4.0.1",
"react-test-renderer": "^16.5.2",
"rimraf": "^2.6.2",
"stylelint": "^9.5.0",
"react-dev-utils": "^8.0.0",
"react-error-overlay": "^5.1.4",
"react-test-renderer": "^16.8.4",
"rimraf": "^2.6.3",
"stylelint": "^9.10.1",
"stylelint-config-standard": "^18.2.0",
"stylelint-order": "^1.0.0",
"stylelint-order": "^2.1.0",
"svg-url-loader": "^2.3.2",
"url-loader": "^1.1.1",
"webpack": "^4.19.1",
"webpack-assets-manifest": "^3.0.2",
"webpack-bundle-analyzer": "^3.0.2",
"webpack-dev-middleware": "^3.3.0",
"webpack-hot-middleware": "^2.24.2",
"url-loader": "^1.1.2",
"webpack": "^4.29.6",
"webpack-assets-manifest": "^3.1.1",
"webpack-bundle-analyzer": "^3.1.0",
"webpack-dev-middleware": "^3.6.1",
"webpack-hot-middleware": "^2.24.3",
"webpack-node-externals": "^1.7.2"
},
"lint-staged": {
Expand Down
28 changes: 14 additions & 14 deletions src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,19 @@ import router from './router';

const apolloClient = createApolloClient();

// Enables critical path CSS rendering
// https://github.com/kriasoft/isomorphic-style-loader
const insertCss = (...styles) => {
// eslint-disable-next-line no-underscore-dangle
const removeCss = styles.map(x => x._insertCss());
return () => {
removeCss.forEach(f => f());
};
};

// Global (context) variables that can be easily accessed from any React component
// https://facebook.github.io/react/docs/context.html
const context = {
// Enables critical path CSS rendering
// https://github.com/kriasoft/isomorphic-style-loader
insertCss: (...styles) => {
// eslint-disable-next-line no-underscore-dangle
const removeCss = styles.map(x => x._insertCss());
return () => {
removeCss.forEach(f => f());
};
},
// For react-apollo
client: apolloClient,
};
const context = {};

const container = document.getElementById('app');
let currentLocation = history.location;
Expand Down Expand Up @@ -79,7 +77,9 @@ async function onLocationChange(location, action) {

const renderReactApp = isInitialRender ? ReactDOM.hydrate : ReactDOM.render;
appInstance = renderReactApp(
<App context={context}>{route.component}</App>,
<App context={context} client={apolloClient} insertCss={insertCss}>
{route.component}
</App>,
container,
() => {
if (isInitialRender) {
Expand Down
84 changes: 16 additions & 68 deletions src/components/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,80 +11,28 @@

import React from 'react';
import type { Node } from 'react';
import PropTypes from 'prop-types';
import { ApolloProvider } from 'react-apollo';
import StyleContext from 'isomorphic-style-loader/StyleContext';
import type { AppContextTypes } from '../context';
import AppContext from '../context';

// Since the current React Starter Kit uses older React Context API that cannot be typed,
// here we declare duplicate type information.

type ContextType = {|
type Props = {|
insertCss: Function,
pathname: string,
query: Object,
client: Object,
|};

type Props = {|
context: ContextType,
context: AppContextTypes,
children: Node,
|};

const ContextRuntimeType = {
// Enables critical path CSS rendering
// https://github.com/kriasoft/isomorphic-style-loader
insertCss: PropTypes.func.isRequired,
// Universal HTTP client
pathname: PropTypes.string.isRequired,
query: PropTypes.object,
// Apollo Client
client: PropTypes.object.isRequired,
};

const PropTypesRuntimeType = {
context: PropTypes.shape(ContextRuntimeType).isRequired,
children: PropTypes.element.isRequired,
};

/**
* The top-level React component setting context (global) variables
* that can be accessed from all the child components.
*
* https://facebook.github.io/react/docs/context.html
*
* Usage example:
*
* const context = {
* history: createBrowserHistory(),
* store: createStore(),
* };
*
* ReactDOM.render(
* <App context={context}>
* <Layout>
* <LandingPage />
* </Layout>
* </App>,
* container,
* );
*/
class App extends React.PureComponent<Props> {
static propTypes = PropTypesRuntimeType;

static childContextTypes = ContextRuntimeType;

getChildContext() {
return this.props.context;
}

render() {
// Here, we are at universe level, sure? ;-)
const { client } = this.props.context;
// NOTE: If you need to add or modify header, footer etc. of the app,
// please do that inside the Layout component.
return (
<ApolloProvider client={client}>{this.props.children}</ApolloProvider>
);
}
}
const App = ({ client, insertCss, context, children }: Props) => (
// NOTE: If you need to add or modify header, footer etc. of the app,
// please do that inside the Layout component.
<ApolloProvider client={client}>
<AppContext.Provider value={context}>
<StyleContext.Provider value={{ insertCss }}>
{children}
</StyleContext.Provider>
</AppContext.Provider>
</ApolloProvider>
);

export default App;
Loading

0 comments on commit c15d8c9

Please sign in to comment.