From ad57c457fa4cf162f67ce6b4b7d2a0f8b580d42a Mon Sep 17 00:00:00 2001 From: Alexis Kofman Date: Fri, 7 Oct 2016 11:49:58 +0200 Subject: [PATCH 01/39] Bump babel-plugin-transform-regenerator (#864) --- packages/babel-preset-react-app/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/babel-preset-react-app/package.json b/packages/babel-preset-react-app/package.json index f0ead1f3b50..9210fc83c47 100644 --- a/packages/babel-preset-react-app/package.json +++ b/packages/babel-preset-react-app/package.json @@ -16,7 +16,7 @@ "babel-plugin-transform-react-constant-elements": "6.9.1", "babel-plugin-transform-react-jsx-self": "6.11.0", "babel-plugin-transform-react-jsx-source": "6.9.0", - "babel-plugin-transform-regenerator": "6.14.0", + "babel-plugin-transform-regenerator": "6.16.1", "babel-plugin-transform-runtime": "6.15.0", "babel-preset-latest": "6.14.0", "babel-preset-react": "6.11.1", From 90ce8abfa6285ae802fa9d2446066a5b38684ccb Mon Sep 17 00:00:00 2001 From: James Danger Hycner Date: Fri, 7 Oct 2016 03:24:59 -0700 Subject: [PATCH 02/39] #765 - Work on removing publish feature flags. Removing copying files in cra.sh & release.sh (#861) --- packages/react-scripts/config/paths.js | 29 ++++++++++++----------- tasks/cra.sh | 32 +++----------------------- tasks/release.sh | 28 ++-------------------- 3 files changed, 20 insertions(+), 69 deletions(-) diff --git a/packages/react-scripts/config/paths.js b/packages/react-scripts/config/paths.js index 1d50c38b9f8..1c154c36164 100644 --- a/packages/react-scripts/config/paths.js +++ b/packages/react-scripts/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 + }; +} diff --git a/tasks/cra.sh b/tasks/cra.sh index 9b25885457b..c4d9e42bd03 100755 --- a/tasks/cra.sh +++ b/tasks/cra.sh @@ -16,10 +16,8 @@ cd "$(dirname "$0")" function cleanup { echo 'Cleaning up.' - cd $root_path # Uncomment when snapshot testing is enabled by default: # rm ./template/src/__snapshots__/App.test.js.snap - rm -rf $clean_path } # Error messages are redirected to stderr @@ -53,41 +51,17 @@ root_path=$PWD # Pack react-scripts so we can verify they work. # ****************************************************************************** -# Packing react-scripts takes some work because we want to clean it up first. -# Create a temporary clean folder that contains production only code. -# Do not overwrite any files in the current folder. -clean_path=`mktemp -d 2>/dev/null || mktemp -d -t 'clean_path'` - -# Copy some of the react-scripts project files to the temporary folder. -# Exclude folders that definitely won’t be part of the package from processing. -# We will strip the dev-only code there, `npm pack`, and copy the package back. -cd $root_path -rsync -av --exclude='.git' --exclude=$clean_path\ - --exclude='node_modules' --exclude='build'\ - './' $clean_path >/dev/null - -# Open the clean folder -cd $clean_path/packages/react-scripts - -# Now remove all the code relevant to development of Create React App. -files="$(find -L . -name "*.js" -type f)" -for file in $files; do - sed -i.bak '/\/\/ @remove-on-publish-begin/,/\/\/ @remove-on-publish-end/d' $file - rm $file.bak -done - # Install all our packages -cd $clean_path $root_path/node_modules/.bin/lerna bootstrap -cd $clean_path/packages/react-scripts +cd packages/react-scripts # Like bundle-deps, this script modifies packages/react-scripts/package.json, # copying own dependencies (those in the `packages` dir) to bundledDependencies -node $clean_path/tasks/bundle-own-deps.js +node $root_path/tasks/bundle-own-deps.js # Finally, pack react-scripts -scripts_path=$clean_path/packages/react-scripts/`npm pack` +scripts_path=$root_path/packages/react-scripts/`npm pack` # ****************************************************************************** # Now that we have packed them, call the global CLI. diff --git a/tasks/release.sh b/tasks/release.sh index 8177688c4c0..14b5cb77b18 100755 --- a/tasks/release.sh +++ b/tasks/release.sh @@ -39,25 +39,6 @@ if [ -n "$(git status --porcelain)" ]; then exit 1; fi -# Create a temporary clean folder that contains production only code. -# Do not overwrite any files in the current folder. -clean_path=`mktemp -d 2>/dev/null || mktemp -d -t 'clean_path'` - -# Copy some of the project files to the temporary folder. -# Exclude folders that definitely won’t be part of the package from processing. -# We will strip the dev-only code there, and publish from it. -rsync -av --exclude=$clean_path\ - --exclude='node_modules' --exclude='build'\ - './' $clean_path >/dev/null -cd $clean_path - -# Now remove all the code relevant to development of Create React App. -files="$(find -L . -name "*.js" -type f)" -for file in $files; do - sed -i.bak '/\/\/ @remove-on-publish-begin/,/\/\/ @remove-on-publish-end/d' $file - rm $file.bak -done - # Update deps rm -rf node_modules rm -rf ~/.npm @@ -72,14 +53,9 @@ npm dedupe # Since it's in optionalDependencies, it will attempt install outside bundle rm -rf node_modules/fsevents -# This modifies $clean_path/package.json to copy all dependencies to bundledDependencies +# This modifies package.json to copy all dependencies to bundledDependencies node ./node_modules/.bin/bundle-deps -cd $clean_path - +cd $root_path # Go! ./node_modules/.bin/lerna publish --independent "$@" - -# cleanup -cd .. -rm -rf $clean_path From 410a6a957a7ce65a7ccdf22809277c456e06c60b Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Fri, 7 Oct 2016 12:05:35 +0100 Subject: [PATCH 03/39] Clean up e2e script (#867) * Clean up e2e script * Link to local packages after ejecting --- tasks/cra.sh | 8 ++++++++ tasks/e2e.sh | 52 ++++++++++++++++------------------------------------ 2 files changed, 24 insertions(+), 36 deletions(-) diff --git a/tasks/cra.sh b/tasks/cra.sh index c4d9e42bd03..0271536d706 100755 --- a/tasks/cra.sh +++ b/tasks/cra.sh @@ -56,6 +56,9 @@ $root_path/node_modules/.bin/lerna bootstrap cd packages/react-scripts +# Save package.json because we're going to touch it +cp package.json package.json.orig + # Like bundle-deps, this script modifies packages/react-scripts/package.json, # copying own dependencies (those in the `packages` dir) to bundledDependencies node $root_path/tasks/bundle-own-deps.js @@ -63,6 +66,11 @@ node $root_path/tasks/bundle-own-deps.js # Finally, pack react-scripts scripts_path=$root_path/packages/react-scripts/`npm pack` +# Restore package.json +rm package.json +mv package.json.orig package.json + + # ****************************************************************************** # Now that we have packed them, call the global CLI. # ****************************************************************************** diff --git a/tasks/e2e.sh b/tasks/e2e.sh index 22d36b488a0..88e1fdf4e20 100755 --- a/tasks/e2e.sh +++ b/tasks/e2e.sh @@ -19,7 +19,7 @@ function cleanup { cd $root_path # Uncomment when snapshot testing is enabled by default: # rm ./packages/react-scripts/template/src/__snapshots__/App.test.js.snap - rm -rf $temp_cli_path $temp_app_path $clean_path + rm -rf $temp_cli_path $temp_app_path } # Error messages are redirected to stderr @@ -53,7 +53,9 @@ set -x cd .. root_path=$PWD -# Lint +npm install + +# Lint own code ./node_modules/.bin/eslint --ignore-path .gitignore ./ # ****************************************************************************** @@ -61,8 +63,6 @@ root_path=$PWD # This does not affect our users but makes sure we can develop it. # ****************************************************************************** -npm install - # Test local build command npm run build # Check for expected output @@ -84,45 +84,19 @@ npm start -- --smoke-test # Next, pack react-scripts and create-react-app so we can verify they work. # ****************************************************************************** -# Pack CLI (it doesn't need cleaning) +# Pack CLI cd $root_path/packages/create-react-app cli_path=$PWD/`npm pack` -# Packing react-scripts takes more work because we want to clean it up first. -# Create a temporary clean folder that contains production only code. -# Do not overwrite any files in the current folder. -clean_path=`mktemp -d 2>/dev/null || mktemp -d -t 'clean_path'` - -# Copy some of the react-scripts project files to the temporary folder. -# Exclude folders that definitely won’t be part of the package from processing. -# We will strip the dev-only code there, `npm pack`, and copy the package back. -cd $root_path -rsync -av --exclude='.git' --exclude=$clean_path\ - --exclude='node_modules' --exclude='build'\ - './' $clean_path >/dev/null - -# Open the clean folder -cd $clean_path/packages/react-scripts - -# Now remove all the code relevant to development of Create React App. -files="$(find -L . -name "*.js" -type f)" -for file in $files; do - sed -i.bak '/\/\/ @remove-on-publish-begin/,/\/\/ @remove-on-publish-end/d' $file - rm $file.bak -done - -# Install all our packages -cd $clean_path -$root_path/node_modules/.bin/lerna bootstrap - -cd $clean_path/packages/react-scripts +# Go to react-scripts +cd $root_path/packages/react-scripts # Like bundle-deps, this script modifies packages/react-scripts/package.json, # copying own dependencies (those in the `packages` dir) to bundledDependencies -node $clean_path/tasks/bundle-own-deps.js +node $root_path/tasks/bundle-own-deps.js # Finally, pack react-scripts -scripts_path=$clean_path/packages/react-scripts/`npm pack` +scripts_path=$root_path/packages/react-scripts/`npm pack` # ****************************************************************************** # Now that we have packed them, create a clean app folder and install them. @@ -168,9 +142,15 @@ npm start -- --smoke-test # Finally, let's check that everything still works after ejecting. # ****************************************************************************** -# Eject +# Eject... echo yes | npm run eject +# ...but still link to the local packages +npm link $root_path/packages/babel-preset-react-app +npm link $root_path/packages/eslint-config-react-app +npm link $root_path/packages/react-dev-utils +npm link $root_path/packages/react-scripts + # Test the build npm run build # Check for expected output From c6428eaff91fd8dc71e20e9a3f6f38106f08ab7c Mon Sep 17 00:00:00 2001 From: Patrick Dillon Date: Fri, 7 Oct 2016 10:12:53 -0400 Subject: [PATCH 04/39] 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 --- packages/react-scripts/scripts/build.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/packages/react-scripts/scripts/build.js b/packages/react-scripts/scripts/build.js index 4c61dc93ba7..d0b92f6a73b 100644 --- a/packages/react-scripts/scripts/build.js +++ b/packages/react-scripts/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 351e449ef0e9e618a05b5083a78b3fda76f4b920 Mon Sep 17 00:00:00 2001 From: Shubheksha Jalan Date: Tue, 11 Oct 2016 16:55:43 +0530 Subject: [PATCH 05/39] Disable ES2015 transforms based on node version using babel-preset-env (#878) * Disable ES2015 transforms based on node version using babel-preset-env * pass major version number for node to babel-preset-env instead of version string * use parseFloat() instead of parseInt() to parse node version * fixed style nits --- packages/babel-preset-react-app/index.js | 62 +++++++++++++------- packages/babel-preset-react-app/package.json | 1 + 2 files changed, 42 insertions(+), 21 deletions(-) diff --git a/packages/babel-preset-react-app/index.js b/packages/babel-preset-react-app/index.js index 34e9efabb72..d3063aee304 100644 --- a/packages/babel-preset-react-app/index.js +++ b/packages/babel-preset-react-app/index.js @@ -10,14 +10,7 @@ var path = require('path'); -module.exports = { - presets: [ - // Latest stable ECMAScript features - require.resolve('babel-preset-latest'), - // JSX, Flow - require.resolve('babel-preset-react') - ], - plugins: [ +const plugins = [ // class { handleClick = () => { } } require.resolve('babel-plugin-transform-class-properties'), // { ...todo, completed: true } @@ -35,8 +28,7 @@ module.exports = { // Resolve the Babel runtime relative to the config. moduleName: path.dirname(require.resolve('babel-runtime/package')) }] - ] -}; + ]; // This is similar to how `env` works in Babel: // https://babeljs.io/docs/usage/babelrc/#env-option @@ -52,7 +44,7 @@ if (env !== 'development' && env !== 'test' && env !== 'production') { '"test", and "production". Instead, received: ' + JSON.stringify(env) + '.' ); } -var plugins = module.exports.plugins; + if (env === 'development' || env === 'test') { plugins.push.apply(plugins, [ // Adds component stack to warning messages @@ -61,14 +53,42 @@ if (env === 'development' || env === 'test') { require.resolve('babel-plugin-transform-react-jsx-self') ]); } -if (env === 'production') { - // Optimization: hoist JSX that never changes out of render() - // Disabled because of issues: - // * https://github.com/facebookincubator/create-react-app/issues/525 - // * https://phabricator.babeljs.io/search/query/pCNlnC2xzwzx/ - // * https://github.com/babel/babel/issues/4516 - // TODO: Enable again when these issues are resolved. - // plugins.push.apply(plugins, [ - // require.resolve('babel-plugin-transform-react-constant-elements') - // ]); + +if (env === 'test') { + module.exports = { + presets: [ + // ES features necessary for user's Node version + [require('babel-preset-env').default, { + targets: { + node: parseFloat(process.versions.node), + }, + }], + // JSX, Flow + require.resolve('babel-preset-react') + ], + plugins: plugins + }; +} else { + module.exports = { + presets: [ + // Latest stable ECMAScript features + require.resolve('babel-preset-latest'), + // JSX, Flow + require.resolve('babel-preset-react') + ], + plugins: plugins + }; + + if (env === 'production') { + // Optimization: hoist JSX that never changes out of render() + // Disabled because of issues: + // * https://github.com/facebookincubator/create-react-app/issues/525 + // * https://phabricator.babeljs.io/search/query/pCNlnC2xzwzx/ + // * https://github.com/babel/babel/issues/4516 + // TODO: Enable again when these issues are resolved. + // plugins.push.apply(plugins, [ + // require.resolve('babel-plugin-transform-react-constant-elements') + // ]); + } } + diff --git a/packages/babel-preset-react-app/package.json b/packages/babel-preset-react-app/package.json index 9210fc83c47..bd1db0f5722 100644 --- a/packages/babel-preset-react-app/package.json +++ b/packages/babel-preset-react-app/package.json @@ -18,6 +18,7 @@ "babel-plugin-transform-react-jsx-source": "6.9.0", "babel-plugin-transform-regenerator": "6.16.1", "babel-plugin-transform-runtime": "6.15.0", + "babel-preset-env": "0.0.4", "babel-preset-latest": "6.14.0", "babel-preset-react": "6.11.1", "babel-runtime": "6.11.6" From 3539d0401aeb84a1126a16ee9e765fecb0b11a51 Mon Sep 17 00:00:00 2001 From: Chase Colman Date: Tue, 11 Oct 2016 07:38:12 -0400 Subject: [PATCH 06/39] Upgrade to Jest 16 (#858) * Update react-scripts dependencies to use jest 16 * Remove testRegex from Jest config (now default) --- packages/react-scripts/package.json | 4 ++-- packages/react-scripts/utils/createJestConfig.js | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/react-scripts/package.json b/packages/react-scripts/package.json index 4ce1b4d4196..5b8c5540179 100644 --- a/packages/react-scripts/package.json +++ b/packages/react-scripts/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/packages/react-scripts/utils/createJestConfig.js b/packages/react-scripts/utils/createJestConfig.js index 7eb9f9775c1..39c864ab8f4 100644 --- a/packages/react-scripts/utils/createJestConfig.js +++ b/packages/react-scripts/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 1359cc492cbc83d74f2382e3c22b0965c215e9a3 Mon Sep 17 00:00:00 2001 From: Patrick Dillon Date: Tue, 11 Oct 2016 07:38:45 -0400 Subject: [PATCH 07/39] Support passing scoped package names to --scripts-version arg (#826) * Support passing scoped package names to --scripts-version arg * Factor out bitwise operator in indexOf test * Comment on stripping only version or tag from package name arg --- packages/create-react-app/index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/create-react-app/index.js b/packages/create-react-app/index.js index 02f9de254a0..1ea4f108cc0 100644 --- a/packages/create-react-app/index.js +++ b/packages/create-react-app/index.js @@ -152,10 +152,11 @@ function getInstallPackage(version) { // Extract package name from tarball url or path. function getPackageName(installPackage) { - if (~installPackage.indexOf('.tgz')) { + if (installPackage.indexOf('.tgz') > -1) { return installPackage.match(/^.+\/(.+)-.+\.tgz$/)[1]; - } else if (~installPackage.indexOf('@')) { - return installPackage.split('@')[0]; + } else if (installPackage.indexOf('@') > 0) { + // Do not match @scope/ when stripping off @version or @tag + return installPackage.charAt(0) + installPackage.substr(1).split('@')[0]; } return installPackage; } From 4e5a561d98342f2425a8c0ee63b4c683c6b46c25 Mon Sep 17 00:00:00 2001 From: Jarle Friestad Date: Tue, 11 Oct 2016 13:44:58 +0200 Subject: [PATCH 08/39] Dispose error overlay when linting errors have been corrected (#856) * Dispose error overlay when linting errors have been corrected * Fixed spelling error * Minor style tweaks --- packages/react-dev-utils/webpackHotDevClient.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/react-dev-utils/webpackHotDevClient.js b/packages/react-dev-utils/webpackHotDevClient.js index eebf6c0a254..f15fd06f291 100644 --- a/packages/react-dev-utils/webpackHotDevClient.js +++ b/packages/react-dev-utils/webpackHotDevClient.js @@ -123,6 +123,19 @@ function showErrorOverlay(message) { }); } +function destroyErrorOverlay() { + if (!overlayDiv) { + // It is not there in the first place. + return; + } + + // Clean up and reset internal state. + document.body.removeChild(overlayIframe); + overlayDiv = null; + overlayIframe = null; + lastOnOverlayDivReady = null; +} + // Connect to WebpackDevServer via a socket. var connection = new SockJS(url.format({ protocol: window.location.protocol, @@ -156,6 +169,7 @@ function clearOutdatedErrors() { // Successful compilation. function handleSuccess() { clearOutdatedErrors(); + destroyErrorOverlay(); var isHotUpdate = !isFirstCompilation; isFirstCompilation = false; @@ -170,6 +184,7 @@ function handleSuccess() { // Compilation with warnings (e.g. ESLint). function handleWarnings(warnings) { clearOutdatedErrors(); + destroyErrorOverlay(); var isHotUpdate = !isFirstCompilation; isFirstCompilation = false; From 88c15d0988fcb456fc976cbe15823ed518470126 Mon Sep 17 00:00:00 2001 From: Kanitkorn Sujautra Date: Tue, 11 Oct 2016 21:19:52 +0700 Subject: [PATCH 09/39] 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 --- packages/react-scripts/config/webpack.config.prod.js | 9 ++++++++- packages/react-scripts/package.json | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/react-scripts/config/webpack.config.prod.js b/packages/react-scripts/config/webpack.config.prod.js index 03fa1414471..fa787d43ea7 100644 --- a/packages/react-scripts/config/webpack.config.prod.js +++ b/packages/react-scripts/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/packages/react-scripts/package.json b/packages/react-scripts/package.json index 5b8c5540179..004ba9ee088 100644 --- a/packages/react-scripts/package.json +++ b/packages/react-scripts/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 c5f5b006d83316b3c016adc41b95c28912ecdda8 Mon Sep 17 00:00:00 2001 From: Jih-Chi Lee Date: Wed, 12 Oct 2016 20:46:14 +0800 Subject: [PATCH 10/39] Fix using pre-release tags with a tarball url in `--scripts-version` (#876) * Add supports for prelease tags version * Add comment to regex * Cut everything after the first -\d * Make semver version optional, so just package name get parsed correctly --- packages/create-react-app/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/create-react-app/index.js b/packages/create-react-app/index.js index 1ea4f108cc0..d6478a13545 100644 --- a/packages/create-react-app/index.js +++ b/packages/create-react-app/index.js @@ -153,7 +153,9 @@ function getInstallPackage(version) { // Extract package name from tarball url or path. function getPackageName(installPackage) { if (installPackage.indexOf('.tgz') > -1) { - return installPackage.match(/^.+\/(.+)-.+\.tgz$/)[1]; + // The package name could be with or without semver version, e.g. react-scripts-0.2.0-alpha.1.tgz + // However, this function returns package name only wihout semver version. + return installPackage.match(/^.+\/(.+?)(?:-\d+.+)?\.tgz$/)[1]; } else if (installPackage.indexOf('@') > 0) { // Do not match @scope/ when stripping off @version or @tag return installPackage.charAt(0) + installPackage.substr(1).split('@')[0]; From e9950db9ff236859d9f1a6456903e4cef8732a9e Mon Sep 17 00:00:00 2001 From: Ville Immonen Date: Thu, 13 Oct 2016 02:49:47 +0300 Subject: [PATCH 11/39] Add 0.7.0 changelog --- CHANGELOG.md | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 59 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d19a40c4340..851ecd14736 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,60 @@ +## 0.7.0 (October 13, 2016) + +### Build Dependency (`react-scripts`) + +* Updates Jest to [version 16.0](http://facebook.github.io/jest/blog/2016/10/03/jest-16.html), with an upgraded CLI, improved snapshot testing, new matchers and more. ([@chase](https://github.com/chase) in [#858](https://github.com/facebookincubator/create-react-app/pull/858)) +* Test setup file `src/setupTests.js` is now called after test framework initialization to support loading custom matchers. ([@just-boris](https://github.com/just-boris) in [#846](https://github.com/facebookincubator/create-react-app/pull/846)) +* Build command shows better instructions for deploying the app to GitHub Pages ([@Janpot](https://github.com/Janpot) in [#841](https://github.com/facebookincubator/create-react-app/pull/841)) +* Build command now generates an asset manifest with mappings from each filename to its final output filename. ([@lukyth](https://github.com/lukyth) in [#891](https://github.com/facebookincubator/create-react-app/pull/891)) +* Build command exits, if there are errors from UglifyJS ([@pdillon](https://github.com/pdillon) in [#859](https://github.com/facebookincubator/create-react-app/pull/859)) +* Eject output is more beautiful now. ([@azakordonets](https://github.com/azakordonets) in [#769](https://github.com/facebookincubator/create-react-app/pull/769)) +* Fixes opening the app in a new tab in Chrome. ([@unixdev](https://github.com/unixdev) in [#831](https://github.com/facebookincubator/create-react-app/pull/831)) +* Fixes environment variables not being defined as normal properties of the `process.env` object. ([@jobi](https://github.com/jobi) in [#795](https://github.com/facebookincubator/create-react-app/issues/795)) + +### ESLint Config (`eslint-config-react-app`) + +* `react/react-in-jsx-scope` rule ("React must be in scope") is now an error. ([@gaearon](https://github.com/gaearon) in [#822](https://github.com/facebookincubator/create-react-app/pull/822)) +* `no-unused-expressions` rule now allows the use of short circuit and ternary expressions. ([@cannona](https://github.com/cannona) in [#724](https://github.com/facebookincubator/create-react-app/pull/724)) + +### Babel Preset (`babel-preset-react-app`) + +* The preset now detects the Node.js version in test environment and disables unnecessary ES2015 transforms using using `babel-preset-env`. ([@shubheksha](https://github.com/shubheksha) in [#878](https://github.com/facebookincubator/create-react-app/pull/878)) +* Fixes a duplicate dependency on `babel-plugin-transform-regenerator`. ([@akofman](https://github.com/akofman) in [#864](https://github.com/facebookincubator/create-react-app/pull/864)) + +### Utilities (`react-dev-utils`) + +* The error overlay is now disposed after fixing linting errors. ([@jarlef](https://github.com/jarlef) in [#856](https://github.com/facebookincubator/create-react-app/pull/856)) +* Adds support for Webpack 2 to `webpackHotDevClient`. ([@michalkvasnicak](https://github.com/michalkvasnicak) in [#840](https://github.com/facebookincubator/create-react-app/pull/840)) + +### Global CLI (`create-react-app`) + +* Adds support for passing a scoped package name to the `--scripts-version` argument. ([@pdillon](https://github.com/pdillon) in [#826](https://github.com/facebookincubator/create-react-app/pull/826)) +* Fixes installing pre-release versions using a tarball URL with the `--scripts-version` argument. ([@jihchi](https://github.com/jihchi) in [#876](https://github.com/facebookincubator/create-react-app/pull/876)) + +### Migrating from 0.6.1 to 0.7.0 + +You may optionally update the global command (it’s not required): + +``` +npm install -g create-react-app@0.7.0 +``` + +Inside any created project that has not been ejected, run: + +``` +npm install --save-dev --save-exact react-scripts@0.7.0 +``` + +### Breaking Change in 0.7.0 + +#### Updating Snapshots + +Jest 16 includes [improvements to snapshot testing and changes to the snapshot format](https://facebook.github.io/jest/blog/2016/10/03/jest-16.html#snapshot-updates). If your project uses snapshot testing, you'll need to update the snapshot files. To update the snapshots, run: +``` +npm test -- -u +``` +(Or press `u` in Jest watch mode.) + ## 0.6.1 (September 27, 2016) ### Build Dependency (`react-scripts`) @@ -61,9 +118,9 @@ npm install --save-dev --save-exact react-scripts@0.5.1 * Adds [support for `public` folder](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#using-the-public-folder) with arbitrary assets. ([@gaearon](https://github.com/gaearon) in [#703](https://github.com/facebookincubator/create-react-app/pull/703)) * You can now [specify defaults](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#adding-development-environment-variables-in-env) for environment variables with `.env` file. ([@ayrton](https://github.com/ayrton) in [#695](https://github.com/facebookincubator/create-react-app/pull/695)) * Ejecting now generates proper `.babelrc` and `.eslintrc`. ([@fson](https://github.com/fson) in [#689](https://github.com/facebookincubator/create-react-app/pull/689), [@gaearon](https://github.com/gaearon) in [#705](https://github.com/facebookincubator/create-react-app/pull/705)) -* Some React warnings now [include the component stacktrace](https://twitter.com/dan_abramov/status/779308833399332864). ([@gaearon](https://github.com/gaearon) in [#716](https://github.com/facebookincubator/create-react-app/pull/716)) +* Some React warnings now [include the component stacktrace](https://twitter.com/dan_abramov/status/779308833399332864). ([@gaearon](https://github.com/gaearon) in [#716](https://github.com/facebookincubator/create-react-app/pull/716)) * `npm start` doesn’t fail in a composed Docker container. ([@arekkas](https://github.com/arekkas) in [#711](https://github.com/facebookincubator/create-react-app/issues/711)) -* The projects generated with `eject` are now cleaner. ([@gaearon](https://github.com/gaearon) in [#723](https://github.com/facebookincubator/create-react-app/pull/723)) +* The projects generated with `eject` are now cleaner. ([@gaearon](https://github.com/gaearon) in [#723](https://github.com/facebookincubator/create-react-app/pull/723)) * The project is now managed as a monorepo. ([@ryanyogan](https://github.com/ryanyogan) in [#419](https://github.com/facebookincubator/create-react-app/pull/419), [@fson](https://github.com/fson) in [#678](https://github.com/facebookincubator/create-react-app/pull/678)) ### ESLint Config (`eslint-config-react-app`) From 7c6f0b72c1a7cf42c88a3861b3662c416958b7ee Mon Sep 17 00:00:00 2001 From: Ville Immonen Date: Thu, 13 Oct 2016 02:56:46 +0300 Subject: [PATCH 12/39] Update the snapshot update instructions for 0.7.0 Running tests with the `-u` flag is a more reliable way to upgrade, because the watch mode only runs tests for changed files. --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 851ecd14736..3577ad354d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,7 +53,6 @@ Jest 16 includes [improvements to snapshot testing and changes to the snapshot f ``` npm test -- -u ``` -(Or press `u` in Jest watch mode.) ## 0.6.1 (September 27, 2016) From 7de747daa80d303a6062159a92484f4dbb66414b Mon Sep 17 00:00:00 2001 From: Mike Francis Date: Fri, 14 Oct 2016 12:37:14 +0100 Subject: [PATCH 13/39] 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 --- packages/react-scripts/template/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/react-scripts/template/README.md b/packages/react-scripts/template/README.md index 13f63c2e23f..268265bdb6d 100644 --- a/packages/react-scripts/template/README.md +++ b/packages/react-scripts/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 1ef6ea52922a705f36a4cc704eac12cfa1c9bba3 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Fri, 14 Oct 2016 12:57:03 +0100 Subject: [PATCH 14/39] Temporarily remove 0.7.0 changelog as it's not out yet --- CHANGELOG.md | 56 ---------------------------------------------------- 1 file changed, 56 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3577ad354d5..a37b867c6a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,59 +1,3 @@ -## 0.7.0 (October 13, 2016) - -### Build Dependency (`react-scripts`) - -* Updates Jest to [version 16.0](http://facebook.github.io/jest/blog/2016/10/03/jest-16.html), with an upgraded CLI, improved snapshot testing, new matchers and more. ([@chase](https://github.com/chase) in [#858](https://github.com/facebookincubator/create-react-app/pull/858)) -* Test setup file `src/setupTests.js` is now called after test framework initialization to support loading custom matchers. ([@just-boris](https://github.com/just-boris) in [#846](https://github.com/facebookincubator/create-react-app/pull/846)) -* Build command shows better instructions for deploying the app to GitHub Pages ([@Janpot](https://github.com/Janpot) in [#841](https://github.com/facebookincubator/create-react-app/pull/841)) -* Build command now generates an asset manifest with mappings from each filename to its final output filename. ([@lukyth](https://github.com/lukyth) in [#891](https://github.com/facebookincubator/create-react-app/pull/891)) -* Build command exits, if there are errors from UglifyJS ([@pdillon](https://github.com/pdillon) in [#859](https://github.com/facebookincubator/create-react-app/pull/859)) -* Eject output is more beautiful now. ([@azakordonets](https://github.com/azakordonets) in [#769](https://github.com/facebookincubator/create-react-app/pull/769)) -* Fixes opening the app in a new tab in Chrome. ([@unixdev](https://github.com/unixdev) in [#831](https://github.com/facebookincubator/create-react-app/pull/831)) -* Fixes environment variables not being defined as normal properties of the `process.env` object. ([@jobi](https://github.com/jobi) in [#795](https://github.com/facebookincubator/create-react-app/issues/795)) - -### ESLint Config (`eslint-config-react-app`) - -* `react/react-in-jsx-scope` rule ("React must be in scope") is now an error. ([@gaearon](https://github.com/gaearon) in [#822](https://github.com/facebookincubator/create-react-app/pull/822)) -* `no-unused-expressions` rule now allows the use of short circuit and ternary expressions. ([@cannona](https://github.com/cannona) in [#724](https://github.com/facebookincubator/create-react-app/pull/724)) - -### Babel Preset (`babel-preset-react-app`) - -* The preset now detects the Node.js version in test environment and disables unnecessary ES2015 transforms using using `babel-preset-env`. ([@shubheksha](https://github.com/shubheksha) in [#878](https://github.com/facebookincubator/create-react-app/pull/878)) -* Fixes a duplicate dependency on `babel-plugin-transform-regenerator`. ([@akofman](https://github.com/akofman) in [#864](https://github.com/facebookincubator/create-react-app/pull/864)) - -### Utilities (`react-dev-utils`) - -* The error overlay is now disposed after fixing linting errors. ([@jarlef](https://github.com/jarlef) in [#856](https://github.com/facebookincubator/create-react-app/pull/856)) -* Adds support for Webpack 2 to `webpackHotDevClient`. ([@michalkvasnicak](https://github.com/michalkvasnicak) in [#840](https://github.com/facebookincubator/create-react-app/pull/840)) - -### Global CLI (`create-react-app`) - -* Adds support for passing a scoped package name to the `--scripts-version` argument. ([@pdillon](https://github.com/pdillon) in [#826](https://github.com/facebookincubator/create-react-app/pull/826)) -* Fixes installing pre-release versions using a tarball URL with the `--scripts-version` argument. ([@jihchi](https://github.com/jihchi) in [#876](https://github.com/facebookincubator/create-react-app/pull/876)) - -### Migrating from 0.6.1 to 0.7.0 - -You may optionally update the global command (it’s not required): - -``` -npm install -g create-react-app@0.7.0 -``` - -Inside any created project that has not been ejected, run: - -``` -npm install --save-dev --save-exact react-scripts@0.7.0 -``` - -### Breaking Change in 0.7.0 - -#### Updating Snapshots - -Jest 16 includes [improvements to snapshot testing and changes to the snapshot format](https://facebook.github.io/jest/blog/2016/10/03/jest-16.html#snapshot-updates). If your project uses snapshot testing, you'll need to update the snapshot files. To update the snapshots, run: -``` -npm test -- -u -``` - ## 0.6.1 (September 27, 2016) ### Build Dependency (`react-scripts`) From e4e86cd5d311f5b0b19bf0c44b47ee685fdeb194 Mon Sep 17 00:00:00 2001 From: Michael Scholtz Date: Mon, 17 Oct 2016 21:51:22 +0200 Subject: [PATCH 15/39] Fix Travis CI config in template README.md (#910) --- packages/react-scripts/template/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-scripts/template/README.md b/packages/react-scripts/template/README.md index 268265bdb6d..f364eda3824 100644 --- a/packages/react-scripts/template/README.md +++ b/packages/react-scripts/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 d7ecd92859289f64cc560353b77563d1d4cdd5c7 Mon Sep 17 00:00:00 2001 From: Jeffrey Carl Faden Date: Tue, 18 Oct 2016 10:31:58 -0700 Subject: [PATCH 16/39] Enable babel parameters/destructuring for all versions of Node (#927) * Enable babel parameters/destructuring for all versions of Node * Add more descriptive comment explaining plugin use --- packages/babel-preset-react-app/index.js | 10 +++++++++- packages/babel-preset-react-app/package.json | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/babel-preset-react-app/index.js b/packages/babel-preset-react-app/index.js index d3063aee304..d6e9c4519d4 100644 --- a/packages/babel-preset-react-app/index.js +++ b/packages/babel-preset-react-app/index.js @@ -27,7 +27,15 @@ const plugins = [ regenerator: true, // Resolve the Babel runtime relative to the config. moduleName: path.dirname(require.resolve('babel-runtime/package')) - }] + }], + // The following two plugins are currently necessary to get + // babel-preset-env to work with rest/spread. More info here: + // https://github.com/babel/babel-preset-env#caveats + // https://github.com/babel/babel/issues/4074 + // const { a, ...z } = obj; + require.resolve('babel-plugin-transform-es2015-destructuring'), + // const fn = ({ a, ...otherProps }) => otherProps; + require.resolve('babel-plugin-transform-es2015-parameters') ]; // This is similar to how `env` works in Babel: diff --git a/packages/babel-preset-react-app/package.json b/packages/babel-preset-react-app/package.json index bd1db0f5722..3778880b5ce 100644 --- a/packages/babel-preset-react-app/package.json +++ b/packages/babel-preset-react-app/package.json @@ -12,6 +12,8 @@ ], "dependencies": { "babel-plugin-transform-class-properties": "6.11.5", + "babel-plugin-transform-es2015-destructuring": "6.16.0", + "babel-plugin-transform-es2015-parameters": "6.17.0", "babel-plugin-transform-object-rest-spread": "6.8.0", "babel-plugin-transform-react-constant-elements": "6.9.1", "babel-plugin-transform-react-jsx-self": "6.11.0", From 59acae6ab26424837f881751eb261519d133e98f Mon Sep 17 00:00:00 2001 From: Nathan Hunzaker Date: Wed, 19 Oct 2016 05:19:12 -0400 Subject: [PATCH 17/39] PostCSS should run on @import statements. (#929) --- packages/react-scripts/config/webpack.config.dev.js | 2 +- packages/react-scripts/config/webpack.config.prod.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-scripts/config/webpack.config.dev.js b/packages/react-scripts/config/webpack.config.dev.js index 8a8b59ed859..d875c63e8d9 100644 --- a/packages/react-scripts/config/webpack.config.dev.js +++ b/packages/react-scripts/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/packages/react-scripts/config/webpack.config.prod.js b/packages/react-scripts/config/webpack.config.prod.js index fa787d43ea7..e0141b851b4 100644 --- a/packages/react-scripts/config/webpack.config.prod.js +++ b/packages/react-scripts/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 d5de99e00b8bfc81aa796a8929f1d0c2c863a0c9 Mon Sep 17 00:00:00 2001 From: Ville Immonen Date: Sat, 22 Oct 2016 22:36:15 +0300 Subject: [PATCH 18/39] 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. --- lerna.json | 2 +- package.json | 4 +-- packages/babel-preset-react-app/package.json | 10 +++--- packages/eslint-config-react-app/README.md | 2 +- packages/eslint-config-react-app/package.json | 12 +++---- packages/react-scripts/package.json | 36 +++++++++---------- packages/react-scripts/template/README.md | 2 +- 7 files changed, 34 insertions(+), 34 deletions(-) diff --git a/lerna.json b/lerna.json index efe8073fd0c..dfcc2e9f35f 100644 --- a/lerna.json +++ b/lerna.json @@ -1,4 +1,4 @@ { - "lerna": "2.0.0-beta.29", + "lerna": "2.0.0-beta.30", "version": "independent" } diff --git a/package.json b/package.json index 1029bc47758..1ac6081b7b3 100644 --- a/package.json +++ b/package.json @@ -12,11 +12,11 @@ "devDependencies": { "babel-eslint": "6.1.2", "eslint": "3.5.0", - "eslint-config-react-app": "file:packages/eslint-config-react-app", + "eslint-config-react-app": "0.2.1", "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", - "lerna": "2.0.0-beta.29" + "lerna": "2.0.0-beta.30" } } diff --git a/packages/babel-preset-react-app/package.json b/packages/babel-preset-react-app/package.json index 3778880b5ce..28c61a31d84 100644 --- a/packages/babel-preset-react-app/package.json +++ b/packages/babel-preset-react-app/package.json @@ -11,18 +11,18 @@ "index.js" ], "dependencies": { - "babel-plugin-transform-class-properties": "6.11.5", + "babel-plugin-transform-class-properties": "6.16.0", "babel-plugin-transform-es2015-destructuring": "6.16.0", "babel-plugin-transform-es2015-parameters": "6.17.0", - "babel-plugin-transform-object-rest-spread": "6.8.0", + "babel-plugin-transform-object-rest-spread": "6.16.0", "babel-plugin-transform-react-constant-elements": "6.9.1", "babel-plugin-transform-react-jsx-self": "6.11.0", "babel-plugin-transform-react-jsx-source": "6.9.0", "babel-plugin-transform-regenerator": "6.16.1", "babel-plugin-transform-runtime": "6.15.0", - "babel-preset-env": "0.0.4", - "babel-preset-latest": "6.14.0", - "babel-preset-react": "6.11.1", + "babel-preset-env": "0.0.6", + "babel-preset-latest": "6.16.0", + "babel-preset-react": "6.16.0", "babel-runtime": "6.11.6" } } diff --git a/packages/eslint-config-react-app/README.md b/packages/eslint-config-react-app/README.md index e4fac03e54d..5c20f50ca2e 100644 --- a/packages/eslint-config-react-app/README.md +++ b/packages/eslint-config-react-app/README.md @@ -17,7 +17,7 @@ If you want to use this ESLint configuration in a project not built with Create First, install this package, ESLint and the necessary plugins. ```sh - npm install --save-dev eslint-config-react-app babel-eslint@6.1.2 eslint@3.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 + npm install --save-dev eslint-config-react-app babel-eslint@7.0.0 eslint@3.8.1 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 ``` Then create a file named `.eslintrc` with following contents in the root folder of your project: diff --git a/packages/eslint-config-react-app/package.json b/packages/eslint-config-react-app/package.json index 90c6a21f269..8ae92c5f489 100644 --- a/packages/eslint-config-react-app/package.json +++ b/packages/eslint-config-react-app/package.json @@ -11,11 +11,11 @@ "index.js" ], "peerDependencies": { - "babel-eslint": "6.1.2", - "eslint": "3.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" + "babel-eslint": "7.0.0", + "eslint": "3.8.1", + "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" } } diff --git a/packages/react-scripts/package.json b/packages/react-scripts/package.json index 004ba9ee088..fb0ea4ebe82 100644 --- a/packages/react-scripts/package.json +++ b/packages/react-scripts/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/packages/react-scripts/template/README.md b/packages/react-scripts/template/README.md index f364eda3824..c9ecc7d84fb 100644 --- a/packages/react-scripts/template/README.md +++ b/packages/react-scripts/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 27500900afc5aca70d7d81ec15c230f09b0f9552 Mon Sep 17 00:00:00 2001 From: Ville Immonen Date: Sat, 22 Oct 2016 23:11:25 +0300 Subject: [PATCH 19/39] Forbid Webpack loader syntax in imports (#803) Enable no-webpack-loader-syntax rule in eslint-config-react-app. --- packages/eslint-config-react-app/index.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/eslint-config-react-app/index.js b/packages/eslint-config-react-app/index.js index 7689a83544b..f2f79a2dcc1 100644 --- a/packages/eslint-config-react-app/index.js +++ b/packages/eslint-config-react-app/index.js @@ -21,8 +21,7 @@ module.exports = { parser: 'babel-eslint', - // import plugin is temporarily disabled, scroll below to see why - plugins: [/*'import', */'flowtype', 'jsx-a11y', 'react'], + plugins: ['import', 'flowtype', 'jsx-a11y', 'react'], env: { browser: true, @@ -170,6 +169,9 @@ module.exports = { // This is probably fixable with a patch to eslint-loader. // When file A is saved, we want to invalidate all files that import it // *and* that currently have lint errors. This should fix the problem. + // (As an exception, import/no-webpack-loader-syntax can be enabled already + // because it doesn't depend on whether the file exists, so this issue + // doesn't apply to it.) // 'import/default': 'warn', // 'import/export': 'warn', @@ -181,6 +183,9 @@ module.exports = { // 'import/no-named-as-default': 'warn', // 'import/no-named-as-default-member': 'warn', // 'import/no-unresolved': ['warn', { commonjs: true }], + // We don't support configuring Webpack using import source strings, so this + // is always an error. + 'import/no-webpack-loader-syntax': 'error', // https://github.com/yannickcr/eslint-plugin-react/tree/master/docs/rules 'react/jsx-equals-spacing': ['warn', 'never'], From 31ca46683d58c9336f5cc357489738a92d83734a Mon Sep 17 00:00:00 2001 From: Ville Immonen Date: Sat, 22 Oct 2016 23:13:43 +0300 Subject: [PATCH 20/39] Revert "Temporarily remove 0.7.0 changelog as it's not out yet" This reverts commit 1ef6ea52922a705f36a4cc704eac12cfa1c9bba3. --- CHANGELOG.md | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a37b867c6a9..3577ad354d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,59 @@ +## 0.7.0 (October 13, 2016) + +### Build Dependency (`react-scripts`) + +* Updates Jest to [version 16.0](http://facebook.github.io/jest/blog/2016/10/03/jest-16.html), with an upgraded CLI, improved snapshot testing, new matchers and more. ([@chase](https://github.com/chase) in [#858](https://github.com/facebookincubator/create-react-app/pull/858)) +* Test setup file `src/setupTests.js` is now called after test framework initialization to support loading custom matchers. ([@just-boris](https://github.com/just-boris) in [#846](https://github.com/facebookincubator/create-react-app/pull/846)) +* Build command shows better instructions for deploying the app to GitHub Pages ([@Janpot](https://github.com/Janpot) in [#841](https://github.com/facebookincubator/create-react-app/pull/841)) +* Build command now generates an asset manifest with mappings from each filename to its final output filename. ([@lukyth](https://github.com/lukyth) in [#891](https://github.com/facebookincubator/create-react-app/pull/891)) +* Build command exits, if there are errors from UglifyJS ([@pdillon](https://github.com/pdillon) in [#859](https://github.com/facebookincubator/create-react-app/pull/859)) +* Eject output is more beautiful now. ([@azakordonets](https://github.com/azakordonets) in [#769](https://github.com/facebookincubator/create-react-app/pull/769)) +* Fixes opening the app in a new tab in Chrome. ([@unixdev](https://github.com/unixdev) in [#831](https://github.com/facebookincubator/create-react-app/pull/831)) +* Fixes environment variables not being defined as normal properties of the `process.env` object. ([@jobi](https://github.com/jobi) in [#795](https://github.com/facebookincubator/create-react-app/issues/795)) + +### ESLint Config (`eslint-config-react-app`) + +* `react/react-in-jsx-scope` rule ("React must be in scope") is now an error. ([@gaearon](https://github.com/gaearon) in [#822](https://github.com/facebookincubator/create-react-app/pull/822)) +* `no-unused-expressions` rule now allows the use of short circuit and ternary expressions. ([@cannona](https://github.com/cannona) in [#724](https://github.com/facebookincubator/create-react-app/pull/724)) + +### Babel Preset (`babel-preset-react-app`) + +* The preset now detects the Node.js version in test environment and disables unnecessary ES2015 transforms using using `babel-preset-env`. ([@shubheksha](https://github.com/shubheksha) in [#878](https://github.com/facebookincubator/create-react-app/pull/878)) +* Fixes a duplicate dependency on `babel-plugin-transform-regenerator`. ([@akofman](https://github.com/akofman) in [#864](https://github.com/facebookincubator/create-react-app/pull/864)) + +### Utilities (`react-dev-utils`) + +* The error overlay is now disposed after fixing linting errors. ([@jarlef](https://github.com/jarlef) in [#856](https://github.com/facebookincubator/create-react-app/pull/856)) +* Adds support for Webpack 2 to `webpackHotDevClient`. ([@michalkvasnicak](https://github.com/michalkvasnicak) in [#840](https://github.com/facebookincubator/create-react-app/pull/840)) + +### Global CLI (`create-react-app`) + +* Adds support for passing a scoped package name to the `--scripts-version` argument. ([@pdillon](https://github.com/pdillon) in [#826](https://github.com/facebookincubator/create-react-app/pull/826)) +* Fixes installing pre-release versions using a tarball URL with the `--scripts-version` argument. ([@jihchi](https://github.com/jihchi) in [#876](https://github.com/facebookincubator/create-react-app/pull/876)) + +### Migrating from 0.6.1 to 0.7.0 + +You may optionally update the global command (it’s not required): + +``` +npm install -g create-react-app@0.7.0 +``` + +Inside any created project that has not been ejected, run: + +``` +npm install --save-dev --save-exact react-scripts@0.7.0 +``` + +### Breaking Change in 0.7.0 + +#### Updating Snapshots + +Jest 16 includes [improvements to snapshot testing and changes to the snapshot format](https://facebook.github.io/jest/blog/2016/10/03/jest-16.html#snapshot-updates). If your project uses snapshot testing, you'll need to update the snapshot files. To update the snapshots, run: +``` +npm test -- -u +``` + ## 0.6.1 (September 27, 2016) ### Build Dependency (`react-scripts`) From ac30a8076eb871f6cbc56efc747875dec10bbbf0 Mon Sep 17 00:00:00 2001 From: Ville Immonen Date: Sat, 22 Oct 2016 23:29:31 +0300 Subject: [PATCH 21/39] Update changelog for 0.7.0 --- CHANGELOG.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3577ad354d5..1261bbd14c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## 0.7.0 (October 13, 2016) +## 0.7.0 (October 22, 2016) ### Build Dependency (`react-scripts`) @@ -10,15 +10,18 @@ * Eject output is more beautiful now. ([@azakordonets](https://github.com/azakordonets) in [#769](https://github.com/facebookincubator/create-react-app/pull/769)) * Fixes opening the app in a new tab in Chrome. ([@unixdev](https://github.com/unixdev) in [#831](https://github.com/facebookincubator/create-react-app/pull/831)) * Fixes environment variables not being defined as normal properties of the `process.env` object. ([@jobi](https://github.com/jobi) in [#795](https://github.com/facebookincubator/create-react-app/issues/795)) +* Fixes PostCSS autoprefixer not processing CSS files imported with CSS `@import` statements. ([@nhunzaker](https://github.com/nhunzaker) in [##929](https://github.com/facebookincubator/create-react-app/pull/929)) ### ESLint Config (`eslint-config-react-app`) +* Adds `import/no-webpack-loader-syntax` rule that forbids using custom Webpack specific syntax to specify Webpack loaders in import statements. ([@fson](https://github.com/fson) in [#803](https://github.com/facebookincubator/create-react-app/pull/803)) * `react/react-in-jsx-scope` rule ("React must be in scope") is now an error. ([@gaearon](https://github.com/gaearon) in [#822](https://github.com/facebookincubator/create-react-app/pull/822)) * `no-unused-expressions` rule now allows the use of short circuit and ternary expressions. ([@cannona](https://github.com/cannona) in [#724](https://github.com/facebookincubator/create-react-app/pull/724)) ### Babel Preset (`babel-preset-react-app`) -* The preset now detects the Node.js version in test environment and disables unnecessary ES2015 transforms using using `babel-preset-env`. ([@shubheksha](https://github.com/shubheksha) in [#878](https://github.com/facebookincubator/create-react-app/pull/878)) +* The preset now detects the Node.js version in test environment and disables unnecessary ES2015 transforms using using `babel-preset-env`. ([@shubheksha](https://github.com/shubheksha) in [#878](https://github.com/facebookincubator/create-react-app/pull/878), [@JeffreyATW](https://github.com/JeffreyATW) in [#927 +](https://github.com/facebookincubator/create-react-app/pull/927)) * Fixes a duplicate dependency on `babel-plugin-transform-regenerator`. ([@akofman](https://github.com/akofman) in [#864](https://github.com/facebookincubator/create-react-app/pull/864)) ### Utilities (`react-dev-utils`) From 9b85e458b0bb457d60f7738fb0761f1635fbde3d Mon Sep 17 00:00:00 2001 From: Ville Immonen Date: Sat, 22 Oct 2016 23:32:46 +0300 Subject: [PATCH 22/39] Update eslint-config-react-app version in the guide --- packages/react-scripts/template/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-scripts/template/README.md b/packages/react-scripts/template/README.md index c9ecc7d84fb..6f13b12d2e0 100644 --- a/packages/react-scripts/template/README.md +++ b/packages/react-scripts/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 a5f760bab9b1876df13ac4345a4b42655fec46fa Mon Sep 17 00:00:00 2001 From: Ville Immonen Date: Sat, 22 Oct 2016 23:49:30 +0300 Subject: [PATCH 23/39] 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 --- packages/babel-preset-react-app/package.json | 2 +- packages/create-react-app/package.json | 2 +- packages/eslint-config-react-app/package.json | 2 +- packages/react-dev-utils/package.json | 2 +- packages/react-scripts/package.json | 9 +++++---- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/babel-preset-react-app/package.json b/packages/babel-preset-react-app/package.json index 28c61a31d84..bba2df1e0b1 100644 --- a/packages/babel-preset-react-app/package.json +++ b/packages/babel-preset-react-app/package.json @@ -1,6 +1,6 @@ { "name": "babel-preset-react-app", - "version": "0.2.1", + "version": "1.0.0", "description": "Babel preset used by Create React App", "repository": "facebookincubator/create-react-app", "license": "BSD-3-Clause", diff --git a/packages/create-react-app/package.json b/packages/create-react-app/package.json index 5094b9c78dd..4dd8b0f1a6c 100644 --- a/packages/create-react-app/package.json +++ b/packages/create-react-app/package.json @@ -1,6 +1,6 @@ { "name": "create-react-app", - "version": "0.5.0", + "version": "0.6.0", "keywords": [ "react" ], diff --git a/packages/eslint-config-react-app/package.json b/packages/eslint-config-react-app/package.json index 8ae92c5f489..e0321bd47eb 100644 --- a/packages/eslint-config-react-app/package.json +++ b/packages/eslint-config-react-app/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-react-app", - "version": "0.2.1", + "version": "0.3.0", "description": "ESLint configuration used by Create React App", "repository": "facebookincubator/create-react-app", "license": "BSD-3-Clause", diff --git a/packages/react-dev-utils/package.json b/packages/react-dev-utils/package.json index 8de715d1916..14c860999ae 100644 --- a/packages/react-dev-utils/package.json +++ b/packages/react-dev-utils/package.json @@ -1,6 +1,6 @@ { "name": "react-dev-utils", - "version": "0.2.1", + "version": "0.3.0", "description": "Webpack utilities used by Create React App", "repository": "facebookincubator/create-react-app", "license": "BSD-3-Clause", diff --git a/packages/react-scripts/package.json b/packages/react-scripts/package.json index fb0ea4ebe82..58bb4ab1d06 100644 --- a/packages/react-scripts/package.json +++ b/packages/react-scripts/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 732593e821c8a4231226235fbf4285da0f9c9321 Mon Sep 17 00:00:00 2001 From: Ville Immonen Date: Sun, 23 Oct 2016 00:01:27 +0300 Subject: [PATCH 24/39] Update CLI version in changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1261bbd14c7..e73b0eeca57 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,7 +39,7 @@ You may optionally update the global command (it’s not required): ``` -npm install -g create-react-app@0.7.0 +npm install -g create-react-app@0.6.0 ``` Inside any created project that has not been ejected, run: From 613902c4d3584b75fcad16824d7dc3758354c3e7 Mon Sep 17 00:00:00 2001 From: Ville Immonen Date: Sun, 23 Oct 2016 16:36:29 +0300 Subject: [PATCH 25/39] Fix an attribution link in 0.7.0 changelog --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e73b0eeca57..b7d168daeec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,8 +9,8 @@ * Build command exits, if there are errors from UglifyJS ([@pdillon](https://github.com/pdillon) in [#859](https://github.com/facebookincubator/create-react-app/pull/859)) * Eject output is more beautiful now. ([@azakordonets](https://github.com/azakordonets) in [#769](https://github.com/facebookincubator/create-react-app/pull/769)) * Fixes opening the app in a new tab in Chrome. ([@unixdev](https://github.com/unixdev) in [#831](https://github.com/facebookincubator/create-react-app/pull/831)) -* Fixes environment variables not being defined as normal properties of the `process.env` object. ([@jobi](https://github.com/jobi) in [#795](https://github.com/facebookincubator/create-react-app/issues/795)) -* Fixes PostCSS autoprefixer not processing CSS files imported with CSS `@import` statements. ([@nhunzaker](https://github.com/nhunzaker) in [##929](https://github.com/facebookincubator/create-react-app/pull/929)) +* Fixes environment variables not being defined as normal properties of the `process.env` object. ([@dvkndn](https://github.com/dvkndn) in [#807](https://github.com/facebookincubator/create-react-app/pull/807)) +* Fixes PostCSS autoprefixer not processing CSS files imported with CSS `@import` statements. ([@nhunzaker](https://github.com/nhunzaker) in [#929](https://github.com/facebookincubator/create-react-app/pull/929)) ### ESLint Config (`eslint-config-react-app`) From b284377ebe7fe7de86c7fd60c43457ce92069d32 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Mon, 24 Oct 2016 17:53:05 +0100 Subject: [PATCH 26/39] Encourage people to try recent npm --- ISSUE_TEMPLATE.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md index 2bcdd77dc36..e85da85b4c7 100644 --- a/ISSUE_TEMPLATE.md +++ b/ISSUE_TEMPLATE.md @@ -1,5 +1,21 @@ If you are reporting a bug, please fill in below. Otherwise feel free to remove this template entirely. +### Can you reproduce the problem with latest npm? + +Run: + +``` +npm install -g npm@latest + +cd your_project_directory +rm -rf node_modules +npm install +``` + +and try to reproduce the issue again. + +Can you still reproduce it? + ### Description What are you reporting? From 91e616e4dc8f191d5ae0d15a1b9ad1bea6c9b3e2 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Tue, 25 Oct 2016 12:01:58 +0100 Subject: [PATCH 27/39] Point people to npm Windows instructions --- ISSUE_TEMPLATE.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md index e85da85b4c7..374dbf17958 100644 --- a/ISSUE_TEMPLATE.md +++ b/ISSUE_TEMPLATE.md @@ -2,7 +2,11 @@ If you are reporting a bug, please fill in below. Otherwise feel free to remove ### Can you reproduce the problem with latest npm? -Run: +Many errors, especially related to "missing modules", are due to npm bugs. + +If you're using Windows, [follow these instructions to update npm](https://github.com/npm/npm/wiki/Troubleshooting#upgrading-on-windows). + +If you're using OS X or Linux, run this to update npm: ``` npm install -g npm@latest @@ -12,7 +16,7 @@ rm -rf node_modules npm install ``` -and try to reproduce the issue again. +Then try to reproduce the issue again. Can you still reproduce it? From 75d158528c92f5ac3cdefd4f545015bde004706b Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Tue, 25 Oct 2016 23:07:28 +0100 Subject: [PATCH 28/39] Add next.js to Alternatives --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 334dd477e85..b7e1f1f45db 100644 --- a/README.md +++ b/README.md @@ -205,6 +205,7 @@ Some of the more popular and actively maintained ones are: * [insin/nwb](https://github.com/insin/nwb) * [mozilla/neo](https://github.com/mozilla/neo) * [NYTimes/kyt](https://github.com/NYTimes/kyt) +* [zeit/next.js](https://github.com/zeit/next.js) Notable alternatives also include: From ca443abe62999df0443b40204c690e0a24a2152a Mon Sep 17 00:00:00 2001 From: Fatih Date: Fri, 28 Oct 2016 15:41:51 +0300 Subject: [PATCH 29/39] Enable compression on webpack-dev-server (#966) (#968) --- packages/react-scripts/scripts/start.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/react-scripts/scripts/start.js b/packages/react-scripts/scripts/start.js index 8723c281637..8a115dd8e27 100644 --- a/packages/react-scripts/scripts/start.js +++ b/packages/react-scripts/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 91c86502a4cfef1e494909b51c98a39a2d93062c Mon Sep 17 00:00:00 2001 From: Swizec Teller Date: Fri, 28 Oct 2016 05:42:51 -0700 Subject: [PATCH 30/39] Gently nudge users towards https by default (#974) gh-pages supports https. It's important for prominent help files to encourage best practices. --- packages/react-scripts/template/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-scripts/template/README.md b/packages/react-scripts/template/README.md index 6f13b12d2e0..6bb93795bad 100644 --- a/packages/react-scripts/template/README.md +++ b/packages/react-scripts/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 0bd593baa777606ffb72f63eab9f5fd491062007 Mon Sep 17 00:00:00 2001 From: Sandro Padin Date: Fri, 28 Oct 2016 05:45:50 -0700 Subject: [PATCH 31/39] Catch and noop call to open web browser. (#964) Running `create-react-app` in a Docker container causes an unhandled rejection error in nodejs > 6.5 because the `opn` module tries to open a web browser in a system that doesn't have one. I figured this error could be safely ignored. --- packages/react-dev-utils/openBrowser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-dev-utils/openBrowser.js b/packages/react-dev-utils/openBrowser.js index 76b33a5924a..bee85a7d299 100644 --- a/packages/react-dev-utils/openBrowser.js +++ b/packages/react-dev-utils/openBrowser.js @@ -28,7 +28,7 @@ function openBrowser(url) { // Fallback to opn // (It will always open new tab) try { - opn(url); + opn(url).catch(() => {}); // Prevent `unhandledRejection` error. return true; } catch (err) { return false; From a0efbebee2671d1f11bc0a1936b84e45ab322c19 Mon Sep 17 00:00:00 2001 From: Patrick Mackinder Date: Fri, 28 Oct 2016 13:47:08 +0100 Subject: [PATCH 32/39] Add collectCoverageFrom option to collect coverage on files without any tests. (#961) --- packages/react-scripts/utils/createJestConfig.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/react-scripts/utils/createJestConfig.js b/packages/react-scripts/utils/createJestConfig.js index 39c864ab8f4..17d414fc594 100644 --- a/packages/react-scripts/utils/createJestConfig.js +++ b/packages/react-scripts/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 fcda24eee879460095e35e6e5b66269cca8b8094 Mon Sep 17 00:00:00 2001 From: David Ernst Date: Fri, 28 Oct 2016 05:51:06 -0700 Subject: [PATCH 33/39] 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 --- packages/react-scripts/template/README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/react-scripts/template/README.md b/packages/react-scripts/template/README.md index 6bb93795bad..788f77e7805 100644 --- a/packages/react-scripts/template/README.md +++ b/packages/react-scripts/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 8a5c50d97a3f41eceb8f237f1ffb8e18fd21ee16 Mon Sep 17 00:00:00 2001 From: Vadzim Date: Fri, 28 Oct 2016 15:51:56 +0300 Subject: [PATCH 34/39] Fixes https://github.com/facebookincubator/create-react-app/issues/952 (#953) --- packages/eslint-config-react-app/index.js | 2 +- packages/react-scripts/utils/createJestConfig.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/eslint-config-react-app/index.js b/packages/eslint-config-react-app/index.js index f2f79a2dcc1..6df5bfdd93b 100644 --- a/packages/eslint-config-react-app/index.js +++ b/packages/eslint-config-react-app/index.js @@ -44,7 +44,7 @@ module.exports = { settings: { 'import/ignore': [ 'node_modules', - '\\.(json|css|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$', + '\\.(json|css|ico|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$', ], 'import/extensions': ['.js'], 'import/resolver': { diff --git a/packages/react-scripts/utils/createJestConfig.js b/packages/react-scripts/utils/createJestConfig.js index 17d414fc594..df0238f2587 100644 --- a/packages/react-scripts/utils/createJestConfig.js +++ b/packages/react-scripts/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 7ce4b6e0e436feff0a38cebb123eefdf6a6dc399 Mon Sep 17 00:00:00 2001 From: Alice Rose Date: Fri, 28 Oct 2016 14:54:56 +0200 Subject: [PATCH 35/39] Check for presence of folders before continuing eject. Closes #939. (#951) --- packages/react-scripts/scripts/eject.js | 38 ++++++++++++++++--------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/packages/react-scripts/scripts/eject.js b/packages/react-scripts/scripts/eject.js index d14aec6abef..dbd4d64e4d5 100644 --- a/packages/react-scripts/scripts/eject.js +++ b/packages/react-scripts/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 6bda4b972602ca339059a5a5c829f41f852aed69 Mon Sep 17 00:00:00 2001 From: Ville Immonen Date: Sat, 29 Oct 2016 21:00:16 +0200 Subject: [PATCH 36/39] 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. --- packages/react-scripts/config/webpack.config.dev.js | 10 +++------- packages/react-scripts/package.json | 3 +-- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/packages/react-scripts/config/webpack.config.dev.js b/packages/react-scripts/config/webpack.config.dev.js index d875c63e8d9..c2b544cca54 100644 --- a/packages/react-scripts/config/webpack.config.dev.js +++ b/packages/react-scripts/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/packages/react-scripts/package.json b/packages/react-scripts/package.json index 58bb4ab1d06..b4cad963979 100644 --- a/packages/react-scripts/package.json +++ b/packages/react-scripts/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 e3b69661d9b056277b59aa1c4d358009a1f2f3a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Einar=20L=C3=B6ve?= Date: Mon, 31 Oct 2016 12:45:44 +0100 Subject: [PATCH 37/39] Allow webpack 2 as peerDependency in react-dev-utils (#963) * Allow webpack 2 as peerDependency * Remove webpack as peer dependency --- packages/react-dev-utils/package.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/react-dev-utils/package.json b/packages/react-dev-utils/package.json index 14c860999ae..1fe5c556c79 100644 --- a/packages/react-dev-utils/package.json +++ b/packages/react-dev-utils/package.json @@ -29,8 +29,5 @@ "opn": "4.0.2", "sockjs-client": "1.0.3", "strip-ansi": "3.0.1" - }, - "peerDependencies": { - "webpack": "^1.13.2" } } From b855cc368c346fb4cd71d1e3fea9218ac0553c0d Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Mon, 31 Oct 2016 14:33:03 -0700 Subject: [PATCH 38/39] Add Gatsby to alternatives (#995) --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b7e1f1f45db..df0046aa39a 100644 --- a/README.md +++ b/README.md @@ -206,6 +206,7 @@ Some of the more popular and actively maintained ones are: * [mozilla/neo](https://github.com/mozilla/neo) * [NYTimes/kyt](https://github.com/NYTimes/kyt) * [zeit/next.js](https://github.com/zeit/next.js) +* [gatsbyjs/gatsby](https://github.com/gatsbyjs/gatsby) Notable alternatives also include: From 79160b858a8496a93abbbe6254fb4008e22a6b89 Mon Sep 17 00:00:00 2001 From: Leo Wong Date: Tue, 1 Nov 2016 21:56:29 +0800 Subject: [PATCH 39/39] Remove redundant `function` from export statement (#996) --- packages/react-scripts/template/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-scripts/template/README.md b/packages/react-scripts/template/README.md index 788f77e7805..3203c5fcbb9 100644 --- a/packages/react-scripts/template/README.md +++ b/packages/react-scripts/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.