Skip to content

Commit eef9762

Browse files
committed
Update CRA and packages
1 parent 646622a commit eef9762

24 files changed

+14999
-16788
lines changed

package-lock.json

Lines changed: 14238 additions & 15644 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 52 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,65 @@
11
{
22
"name": "guide",
3-
"version": "0.1.0",
3+
"version": "1.0.0",
44
"private": true,
55
"scripts": {
66
"start": "react-scripts start",
77
"build": "react-scripts build",
8-
"test": "react-scripts test --env=jsdom",
8+
"test": "react-scripts test",
99
"eject": "react-scripts eject",
10-
"now-start": "serve --single ./build",
11-
"deploy": "now",
12-
"alias": "pbpaste | xargs -I % now alias % staging.graphql.guide",
1310
"lint": "eslint src/",
14-
"update-schema": "graphql get-schema -e https://api.graphql.guide/graphql -o schema.json",
15-
"update-schema-spacex": "graphql get-schema -e https://api.spacex.land/graphql -o spacex.json",
16-
"update-schema-local": "graphql get-schema -e http://localhost:4000/graphql -o schema.json"
11+
"update-schema": "apollo schema:download --endpoint https://api.graphql.guide/graphql schema.json",
12+
"update-schema-spacex": "apollo schema:download --endpoint https://api.spacex.land/graphql spacex.json",
13+
"update-schema-local": "apollo schema:download --endpoint http://localhost:4000/graphql schema.json"
1714
},
1815
"dependencies": {
19-
"@material-ui/core": "^3.9.2",
20-
"@material-ui/icons": "^3.0.2",
21-
"ajv": "^6.10.0",
22-
"apollo-cache-inmemory": "^1.5.1",
23-
"apollo-cache-persist": "^0.1.1",
24-
"apollo-client": "^2.5.1",
25-
"apollo-link": "^1.2.11",
26-
"apollo-link-context": "^1.0.17",
27-
"apollo-link-error": "^1.1.10",
28-
"apollo-link-http": "^1.5.14",
29-
"apollo-link-rest": "^0.7.0",
30-
"apollo-link-state": "^0.4.2",
31-
"apollo-link-ws": "^1.0.17",
32-
"apollo-utilities": "^1.2.1",
33-
"auth0-helpers": "^0.4.3",
34-
"auth0-js": "^9.10.1",
35-
"classnames": "^2.2.6",
36-
"cloudinary-core": "^2.6.2",
37-
"cloudinary-react": "^1.1.0",
38-
"date-fns": "^1.30.1",
39-
"formik": "^1.5.1",
40-
"graphql": "^14.1.1",
41-
"graphql-anywhere": "^4.2.1",
42-
"graphql-tag": "^2.10.1",
16+
"@apollo/client": "3.1.3",
17+
"@material-ui/core": "3.9.3",
18+
"@material-ui/icons": "3.0.2",
19+
"@testing-library/jest-dom": "^4.2.4",
20+
"@testing-library/react": "^9.3.2",
21+
"@testing-library/user-event": "^7.1.2",
22+
"ajv": "6.12.3",
23+
"apollo": "^2.30.2",
24+
"apollo-cache-persist": "0.1.1",
25+
"apollo-link-rest": "0.8.0-beta.0",
26+
"auth0-helpers": "0.4.3",
27+
"auth0-js": "9.13.4",
28+
"classnames": "2.2.6",
29+
"cloudinary-core": "2.11.1",
30+
"cloudinary-react": "1.6.6",
31+
"date-fns": "^2.15.0",
32+
"eslint-plugin-graphql": "4.0.0",
33+
"graphql": "15.3.0",
34+
"graphql-anywhere": "4.2.7",
4335
"jss": "^9.8.7",
44-
"lodash": "^4.17.11",
45-
"react": "^16.8.5",
46-
"react-apollo": "^2.5.2",
47-
"react-dom": "^16.8.5",
48-
"react-loading-skeleton": "^1.1.1",
49-
"react-markdown": "^4.0.6",
50-
"react-odometerjs": "^2.1.1",
51-
"react-router": "^5.0.0",
52-
"react-router-dom": "^5.0.0",
53-
"react-scripts": "^2.1.8",
54-
"react-star-rating-component": "^1.4.1",
55-
"react-style-proptype": "^3.2.2",
56-
"react-transition-group": "^2.7.0",
57-
"recompose": "^0.30.0",
58-
"revalidate": "^1.2.0",
59-
"scroll-into-view-if-needed": "^2.2.20",
60-
"serve": "^10.1.2",
61-
"subscriptions-transport-ws": "^0.9.16",
62-
"typed.js": "^2.0.10",
63-
"typescript": "^3.3.4000"
36+
"lodash": "4.17.19",
37+
"react": "16.13.1",
38+
"react-dom": "16.13.1",
39+
"react-loading-skeleton": "2.1.1",
40+
"react-markdown": "4.3.1",
41+
"react-odometerjs": "2.1.1",
42+
"react-router": "5.2.0",
43+
"react-router-dom": "5.2.0",
44+
"react-scripts": "3.4.1",
45+
"react-star-rating-component": "1.4.1",
46+
"react-style-proptype": "3.2.2",
47+
"recompose": "0.30.0",
48+
"request": "^2.88.2",
49+
"revalidate": "1.2.0",
50+
"scroll-into-view-if-needed": "2.2.25",
51+
"subscriptions-transport-ws": "0.9.17"
6452
},
65-
"devDependencies": {
66-
"eslint-plugin-graphql": "^3.0.3",
67-
"graphql-cli": "^3.0.11"
68-
},
69-
"browserslist": [
70-
">0.2%",
71-
"not dead",
72-
"not ie <= 11",
73-
"not op_mini all"
74-
]
53+
"browserslist": {
54+
"production": [
55+
">0.2%",
56+
"not dead",
57+
"not op_mini all"
58+
],
59+
"development": [
60+
"last 1 chrome version",
61+
"last 1 firefox version",
62+
"last 1 safari version"
63+
]
64+
}
7565
}

src/components/App.js

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { Component } from 'react'
1+
import React from 'react'
22
import { Switch, Route, Redirect } from 'react-router'
33
import { Link } from 'react-router-dom'
44

@@ -20,26 +20,20 @@ const Book = ({ user }) => (
2020
</div>
2121
)
2222

23-
class App extends Component {
24-
render() {
25-
return (
26-
<div className="App">
27-
<header className="App-header">
28-
<StarCount />
29-
<Link className="App-home-link" to="/">
30-
<img src={logo} className="App-logo" alt="logo" />
31-
<h1 className="App-title">The GraphQL Guide</h1>
32-
</Link>
33-
<CurrentUser />
34-
</header>
35-
<Switch>
36-
<Route exact path="/" render={() => <Redirect to="/Preface" />} />
37-
<Route exact path="/me" component={Profile} />
38-
<Route component={Book} />
39-
</Switch>
40-
</div>
41-
)
42-
}
43-
}
44-
45-
export default App
23+
export default () => (
24+
<div className="App">
25+
<header className="App-header">
26+
<StarCount />
27+
<Link className="App-home-link" to="/">
28+
<img src={logo} className="App-logo" alt="logo" />
29+
<h1 className="App-title">The GraphQL Guide</h1>
30+
</Link>
31+
<CurrentUser />
32+
</header>
33+
<Switch>
34+
<Route exact path="/" render={() => <Redirect to="/Preface" />} />
35+
<Route exact path="/me" component={Profile} />
36+
<Route component={Book} />
37+
</Switch>
38+
</div>
39+
)
File renamed without changes.

src/components/CurrentUser.js

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,26 @@
11
import React from 'react'
2-
import PropTypes from 'prop-types'
32
import { Link } from 'react-router-dom'
43

5-
import { withUser } from '../lib/withUser'
4+
import { useUser } from '../lib/useUser'
65
import { login } from '../lib/auth'
76

8-
const CurrentUser = ({ user, loggingIn }) => {
7+
export default () => {
8+
const { user, loggingIn } = useUser()
9+
910
let content
1011

11-
if (user) {
12+
if (loggingIn) {
13+
content = <div className="Spinner" />
14+
} else if (!user) {
15+
content = <button onClick={login}>Sign in</button>
16+
} else {
1217
content = (
1318
<Link to="/me" className="User">
1419
<img src={user.photo} alt={user.firstName} />
1520
{user.firstName}
1621
</Link>
1722
)
18-
} else if (loggingIn) {
19-
content = <div className="Spinner" />
20-
} else {
21-
content = <button onClick={login}>Sign in</button>
2223
}
2324

2425
return <div className="CurrentUser">{content}</div>
2526
}
26-
27-
CurrentUser.propTypes = {
28-
user: PropTypes.shape({
29-
firstName: PropTypes.string.isRequired,
30-
photo: PropTypes.string.isRequired
31-
}),
32-
loggingIn: PropTypes.bool.isRequired
33-
}
34-
35-
export default withUser(CurrentUser)

src/components/Profile.js

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import React from 'react'
2-
import PropTypes from 'prop-types'
32

4-
import { withUser } from '../lib/withUser'
3+
import { useUser } from '../lib/useUser'
54
import { login, logout } from '../lib/auth'
65

7-
const Profile = ({ user, loggingIn }) => {
6+
export default () => {
7+
const { user, loggingIn } = useUser()
8+
89
if (loggingIn) {
910
return (
1011
<main className="Profile">
@@ -59,14 +60,3 @@ const Profile = ({ user, loggingIn }) => {
5960
)
6061
}
6162
}
62-
63-
Profile.propTypes = {
64-
user: PropTypes.shape({
65-
name: PropTypes.string.isRequired,
66-
email: PropTypes.string.isRequired,
67-
hasPurchased: PropTypes.string
68-
}),
69-
loggingIn: PropTypes.bool.isRequired
70-
}
71-
72-
export default withUser(Profile)

0 commit comments

Comments
 (0)