Skip to content

Commit

Permalink
refactor(template-react): remove graphql from default template
Browse files Browse the repository at this point in the history
This commit removes the `hops-graphql` support from the default
`hops-template-react`.

BREAKING CHANGE:
`hops-template-react` (default template) now no longer supports graphql
out of the box. You can add the support yourself again or use a
different template (we will provide a new `hops-template-graphql`
shortly).

Closes: #276
  • Loading branch information
ZauberNerd authored and dmbch committed Nov 22, 2017
1 parent a5de350 commit 4533445
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 121 deletions.
7 changes: 2 additions & 5 deletions packages/template-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
"locations": [
"/",
"/counter"
],
"graphqlUri": "https://www.graphqlhub.com/graphql"
]
}
},
"scripts": {
Expand All @@ -21,12 +20,10 @@
"flow": "flow"
},
"dependencies": {
"graphql-tag": "^2.5.0",
"hops-express": "7.3.4",
"hops-graphql": "7.4.1",
"hops-react": "7.4.0",
"hops-redux": "7.4.0",
"react": "^16.0.0",
"react-apollo": "^2.0.0",
"react-dom": "^16.0.0",
"react-helmet": "^5.2.0",
"react-redux": "^5.0.6",
Expand Down
2 changes: 1 addition & 1 deletion packages/template-react/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from 'react';
import { Route, Switch, Link } from 'react-router-dom';

import { render, Miss } from 'hops-react';
import { createContext } from 'hops-graphql';
import { createContext } from 'hops-redux';

import { Home } from './home';
import { Counter } from './counter';
Expand Down
20 changes: 0 additions & 20 deletions packages/template-react/src/home/commits.gql

This file was deleted.

36 changes: 12 additions & 24 deletions packages/template-react/src/home/home.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,19 @@
// @flow
import React from 'react';
import Helmet from 'react-helmet';
import { graphql } from 'react-apollo';

import styles from './styles.css';
import query from './commits.gql';

export const withCommits = graphql(query);

export const Home = ({ data: { loading, github } }) => (
<div>
<Helmet>
<title>Hops Demo</title>
</Helmet>
<h1 className={styles.headline}>
Hello World!
</h1>
{
(loading)
? (<p>Loading...</p>)
: (github.repo.commits.map(commit => (
<p key={commit.sha}>
"{commit.message}" by <b>{commit.author.login}</b>
</p>
)))
}
</div>
);

export default withCommits(Home);
export default function Home () {
return (
<div>
<Helmet>
<title>Hops Demo</title>
</Helmet>
<h1 className={styles.headline}>
Hello World!
</h1>
</div>
);
}
Original file line number Diff line number Diff line change
@@ -1,32 +1,11 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`renders loaded state correctly 1`] = `
exports[`renders correctly 1`] = `
<div>
<h1
className="headline"
>
Hello World!
</h1>
<p>
"
bar
" by
<b>
baz
</b>
</p>
</div>
`;

exports[`renders loading state correctly 1`] = `
<div>
<h1
className="headline"
>
Hello World!
</h1>
<p>
Loading...
</p>
</div>
`;
27 changes: 3 additions & 24 deletions packages/template-react/src/home/spec/home.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,11 @@

import React from 'react';
import renderer from 'react-test-renderer';
import { Home } from '../home';
import { Home } from '../';

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

it('renders loaded state correctly', () => {
const data = {
loading: false,
github: {
repo: {
commits: [{
sha: 'foo',
message: 'bar',
author: {
login: 'baz'
}
}]
}
}
};
const tree = renderer.create(
<Home data={ data } />
<Home />
).toJSON();
expect(tree).toMatchSnapshot();
});
27 changes: 2 additions & 25 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3162,10 +3162,6 @@ graphql-anywhere@^4.0.1:
dependencies:
apollo-utilities "^1.0.2"

graphql-tag@^2.5.0:
version "2.5.0"
resolved "https://registry.yarnpkg.com/graphql-tag/-/graphql-tag-2.5.0.tgz#b43bfd8b5babcd2c205ad680c03e98b238934e0f"

graphql@^0.11.7:
version "0.11.7"
resolved "https://registry.yarnpkg.com/graphql/-/graphql-0.11.7.tgz#e5abaa9cb7b7cccb84e9f0836bf4370d268750c6"
Expand Down Expand Up @@ -3353,7 +3349,7 @@ hoek@4.x.x:
version "4.2.0"
resolved "https://registry.yarnpkg.com/hoek/-/hoek-4.2.0.tgz#72d9d0754f7fe25ca2d01ad8f8f9a9449a89526d"

hoist-non-react-statics@^2.2.0, hoist-non-react-statics@^2.2.1, hoist-non-react-statics@^2.3.0:
hoist-non-react-statics@^2.2.1, hoist-non-react-statics@^2.3.0:
version "2.3.1"
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-2.3.1.tgz#343db84c6018c650778898240135a1420ee22ce0"

Expand Down Expand Up @@ -4383,10 +4379,6 @@ lodash.cond@^4.3.0:
version "4.5.2"
resolved "https://registry.yarnpkg.com/lodash.cond/-/lodash.cond-4.5.2.tgz#f471a1da486be60f6ab955d17115523dd1d255d5"

lodash.flowright@^3.5.0:
version "3.5.0"
resolved "https://registry.yarnpkg.com/lodash.flowright/-/lodash.flowright-3.5.0.tgz#2b5fff399716d7e7dc5724fe9349f67065184d67"

lodash.map@^4.5.1:
version "4.6.0"
resolved "https://registry.yarnpkg.com/lodash.map/-/lodash.map-4.6.0.tgz#771ec7839e3473d9c4cde28b19394c3562f4f6d3"
Expand All @@ -4395,10 +4387,6 @@ lodash.memoize@^4.1.2:
version "4.1.2"
resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe"

lodash.pick@^4.4.0:
version "4.4.0"
resolved "https://registry.yarnpkg.com/lodash.pick/-/lodash.pick-4.4.0.tgz#52f05610fff9ded422611441ed1fc123a03001b3"

lodash.reduce@4.6.0:
version "4.6.0"
resolved "https://registry.yarnpkg.com/lodash.reduce/-/lodash.reduce-4.6.0.tgz#f1ab6b839299ad48f784abbf476596f03b914d3b"
Expand Down Expand Up @@ -5786,7 +5774,7 @@ promise@^7.1.1:
dependencies:
asap "~2.0.3"

prop-types@^15.5.10, prop-types@^15.5.4, prop-types@^15.5.8, prop-types@^15.6.0:
prop-types@^15.5.10, prop-types@^15.5.4, prop-types@^15.6.0:
version "15.6.0"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.6.0.tgz#ceaf083022fc46b4a35f69e13ef75aed0d639856"
dependencies:
Expand Down Expand Up @@ -5928,17 +5916,6 @@ rc@^1.0.1, rc@^1.1.6, rc@^1.1.7:
minimist "^1.2.0"
strip-json-comments "~2.0.1"

react-apollo@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/react-apollo/-/react-apollo-2.0.1.tgz#43997db9f294d81bd229eb705944fb36d5164607"
dependencies:
apollo-link "^1.0.0"
hoist-non-react-statics "^2.2.0"
invariant "^2.2.1"
lodash.flowright "^3.5.0"
lodash.pick "^4.4.0"
prop-types "^15.5.8"

react-dom@^16.0.0:
version "16.1.1"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.1.1.tgz#b2e331b6d752faf1a2d31399969399a41d8d45f8"
Expand Down

0 comments on commit 4533445

Please sign in to comment.