Skip to content

Commit 1d0b7a5

Browse files
committed
Initial template for react-scripts
1 parent 5060768 commit 1d0b7a5

File tree

4 files changed

+23
-7
lines changed

4 files changed

+23
-7
lines changed

packages/react-scripts/package.json

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
{
2-
"name": "react-scripts",
2+
"name": "ob-apollo-scripts",
33
"version": "2.0.4",
4-
"description": "Configuration and scripts for Create React App.",
5-
"repository": "facebook/create-react-app",
4+
"description": "Configuration and scripts for Create React App wil Apollo",
5+
"repository": "OffBase/create-react-app",
66
"license": "MIT",
77
"engines": {
88
"node": ">=6"
99
},
10-
"bugs": {
11-
"url": "https://github.com/facebook/create-react-app/issues"
12-
},
1310
"files": [
1411
"bin",
1512
"config",
@@ -23,6 +20,7 @@
2320
"dependencies": {
2421
"@babel/core": "7.1.0",
2522
"@svgr/webpack": "2.4.1",
23+
"apollo-boost": "^0.1.16",
2624
"babel-core": "7.0.0-bridge.0",
2725
"babel-eslint": "9.0.0",
2826
"babel-jest": "23.6.0",
@@ -35,6 +33,7 @@
3533
"css-loader": "1.0.0",
3634
"dotenv": "6.0.0",
3735
"dotenv-expand": "4.2.0",
36+
"emotion": "^9.2.12",
3837
"eslint": "5.6.0",
3938
"eslint-config-react-app": "^3.0.3",
4039
"eslint-loader": "2.1.1",
@@ -44,6 +43,7 @@
4443
"eslint-plugin-react": "7.11.1",
4544
"file-loader": "2.0.0",
4645
"fs-extra": "7.0.0",
46+
"graphql": "^14.0.2",
4747
"html-webpack-plugin": "4.0.0-alpha.2",
4848
"identity-obj-proxy": "3.0.0",
4949
"jest": "23.6.0",
@@ -56,8 +56,10 @@
5656
"postcss-loader": "3.0.0",
5757
"postcss-preset-env": "6.0.6",
5858
"postcss-safe-parser": "4.0.1",
59+
"react-apollo": "^2.2.4",
5960
"react-app-polyfill": "^0.1.3",
6061
"react-dev-utils": "^6.0.4",
62+
"react-emotion": "^9.2.12",
6163
"resolve": "1.8.1",
6264
"sass-loader": "7.1.0",
6365
"style-loader": "0.23.0",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
REACT_APP_GRAPHQL_ENDPOINT="<GRAPHQL_ENDPOINT_URL>"

packages/react-scripts/template/src/App.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { Component } from 'react';
22
import logo from './logo.svg';
33
import './App.css';
4+
import styled from 'react-emotion';
45

56
class App extends Component {
67
render() {

packages/react-scripts/template/src/index.js

+13-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,20 @@ import ReactDOM from 'react-dom';
33
import './index.css';
44
import App from './App';
55
import * as serviceWorker from './serviceWorker';
6+
import ApolloClient from 'apollo-boost';
7+
import { ApolloProvider } from 'react-apollo';
68

7-
ReactDOM.render(<App />, document.getElementById('root'));
9+
const client = new ApolloClient({
10+
uri: `${process.env.REACT_APP_GRAPHQL_ENDPOINT}`,
11+
});
12+
13+
const WithApolloClient = () => (
14+
<ApolloProvider client={client}>
15+
<App />
16+
</ApolloProvider>
17+
);
18+
19+
ReactDOM.render(<WithApolloClient />, document.getElementById('root'));
820

921
// If you want your app to work offline and load faster, you can change
1022
// unregister() to register() below. Note this comes with some pitfalls.

0 commit comments

Comments
 (0)