From 9858c4f9d17cf82342546ea90d3aacb4558a234f Mon Sep 17 00:00:00 2001 From: James Danger Hycner Date: Fri, 7 Oct 2016 03:24:59 -0700 Subject: [PATCH 01/18] #765 - Work on removing publish feature flags. Removing copying files in cra.sh & release.sh (#861) --- config/paths.js | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/config/paths.js b/config/paths.js index 1d50c38b9f8..1c154c36164 100644 --- a/config/paths.js +++ b/config/paths.js @@ -70,17 +70,18 @@ module.exports = { }; // @remove-on-eject-end -// @remove-on-publish-begin -module.exports = { - appBuild: resolveOwn('../../../build'), - appPublic: resolveOwn('../template/public'), - appHtml: resolveOwn('../template/public/index.html'), - appIndexJs: resolveOwn('../template/src/index.js'), - appPackageJson: resolveOwn('../package.json'), - appSrc: resolveOwn('../template/src'), - testsSetup: resolveOwn('../template/src/setupTests.js'), - appNodeModules: resolveOwn('../node_modules'), - ownNodeModules: resolveOwn('../node_modules'), - nodePaths: nodePaths -}; -// @remove-on-publish-end +// config before publish: we're in ./packages/react-scripts/config/ +if (__dirname.indexOf(path.join('packages', 'react-scripts', 'config')) !== -1) { + module.exports = { + appBuild: resolveOwn('../../../build'), + appPublic: resolveOwn('../template/public'), + appHtml: resolveOwn('../template/public/index.html'), + appIndexJs: resolveOwn('../template/src/index.js'), + appPackageJson: resolveOwn('../package.json'), + appSrc: resolveOwn('../template/src'), + testsSetup: resolveOwn('../template/src/setupTests.js'), + appNodeModules: resolveOwn('../node_modules'), + ownNodeModules: resolveOwn('../node_modules'), + nodePaths: nodePaths + }; +} From 5fae2e194be2a0d44e64bf0ff93228974f862673 Mon Sep 17 00:00:00 2001 From: Patrick Dillon Date: Fri, 7 Oct 2016 10:12:53 -0400 Subject: [PATCH 02/18] Exit production build if any errors are in build stats (#859) * Exit on any errors passed in build stats * Match console error output in start.js --- scripts/build.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/scripts/build.js b/scripts/build.js index 4c61dc93ba7..d0b92f6a73b 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -118,13 +118,27 @@ function printFileSizes(stats, previousSizeMap) { }); } +// Print out errors +function printErrors(summary, errors) { + console.log(chalk.red(summary)); + console.log(); + errors.forEach(err => { + console.log(err.message || err); + console.log(); + }); +} + // Create the production build and print the deployment instructions. function build(previousSizeMap) { console.log('Creating an optimized production build...'); webpack(config).run((err, stats) => { if (err) { - console.error('Failed to create a production build. Reason:'); - console.error(err.message || err); + printErrors('Failed to compile.', [err]); + process.exit(1); + } + + if (stats.compilation.errors.length) { + printErrors('Failed to compile.', stats.compilation.errors); process.exit(1); } From 336e72881bcb70955dce36e20c99d13554476402 Mon Sep 17 00:00:00 2001 From: Chase Colman Date: Tue, 11 Oct 2016 07:38:12 -0400 Subject: [PATCH 03/18] Upgrade to Jest 16 (#858) * Update react-scripts dependencies to use jest 16 * Remove testRegex from Jest config (now default) --- package.json | 4 ++-- utils/createJestConfig.js | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 4ce1b4d4196..5b8c5540179 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "autoprefixer": "6.4.1", "babel-core": "6.14.0", "babel-eslint": "6.1.2", - "babel-jest": "15.0.0", + "babel-jest": "16.0.0", "babel-loader": "6.2.5", "babel-preset-react-app": "^0.2.1", "case-sensitive-paths-webpack-plugin": "1.1.4", @@ -51,7 +51,7 @@ "gzip-size": "3.0.0", "html-webpack-plugin": "2.22.0", "http-proxy-middleware": "0.17.1", - "jest": "15.1.1", + "jest": "16.0.1", "json-loader": "0.5.4", "object-assign": "4.1.0", "path-exists": "2.1.0", diff --git a/utils/createJestConfig.js b/utils/createJestConfig.js index 7eb9f9775c1..39c864ab8f4 100644 --- a/utils/createJestConfig.js +++ b/utils/createJestConfig.js @@ -27,7 +27,6 @@ module.exports = (resolve, rootDir, isEjecting) => { setupTestFrameworkScriptFile: setupTestsFile, testPathIgnorePatterns: ['/(build|docs|node_modules)/'], testEnvironment: 'node', - testRegex: '(/__tests__/.*|\\.(test|spec))\\.(js|jsx)$', }; if (rootDir) { config.rootDir = rootDir; From 7a67d64f032a7dd0968c63bad6cd66dc63247e1e Mon Sep 17 00:00:00 2001 From: Kanitkorn Sujautra Date: Tue, 11 Oct 2016 21:19:52 +0700 Subject: [PATCH 04/18] Create asset filenames mapping on the build output (#891) * Create asset filenames mapping on the build output I use danethurber/webpack-manifest-plugin on Webpack production configuration to create a file named `asset-manifest.json` which contain a mapping of all asset filenames to their corresponding output file. `asset-manifest.json` will be located at the root of output folder. This'll resolve #600 * Add an explanation for ManifestPlugin * Make webpack-manifest-plugin's version exact --- config/webpack.config.prod.js | 9 ++++++++- package.json | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/config/webpack.config.prod.js b/config/webpack.config.prod.js index 03fa1414471..fa787d43ea7 100644 --- a/config/webpack.config.prod.js +++ b/config/webpack.config.prod.js @@ -14,6 +14,7 @@ var autoprefixer = require('autoprefixer'); var webpack = require('webpack'); var HtmlWebpackPlugin = require('html-webpack-plugin'); var ExtractTextPlugin = require('extract-text-webpack-plugin'); +var ManifestPlugin = require('webpack-manifest-plugin'); var InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin'); var url = require('url'); var paths = require('./paths'); @@ -250,7 +251,13 @@ module.exports = { } }), // Note: this won't work without ExtractTextPlugin.extract(..) in `loaders`. - new ExtractTextPlugin('static/css/[name].[contenthash:8].css') + new ExtractTextPlugin('static/css/[name].[contenthash:8].css'), + // Generate a manifest file which contains a mapping of all asset filenames + // to their corresponding output file so that tools can pick it up without + // having to parse `index.html`. + new ManifestPlugin({ + fileName: 'asset-manifest.json' + }) ], // Some libraries import Node modules but don't use them in the browser. // Tell Webpack to provide empty mocks for them so importing them works. diff --git a/package.json b/package.json index 5b8c5540179..004ba9ee088 100644 --- a/package.json +++ b/package.json @@ -65,6 +65,7 @@ "url-loader": "0.5.7", "webpack": "1.13.2", "webpack-dev-server": "1.16.1", + "webpack-manifest-plugin": "1.0.1", "whatwg-fetch": "1.0.0" }, "devDependencies": { From e7a89d10469a5bc045335408464fcbd61c48c13e Mon Sep 17 00:00:00 2001 From: Mike Francis Date: Fri, 14 Oct 2016 12:37:14 +0100 Subject: [PATCH 05/18] Added note about env server restart (#903) * Added note about env server restart As discussed in [#870](https://github.com/facebookincubator/create-react-app/issues/870) * Style nit --- template/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/template/README.md b/template/README.md index 13f63c2e23f..268265bdb6d 100644 --- a/template/README.md +++ b/template/README.md @@ -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. From 86a5060cad55e8599dae3a61b544a1cabebe8bed Mon Sep 17 00:00:00 2001 From: Michael Scholtz Date: Mon, 17 Oct 2016 21:51:22 +0200 Subject: [PATCH 06/18] Fix Travis CI config in template README.md (#910) --- template/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/template/README.md b/template/README.md index 268265bdb6d..f364eda3824 100644 --- a/template/README.md +++ b/template/README.md @@ -802,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. From 1fbb1d325064cea4a5729e68677d4ac80f89f4b6 Mon Sep 17 00:00:00 2001 From: Nathan Hunzaker Date: Wed, 19 Oct 2016 05:19:12 -0400 Subject: [PATCH 07/18] PostCSS should run on @import statements. (#929) --- config/webpack.config.dev.js | 2 +- config/webpack.config.prod.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/webpack.config.dev.js b/config/webpack.config.dev.js index 8a8b59ed859..d875c63e8d9 100644 --- a/config/webpack.config.dev.js +++ b/config/webpack.config.dev.js @@ -137,7 +137,7 @@ module.exports = { // in development "style" loader enables hot editing of CSS. { test: /\.css$/, - loader: 'style!css!postcss' + loader: 'style!css?importLoaders=1!postcss' }, // JSON is not enabled by default in Webpack but both Node and Browserify // allow it implicitly so we also enable it. diff --git a/config/webpack.config.prod.js b/config/webpack.config.prod.js index fa787d43ea7..e0141b851b4 100644 --- a/config/webpack.config.prod.js +++ b/config/webpack.config.prod.js @@ -150,7 +150,7 @@ module.exports = { // Webpack 1.x uses Uglify plugin as a signal to minify *all* the assets // including CSS. This is confusing and will be removed in Webpack 2: // https://github.com/webpack/webpack/issues/283 - loader: ExtractTextPlugin.extract('style', 'css?-autoprefixer!postcss') + loader: ExtractTextPlugin.extract('style', 'css?importLoaders=1&-autoprefixer!postcss') // Note: this won't work without `new ExtractTextPlugin()` in `plugins`. }, // JSON is not enabled by default in Webpack but both Node and Browserify From 57105655a29710e54c60c270213b5c30d5637f32 Mon Sep 17 00:00:00 2001 From: Ville Immonen Date: Sat, 22 Oct 2016 22:36:15 +0300 Subject: [PATCH 08/18] Update dependencies (#945) * Update dependencies * Use published version of eslint-config-react-app for development We dogfood on our eslint-config-react-app by using it as our ESLint config, but installing it from the local folder causes problems when its peerDependencies are updated, because npm won't update it unless the version number changes. Use the published version for dogfooding so it can be installed from npm. --- package.json | 36 ++++++++++++++++++------------------ template/README.md | 2 +- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index 004ba9ee088..fb0ea4ebe82 100644 --- a/package.json +++ b/package.json @@ -23,39 +23,39 @@ "react-scripts": "./bin/react-scripts.js" }, "dependencies": { - "autoprefixer": "6.4.1", - "babel-core": "6.14.0", - "babel-eslint": "6.1.2", + "autoprefixer": "6.5.1", + "babel-core": "6.17.0", + "babel-eslint": "7.0.0", "babel-jest": "16.0.0", "babel-loader": "6.2.5", "babel-preset-react-app": "^0.2.1", "case-sensitive-paths-webpack-plugin": "1.1.4", "chalk": "1.1.3", "connect-history-api-fallback": "1.3.0", - "cross-spawn": "4.0.0", - "css-loader": "0.24.0", - "detect-port": "1.0.0", + "cross-spawn": "4.0.2", + "css-loader": "0.25.0", + "detect-port": "1.0.1", "dotenv": "2.0.0", - "eslint": "3.5.0", + "eslint": "3.8.1", "eslint-config-react-app": "^0.2.1", - "eslint-loader": "1.5.0", - "eslint-plugin-flowtype": "2.18.1", - "eslint-plugin-import": "1.12.0", - "eslint-plugin-jsx-a11y": "2.2.2", - "eslint-plugin-react": "6.3.0", + "eslint-loader": "1.6.0", + "eslint-plugin-flowtype": "2.21.0", + "eslint-plugin-import": "2.0.1", + "eslint-plugin-jsx-a11y": "2.2.3", + "eslint-plugin-react": "6.4.1", "extract-text-webpack-plugin": "1.0.1", "file-loader": "0.9.0", "filesize": "3.3.0", "find-cache-dir": "0.1.1", "fs-extra": "0.30.0", "gzip-size": "3.0.0", - "html-webpack-plugin": "2.22.0", - "http-proxy-middleware": "0.17.1", - "jest": "16.0.1", + "html-webpack-plugin": "2.24.0", + "http-proxy-middleware": "0.17.2", + "jest": "16.0.2", "json-loader": "0.5.4", "object-assign": "4.1.0", "path-exists": "2.1.0", - "postcss-loader": "0.13.0", + "postcss-loader": "1.0.0", "promise": "7.1.1", "react-dev-utils": "^0.2.1", "recursive-readdir": "2.1.0", @@ -64,8 +64,8 @@ "style-loader": "0.13.1", "url-loader": "0.5.7", "webpack": "1.13.2", - "webpack-dev-server": "1.16.1", - "webpack-manifest-plugin": "1.0.1", + "webpack-dev-server": "1.16.2", + "webpack-manifest-plugin": "1.1.0", "whatwg-fetch": "1.0.0" }, "devDependencies": { diff --git a/template/README.md b/template/README.md index f364eda3824..c9ecc7d84fb 100644 --- a/template/README.md +++ b/template/README.md @@ -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 eslint-plugin-jsx-a11y@2.2.2 eslint-plugin-flowtype@2.18.1 +npm install -g eslint-config-react-app@0.2.1 eslint@3.8.1 babel-eslint@7.0.0 eslint-plugin-react@6.4.1 eslint-plugin-import@2.0.1 eslint-plugin-jsx-a11y@2.2.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. From c702234a7c782f88de35f0e2f151e1c0901ec069 Mon Sep 17 00:00:00 2001 From: Ville Immonen Date: Sat, 22 Oct 2016 23:32:46 +0300 Subject: [PATCH 09/18] Update eslint-config-react-app version in the guide --- template/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/README.md b/template/README.md index c9ecc7d84fb..6f13b12d2e0 100644 --- a/template/README.md +++ b/template/README.md @@ -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.8.1 babel-eslint@7.0.0 eslint-plugin-react@6.4.1 eslint-plugin-import@2.0.1 eslint-plugin-jsx-a11y@2.2.3 eslint-plugin-flowtype@2.21.0 +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 eslint-plugin-jsx-a11y@2.2.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. From 80928b97e0a0af45428ca0314dd88dfd6895f441 Mon Sep 17 00:00:00 2001 From: Ville Immonen Date: Sat, 22 Oct 2016 23:49:30 +0300 Subject: [PATCH 10/18] Publish - babel-preset-react-app@1.0.0 - create-react-app@0.6.0 - eslint-config-react-app@0.3.0 - react-dev-utils@0.3.0 - react-scripts@0.7.0 --- package.json | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index fb0ea4ebe82..58bb4ab1d06 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-scripts", - "version": "0.6.1", + "version": "0.7.0", "description": "Configuration and scripts for Create React App.", "repository": "facebookincubator/create-react-app", "license": "BSD-3-Clause", @@ -28,7 +28,7 @@ "babel-eslint": "7.0.0", "babel-jest": "16.0.0", "babel-loader": "6.2.5", - "babel-preset-react-app": "^0.2.1", + "babel-preset-react-app": "^1.0.0", "case-sensitive-paths-webpack-plugin": "1.1.4", "chalk": "1.1.3", "connect-history-api-fallback": "1.3.0", @@ -37,7 +37,7 @@ "detect-port": "1.0.1", "dotenv": "2.0.0", "eslint": "3.8.1", - "eslint-config-react-app": "^0.2.1", + "eslint-config-react-app": "^0.3.0", "eslint-loader": "1.6.0", "eslint-plugin-flowtype": "2.21.0", "eslint-plugin-import": "2.0.1", @@ -57,7 +57,7 @@ "path-exists": "2.1.0", "postcss-loader": "1.0.0", "promise": "7.1.1", - "react-dev-utils": "^0.2.1", + "react-dev-utils": "^0.3.0", "recursive-readdir": "2.1.0", "rimraf": "2.5.4", "strip-ansi": "3.0.1", @@ -119,6 +119,7 @@ "url-loader", "webpack", "webpack-dev-server", + "webpack-manifest-plugin", "whatwg-fetch" ] } From a47271729c7a63e5c5d2e35e7a10490d87f727cd Mon Sep 17 00:00:00 2001 From: Fatih Date: Fri, 28 Oct 2016 15:41:51 +0300 Subject: [PATCH 11/18] Enable compression on webpack-dev-server (#966) (#968) --- scripts/start.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/start.js b/scripts/start.js index 8723c281637..8a115dd8e27 100644 --- a/scripts/start.js +++ b/scripts/start.js @@ -195,6 +195,8 @@ function addMiddleware(devServer) { function runDevServer(host, port, protocol) { var devServer = new WebpackDevServer(compiler, { + // Enable gzip compression of generated files. + compress: true, // Silence WebpackDevServer's own logs since they're generally not useful. // It will still show compile warnings and errors with this setting. clientLogLevel: 'none', From a9d4c892039d1d2842d14f8852bd6867eb1509c6 Mon Sep 17 00:00:00 2001 From: Swizec Teller Date: Fri, 28 Oct 2016 05:42:51 -0700 Subject: [PATCH 12/18] Gently nudge users towards https by default (#974) gh-pages supports https. It's important for prominent help files to encourage best practices. --- template/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/template/README.md b/template/README.md index 6f13b12d2e0..6bb93795bad 100644 --- a/template/README.md +++ b/template/README.md @@ -881,7 +881,7 @@ 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!**
@@ -889,7 +889,7 @@ Create React App uses the `homepage` field to determine the root URL in the buil 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 From 0df862857f23c9d985d52ed113800344db748edd Mon Sep 17 00:00:00 2001 From: Patrick Mackinder Date: Fri, 28 Oct 2016 13:47:08 +0100 Subject: [PATCH 13/18] Add collectCoverageFrom option to collect coverage on files without any tests. (#961) --- utils/createJestConfig.js | 1 + 1 file changed, 1 insertion(+) diff --git a/utils/createJestConfig.js b/utils/createJestConfig.js index 39c864ab8f4..17d414fc594 100644 --- a/utils/createJestConfig.js +++ b/utils/createJestConfig.js @@ -18,6 +18,7 @@ module.exports = (resolve, rootDir, isEjecting) => { const setupTestsFile = pathExists.sync(paths.testsSetup) ? '/src/setupTests.js' : undefined; const config = { + collectCoverageFrom: ['src/**/*.{js,jsx}'], moduleFileExtensions: ['jsx', 'js', 'json'], moduleNameMapper: { '^.+\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': resolve('config/jest/FileStub.js'), From 8f62d35d226c0e16daf3edefb3953c338e7a8bf0 Mon Sep 17 00:00:00 2001 From: David Ernst Date: Fri, 28 Oct 2016 05:51:06 -0700 Subject: [PATCH 14/18] Always build before deploying to gh-pages (#959) * Always build before deploying to gh-pages * Add line to gh-pages deploy docs about CNAME file * Remove spaces in npm run command for Windows * Grammar nit * Minor tweaks --- template/README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/template/README.md b/template/README.md index 6bb93795bad..788f77e7805 100644 --- a/template/README.md +++ b/template/README.md @@ -887,7 +887,7 @@ Open your `package.json` and add a `homepage` field: **The above step is important!**
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 [https://myusername.github.io/my-app](https://myusername.github.io/my-app), run: @@ -901,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). From b4816c7d29111a4516f016bab140e409962079c5 Mon Sep 17 00:00:00 2001 From: Vadzim Date: Fri, 28 Oct 2016 15:51:56 +0300 Subject: [PATCH 15/18] Fixes https://github.com/facebookincubator/create-react-app/issues/952 (#953) --- utils/createJestConfig.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/createJestConfig.js b/utils/createJestConfig.js index 17d414fc594..df0238f2587 100644 --- a/utils/createJestConfig.js +++ b/utils/createJestConfig.js @@ -21,7 +21,7 @@ module.exports = (resolve, rootDir, isEjecting) => { collectCoverageFrom: ['src/**/*.{js,jsx}'], moduleFileExtensions: ['jsx', 'js', 'json'], moduleNameMapper: { - '^.+\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': resolve('config/jest/FileStub.js'), + '^.+\\.(ico|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': resolve('config/jest/FileStub.js'), '^.+\\.css$': resolve('config/jest/CSSStub.js') }, setupFiles: [resolve('config/polyfills.js')], From 0ff92069f9640598f25ab99765ada2af8dab254e Mon Sep 17 00:00:00 2001 From: Alice Rose Date: Fri, 28 Oct 2016 14:54:56 +0200 Subject: [PATCH 16/18] Check for presence of folders before continuing eject. Closes #939. (#951) --- scripts/eject.js | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/scripts/eject.js b/scripts/eject.js index d14aec6abef..dbd4d64e4d5 100644 --- a/scripts/eject.js +++ b/scripts/eject.js @@ -30,6 +30,25 @@ prompt( var ownPath = path.join(__dirname, '..'); var appPath = path.join(ownPath, '..', '..'); + + function verifyAbsent(file) { + if (fs.existsSync(path.join(appPath, file))) { + console.error( + '`' + file + '` already exists in your app folder. We cannot ' + + 'continue as you would lose all the changes in that file or directory. ' + + 'Please move or delete it (maybe make a copy for backup) and run this ' + + 'command again.' + ); + process.exit(1); + } + } + + var folders = [ + 'config', + path.join('config', 'jest'), + 'scripts' + ]; + var files = [ path.join('config', 'env.js'), path.join('config', 'paths.js'), @@ -44,22 +63,13 @@ prompt( ]; // Ensure that the app folder is clean and we won't override any files - files.forEach(function(file) { - if (fs.existsSync(path.join(appPath, file))) { - console.error( - '`' + file + '` already exists in your app folder. We cannot ' + - 'continue as you would lose all the changes in that file or directory. ' + - 'Please delete it (maybe make a copy for backup) and run this ' + - 'command again.' - ); - process.exit(1); - } - }); + folders.forEach(verifyAbsent); + files.forEach(verifyAbsent); // Copy the files over - fs.mkdirSync(path.join(appPath, 'config')); - fs.mkdirSync(path.join(appPath, 'config', 'jest')); - fs.mkdirSync(path.join(appPath, 'scripts')); + folders.forEach(function(folder) { + fs.mkdirSync(path.join(appPath, folder)) + }); console.log(); console.log(cyan('Copying files into ' + appPath)); From 1372acfa51fee034494ed682d301f9202e0e2c59 Mon Sep 17 00:00:00 2001 From: Ville Immonen Date: Sat, 29 Oct 2016 21:00:16 +0200 Subject: [PATCH 17/18] Remove custom babel-loader cache dir config (#983) Upgrade `babel-loader` and remove the cache directory configuration that was added in #620. `babel-loader` now uses the `./node_modules/.cache/babel-loader` directory by default, so the custom config is no longer needed. --- config/webpack.config.dev.js | 10 +++------- package.json | 3 +-- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/config/webpack.config.dev.js b/config/webpack.config.dev.js index d875c63e8d9..c2b544cca54 100644 --- a/config/webpack.config.dev.js +++ b/config/webpack.config.dev.js @@ -12,7 +12,6 @@ var path = require('path'); var autoprefixer = require('autoprefixer'); var webpack = require('webpack'); -var findCacheDir = require('find-cache-dir'); var HtmlWebpackPlugin = require('html-webpack-plugin'); var CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin'); var InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin'); @@ -122,12 +121,9 @@ module.exports = { presets: [require.resolve('babel-preset-react-app')], // @remove-on-eject-end // This is a feature of `babel-loader` for webpack (not Babel itself). - // It enables caching results in ./node_modules/.cache/react-scripts/ - // directory for faster rebuilds. We use findCacheDir() because of: - // https://github.com/facebookincubator/create-react-app/issues/483 - cacheDirectory: findCacheDir({ - name: 'react-scripts' - }) + // It enables caching results in ./node_modules/.cache/babel-loader/ + // directory for faster rebuilds. + cacheDirectory: true } }, // "postcss" loader applies autoprefixer to our CSS. diff --git a/package.json b/package.json index 58bb4ab1d06..b4cad963979 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "babel-core": "6.17.0", "babel-eslint": "7.0.0", "babel-jest": "16.0.0", - "babel-loader": "6.2.5", + "babel-loader": "6.2.7", "babel-preset-react-app": "^1.0.0", "case-sensitive-paths-webpack-plugin": "1.1.4", "chalk": "1.1.3", @@ -46,7 +46,6 @@ "extract-text-webpack-plugin": "1.0.1", "file-loader": "0.9.0", "filesize": "3.3.0", - "find-cache-dir": "0.1.1", "fs-extra": "0.30.0", "gzip-size": "3.0.0", "html-webpack-plugin": "2.24.0", From bee627a3111952890ec692cc900baca488b5aaa2 Mon Sep 17 00:00:00 2001 From: Leo Wong Date: Tue, 1 Nov 2016 21:56:29 +0800 Subject: [PATCH 18/18] Remove redundant `function` from export statement (#996) --- template/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/README.md b/template/README.md index 788f77e7805..3203c5fcbb9 100644 --- a/template/README.md +++ b/template/README.md @@ -320,7 +320,7 @@ function Header() { return 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.