forked from kitze/custom-react-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/facebookincubator/create-…
…react-app # By Ville Immonen (11) and others # Via Dan Abramov * 'master' of https://github.com/facebookincubator/create-react-app: (39 commits) Remove redundant `function` from export statement (facebook#996) Add Gatsby to alternatives (facebook#995) Allow webpack 2 as peerDependency in react-dev-utils (facebook#963) Remove custom babel-loader cache dir config (facebook#983) Check for presence of folders before continuing eject. Closes facebook#939. (facebook#951) Fixes facebook#952 (facebook#953) Always build before deploying to gh-pages (facebook#959) Add collectCoverageFrom option to collect coverage on files without any tests. (facebook#961) Catch and noop call to open web browser. (facebook#964) Gently nudge users towards https by default (facebook#974) Enable compression on webpack-dev-server (facebook#966) (facebook#968) Add next.js to Alternatives Point people to npm Windows instructions Encourage people to try recent npm Fix an attribution link in 0.7.0 changelog Update CLI version in changelog Publish Update eslint-config-react-app version in the guide Update changelog for 0.7.0 Revert "Temporarily remove 0.7.0 changelog as it's not out yet" ... Conflicts: packages/babel-preset-react-app/package.json packages/create-react-app/package.json packages/eslint-config-react-app/package.json packages/react-dev-utils/package.json packages/react-scripts/config/webpack.config.dev.js packages/react-scripts/config/webpack.config.prod.js packages/react-scripts/package.json
- Loading branch information
Showing
9 changed files
with
113 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -174,7 +174,7 @@ Then add this block to the `package.json` file of your project: | |
Finally, you will need to install some packages *globally*: | ||
|
||
```sh | ||
npm install -g eslint-config-react-app@0.2.1 eslint@3.5.0 babel-eslint@6.1.2 eslint-plugin-react@6.3.0 eslint-plugin-import@1.12.0 [email protected].2 eslint-plugin-flowtype@2.18.1 | ||
npm install -g eslint-config-react-app@0.3.0 eslint@3.8.1 babel-eslint@7.0.0 eslint-plugin-react@6.4.1 eslint-plugin-import@2.0.1 [email protected].3 eslint-plugin-flowtype@2.21.0 | ||
``` | ||
|
||
We recognize that this is suboptimal, but it is currently required due to the way we hide the ESLint dependency. The ESLint team is already [working on a solution to this](https://github.com/eslint/eslint/issues/3458) so this may become unnecessary in a couple of months. | ||
|
@@ -320,7 +320,7 @@ function Header() { | |
return <img src={logo} alt="Logo" />; | ||
} | ||
|
||
export default function Header; | ||
export default Header; | ||
``` | ||
|
||
This ensures that when the project is built, Webpack will correctly move the images into the build folder, and provide us with correct paths. | ||
|
@@ -444,6 +444,8 @@ default you will have `NODE_ENV` defined for you, and any other environment vari | |
variable named `REACT_APP_SECRET_CODE` will be exposed in your JS as `process.env.REACT_APP_SECRET_CODE`, in addition | ||
to `process.env.NODE_ENV`. | ||
>Note: Changing any environment variables will require you to restart the development server if it is running. | ||
These environment variables can be useful for displaying information conditionally based on where the project is | ||
deployed or consuming sensitive data that lives outside of version control. | ||
|
@@ -800,8 +802,8 @@ node_js: | |
- 6 | ||
cache: | ||
directories: | ||
- node_modules | ||
script | ||
- node_modules | ||
script: | ||
- npm test | ||
``` | ||
1. Trigger your first build with a git push. | ||
|
@@ -879,15 +881,15 @@ This will let Create React App correctly infer the root path to use in the gener | |
Open your `package.json` and add a `homepage` field: | ||
```js | ||
"homepage": "http://myusername.github.io/my-app", | ||
"homepage": "https://myusername.github.io/my-app", | ||
``` | ||
**The above step is important!**<br> | ||
Create React App uses the `homepage` field to determine the root URL in the built HTML file. | ||
Now, whenever you run `npm run build`, you will see a cheat sheet with instructions on how to deploy to GitHub pages. | ||
Now, whenever you run `npm run build`, you will see a cheat sheet with instructions on how to deploy to GitHub Pages. | ||
To publish it at [http://myusername.github.io/my-app](http://myusername.github.io/my-app), run: | ||
To publish it at [https://myusername.github.io/my-app](https://myusername.github.io/my-app), run: | ||
```sh | ||
npm install --save-dev gh-pages | ||
|
@@ -899,16 +901,20 @@ Add the following script in your `package.json`: | |
// ... | ||
"scripts": { | ||
// ... | ||
"deploy": "gh-pages -d build" | ||
"deploy": "npm run build&&gh-pages -d build" | ||
} | ||
``` | ||
(Note: the lack of whitespace is intentional.) | ||
Then run: | ||
```sh | ||
npm run deploy | ||
``` | ||
You can configure a custom domain with GitHub Pages by adding a `CNAME` file to the `public/` folder. | ||
Note that GitHub Pages doesn't support routers that use the HTML5 `pushState` history API under the hood (for example, React Router using `browserHistory`). This is because when there is a fresh page load for a url like `http://user.github.io/todomvc/todos/42`, where `/todos/42` is a frontend route, the GitHub Pages server returns 404 because it knows nothing of `/todos/42`. If you want to add a router to a project hosted on GitHub Pages, here are a couple of solutions: | ||
* You could switch from using HTML5 history API to routing with hashes. If you use React Router, you can switch to `hashHistory` for this effect, but the URL will be longer and more verbose (for example, `http://user.github.io/todomvc/#/todos/42?_k=yknaj`). [Read more](https://github.com/reactjs/react-router/blob/master/docs/guides/Histories.md#histories) about different history implementations in React Router. | ||
* Alternatively, you can use a trick to teach GitHub Pages to handle 404 by redirecting to your `index.html` page with a special redirect parameter. You would need to add a `404.html` file with the redirection code to the `build` folder before deploying your project, and you’ll need to add code handling the redirect parameter to `index.html`. You can find a detailed explanation of this technique [in this guide](https://github.com/rafrex/spa-github-pages). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters