Skip to content

Commit 7cb5876

Browse files
Eric SimonsEric Simons
authored andcommitted
switch to create-react-app
1 parent 694153c commit 7cb5876

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+146
-110
lines changed

Notes

Lines changed: 0 additions & 13 deletions
This file was deleted.

README.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ To get the frontend running locally:
1515

1616
- Clone this repo
1717
- `npm install` to install all req'd dependencies
18-
- `npm run watch` to have webpack bundle the JS files into /bin/main.js, then run `npm start`
18+
- `npm start` to start the local server (this project uses create-react-app)
1919

2020
For convenience, we have a live API server running at https://conduit.productionready.io/api for the application to make requests against. You can view [the API spec here](https://github.com/GoThinkster/productionready/blob/master/API.md) which contains all routes & responses for the server. We'll release the backend code in a few weeks should anyone be interested in it.
2121

@@ -57,7 +57,7 @@ The example application is a social blogging site (i.e. a Medium.com clone) call
5757
5858
This project was bootstrapped with [Create React App](https://github.com/facebookincubator/create-react-app).
5959
60-
Below you will find some information on how to perform common tasks.
60+
Below you will find some information on how to perform common tasks.
6161
You can find the most recent version of this guide [here](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md).
6262
6363
## Table of Contents
@@ -156,13 +156,13 @@ For the project to build, **these files must exist with exact filenames**:
156156
157157
You can delete or rename the other files.
158158
159-
You may create subdirectories inside `src`. For faster rebuilds, only files inside `src` are processed by Webpack.
159+
You may create subdirectories inside `src`. For faster rebuilds, only files inside `src` are processed by Webpack.
160160
You need to **put any JS and CSS files inside `src`**, or Webpack won’t see them.
161161
162-
Only files inside `public` can be used from `public/index.html`.
162+
Only files inside `public` can be used from `public/index.html`.
163163
Read instructions below for using assets from JavaScript and HTML.
164164
165-
You can, however, create more top-level directories.
165+
You can, however, create more top-level directories.
166166
They will not be included in the production build so you can use them for things like documentation.
167167
168168
## Available Scripts
@@ -179,7 +179,7 @@ You will also see any lint errors in the console.
179179
180180
### `npm test`
181181
182-
Launches the test runner in the interactive watch mode.
182+
Launches the test runner in the interactive watch mode.
183183
See the section about [running tests](#running-tests) for more information.
184184
185185
### `npm run build`
@@ -245,7 +245,7 @@ npm install --save <library-name>
245245
246246
## Importing a Component
247247
248-
This project setup supports ES6 modules thanks to Babel.
248+
This project setup supports ES6 modules thanks to Babel.
249249
While you can still use `require()` and `module.exports`, we encourage you to use [`import` and `export`](http://exploringjs.com/es6/ch_modules.html) instead.
250250
251251
For example:
@@ -393,7 +393,7 @@ Webpack finds all relative module references in CSS (they start with `./`) and r
393393
394394
Please be advised that this is also a custom feature of Webpack.
395395
396-
**It is not required for React** but many people enjoy it (and React Native uses a similar mechanism for images).
396+
**It is not required for React** but many people enjoy it (and React Native uses a similar mechanism for images).
397397
An alternative way of handling static assets is described in the next section.
398398
399399
## Using the `public` Folder
@@ -418,7 +418,7 @@ Inside `index.html`, you can use it like this:
418418
419419
Only files inside the `public` folder will be accessible by `%PUBLIC_URL%` prefix. If you need to use a file from `src` or `node_modules`, you’ll have to copy it there to explicitly specify your intention to make this file a part of the build.
420420
421-
When you run `npm run build`, Create React App will substitute `%PUBLIC_URL%` with a correct absolute path so your project works even if you use client-side routing or host it at a non-root URL.
421+
When you run `npm run build`, Create React App will substitute `%PUBLIC_URL%` with a correct absolute path so your project works even if you use client-side routing or host it at a non-root URL.
422422
423423
In JavaScript code, you can use `process.env.PUBLIC_URL` for similar purposes:
424424
@@ -573,22 +573,22 @@ To define permanent environment vairables, create a file called `.env` in the ro
573573
REACT_APP_SECRET_CODE=abcdef
574574
```
575575
576-
These variables will act as the defaults if the machine does not explicitly set them.
576+
These variables will act as the defaults if the machine does not explicitly set them.
577577
Please refer to the [dotenv documentation](https://github.com/motdotla/dotenv) for more details.
578578
579579
>Note: If you are defining environment variables for development, your CI and/or hosting platform will most likely need
580580
these defined as well. Consult their documentation how to do this. For example, see the documentation for [Travis CI](https://docs.travis-ci.com/user/environment-variables/) or [Heroku](https://devcenter.heroku.com/articles/config-vars).
581581
582582
## Can I Use Decorators?
583583
584-
Many popular libraries use [decorators](https://medium.com/google-developers/exploring-es7-decorators-76ecb65fb841) in their documentation.
584+
Many popular libraries use [decorators](https://medium.com/google-developers/exploring-es7-decorators-76ecb65fb841) in their documentation.
585585
Create React App doesn’t support decorator syntax at the moment because:
586586
587587
* It is an experimental proposal and is subject to change.
588588
* The current specification version is not officially supported by Babel.
589589
* If the specification changes, we won’t be able to write a codemod because we don’t use them internally at Facebook.
590590
591-
However in many cases you can rewrite decorator-based code without decorators just as fine.
591+
However in many cases you can rewrite decorator-based code without decorators just as fine.
592592
Please refer to these two threads for reference:
593593
594594
* [#214](https://github.com/facebookincubator/create-react-app/issues/214)
@@ -604,7 +604,7 @@ Check out [this tutorial](https://www.fullstackreact.com/articles/using-create-r
604604
605605
>Note: this feature is available with `[email protected]` and higher.
606606
607-
People often serve the front-end React app from the same host and port as their backend implementation.
607+
People often serve the front-end React app from the same host and port as their backend implementation.
608608
For example, a production setup might look like this after the app is deployed:
609609
610610
```
@@ -631,7 +631,7 @@ Fetch API cannot load http://localhost:4000/api/todos. No 'Access-Control-Allow-
631631
632632
Keep in mind that `proxy` only has effect in development (with `npm start`), and it is up to you to ensure that URLs like `/api/todos` point to the right thing in production. You don’t have to use the `/api` prefix. Any unrecognized request without a `text/html` accept header will be redirected to the specified `proxy`.
633633
634-
Currently the `proxy` option only handles HTTP requests, and it won’t proxy WebSocket connections.
634+
Currently the `proxy` option only handles HTTP requests, and it won’t proxy WebSocket connections.
635635
If the `proxy` option is **not** flexible enough for you, alternatively you can:
636636
637637
* Enable CORS on your server ([here’s how to do it for Express](http://enable-cors.org/server_expressjs.html)).
@@ -679,7 +679,7 @@ If you use a Node server, you can even share the route matching logic between th
679679
680680
## Running Tests
681681
682-
>Note: this feature is available with `[email protected]` and higher.
682+
>Note: this feature is available with `[email protected]` and higher.
683683
>[Read the migration guide to learn how to enable it in older projects!](https://github.com/facebookincubator/create-react-app/blob/master/CHANGELOG.md#migrating-from-023-to-030)
684684
685685
Create React App uses [Jest](https://facebook.github.io/jest/) as its test runner. To prepare for this integration, we did a [major revamp](https://facebook.github.io/jest/blog/2016/09/01/jest-15.html) of Jest so if you heard bad things about it years ago, give it another try.
@@ -733,7 +733,7 @@ it('sums numbers', () => {
733733
});
734734
```
735735
736-
All `expect()` matchers supported by Jest are [extensively documented here](http://facebook.github.io/jest/docs/api.html#expect-value).
736+
All `expect()` matchers supported by Jest are [extensively documented here](http://facebook.github.io/jest/docs/api.html#expect-value).
737737
You can also use [`jest.fn()` and `expect(fn).toBeCalled()`](http://facebook.github.io/jest/docs/api.html#tobecalled) to create “spies” or mock functions.
738738
739739
### Testing Components
@@ -792,7 +792,7 @@ it('renders welcome message', () => {
792792
});
793793
```
794794
795-
All Jest matchers are [extensively documented here](http://facebook.github.io/jest/docs/api.html#expect-value).
795+
All Jest matchers are [extensively documented here](http://facebook.github.io/jest/docs/api.html#expect-value).
796796
Nevertheless you can use a third-party assertion library like Chai if you want to, as described below.
797797
798798
### Using Third Party Assertion Libraries
@@ -828,12 +828,12 @@ global.localStorage = localStorageMock
828828
829829
### Focusing and Excluding Tests
830830
831-
You can replace `it()` with `xit()` to temporarily exclude a test from being executed.
831+
You can replace `it()` with `xit()` to temporarily exclude a test from being executed.
832832
Similarly, `fit()` lets you focus on a specific test without running any other tests.
833833
834834
### Coverage Reporting
835835
836-
Jest has an integrated coverage reporter that works well with ES6 and requires no configuration.
836+
Jest has an integrated coverage reporter that works well with ES6 and requires no configuration.
837837
Run `npm test -- --coverage` (note extra `--` in the middle) to include a coverage report like this:
838838
839839
![coverage report](http://i.imgur.com/5bFhnTS.png)
@@ -894,7 +894,7 @@ By default, the `package.json` of the generated project looks like this:
894894
}
895895
```
896896
897-
If you know that none of your tests depend on [jsdom](https://github.com/tmpvar/jsdom), you can safely remove `--env=jsdom`, and your tests will run faster.
897+
If you know that none of your tests depend on [jsdom](https://github.com/tmpvar/jsdom), you can safely remove `--env=jsdom`, and your tests will run faster.
898898
To help you make up your mind, here is a list of APIs that **need jsdom**:
899899
900900
* Any browser globals like `window` and `document`
@@ -919,7 +919,7 @@ This feature is experimental and still [has major usage issues](https://github.c
919919
920920
## Building for Relative Paths
921921
922-
By default, Create React App produces a build assuming your app is hosted at the server root.
922+
By default, Create React App produces a build assuming your app is hosted at the server root.
923923
To override this, specify the `homepage` in your `package.json`, for example:
924924
925925
```js
@@ -938,7 +938,7 @@ Open your `package.json` and add a `homepage` field:
938938
"homepage": "http://myusername.github.io/my-app",
939939
```
940940
941-
**The above step is important!**
941+
**The above step is important!**
942942
Create React App uses the `homepage` field to determine the root URL in the built HTML file.
943943
944944
Now, whenever you run `npm run build`, you will see a cheat sheet with a sequence of commands to deploy to GitHub pages:
@@ -961,7 +961,7 @@ Note that GitHub Pages doesn't support routers that use the HTML5 `pushState` hi
961961
962962
### Heroku
963963
964-
Use the [Heroku Buildpack for Create React App](https://github.com/mars/create-react-app-buildpack).
964+
Use the [Heroku Buildpack for Create React App](https://github.com/mars/create-react-app-buildpack).
965965
You can find instructions in [Deploying React with Zero Configuration](https://blog.heroku.com/deploying-react-with-zero-configuration).
966966
967967
### Modulus

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"react-redux": "^4.4.5",
1414
"react-router": "^2.8.1",
1515
"redux": "^3.6.0",
16+
"redux-logger": "^2.7.4",
1617
"superagent": "^2.3.0",
1718
"superagent-promise": "^1.1.0"
1819
},

src/agent.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict';
2+
13
import superagentPromise from 'superagent-promise';
24
import _superagent from 'superagent';
35

src/components/App.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1+
import agent from '../agent';
2+
import Header from './Header';
13
import React from 'react';
24
import { connect } from 'react-redux';
35

4-
import Header from './Header';
5-
import agent from '../agent';
6-
76
const mapStateToProps = state => ({
87
appLoaded: state.common.appLoaded,
98
appName: state.common.appName,

src/components/Article/ArticleActions.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import React from 'react';
2-
import { connect } from 'react-redux';
31
import { Link } from 'react-router';
4-
2+
import React from 'react';
53
import agent from '../../agent';
4+
import { connect } from 'react-redux';
65

76
const mapDispatchToProps = dispatch => ({
87
onClickDelete: payload =>

src/components/Article/ArticleMeta.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import React from 'react';
2-
import { Link } from 'react-router';
3-
41
import ArticleActions from './ArticleActions';
2+
import { Link } from 'react-router';
3+
import React from 'react';
54

65
const ArticleMeta = props => {
76
const article = props.article;

src/components/Article/Comment.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import React from 'react';
2-
import { Link } from 'react-router';
3-
41
import DeleteButton from './DeleteButton';
2+
import { Link } from 'react-router';
3+
import React from 'react';
54

65
const Comment = props => {
76
const comment = props.comment;

src/components/Article/CommentContainer.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import React from 'react';
2-
import { Link } from 'react-router';
3-
41
import CommentInput from './CommentInput';
52
import CommentList from './CommentList';
3+
import { Link } from 'react-router';
4+
import React from 'react';
65

76
const CommentContainer = props => {
87
if (props.currentUser) {

src/components/Article/CommentInput.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React from 'react';
2-
import { connect } from 'react-redux';
3-
42
import agent from '../../agent';
3+
import { connect } from 'react-redux';
54

65
const mapDispatchToProps = dispatch => ({
76
onSubmit: payload =>

0 commit comments

Comments
 (0)