diff --git a/CHANGELOG.md b/CHANGELOG.md index 2cbeed3a4ad..9049c88fea5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,53 @@ +## 1.0.7 (May 27, 2017) + +#### :bug: Bug Fix + +* `react-scripts` + + * [#2382](https://github.com/facebookincubator/create-react-app/pull/2382) Consistently set environment variables. ([@gaearon](https://github.com/gaearon)) + * [#2379](https://github.com/facebookincubator/create-react-app/pull/2379) Temporarily disable `comparisons` feature in uglify compression. ([@davidascher](https://github.com/davidascher)) + +#### :nail_care: Enhancement + +* `react-scripts` + + * [#2383](https://github.com/facebookincubator/create-react-app/pull/2383) Update webpack to 2.6.1. ([@gaearon](https://github.com/gaearon)) + * [#2349](https://github.com/facebookincubator/create-react-app/pull/2349) Update webpack to v2.6.0. ([@ingro](https://github.com/ingro)) + * [#2351](https://github.com/facebookincubator/create-react-app/pull/2351) Removed the overriding of `reduce_vars` since webpack v2.6.0 included fix of Uglify. ([@Zaccc123](https://github.com/Zaccc123)) + +* `react-dev-utils`, `react-scripts` + + * [#2361](https://github.com/facebookincubator/create-react-app/pull/2361) Print file sizes with correct build folder path. ([@fezhengjin](https://github.com/fezhengjin)) + +#### :memo: Documentation + +* `react-scripts` + + * [#2372](https://github.com/facebookincubator/create-react-app/pull/2372) Update README.md for `now` deployments. ([@purplecones](https://github.com/purplecones)) + * [#2350](https://github.com/facebookincubator/create-react-app/pull/2350) Fix broken links. ([@gaearon](https://github.com/gaearon)) + +#### Committers: 6 +- Dan Abramov ([gaearon](https://github.com/gaearon)) +- David Ascher ([davidascher](https://github.com/davidascher)) +- Emanuele Ingrosso ([ingro](https://github.com/ingro)) +- Jin Zheng ([fezhengjin](https://github.com/fezhengjin)) +- Mirza Joldic ([purplecones](https://github.com/purplecones)) +- Zac Kwan ([Zaccc123](https://github.com/Zaccc123)) + +### Migrating from 1.0.6 to 1.0.7 + +Inside any created project that has not been ejected, run: + +``` +npm install --save-dev --save-exact react-scripts@1.0.7 +``` + +or + +``` +yarn add --dev --exact react-scripts@1.0.7 +``` + ## 1.0.6 (May 24, 2017) #### :bug: Bug Fix diff --git a/packages/react-dev-utils/ModuleScopePlugin.js b/packages/react-dev-utils/ModuleScopePlugin.js index fd70a2f408a..adc9bdcba93 100644 --- a/packages/react-dev-utils/ModuleScopePlugin.js +++ b/packages/react-dev-utils/ModuleScopePlugin.js @@ -37,7 +37,10 @@ class ModuleScopePlugin { // Maybe an indexOf === 0 would be better? const relative = path.relative(appSrc, request.context.issuer); // If it's not in src/ or a subdirectory, not our request! - if (relative[0] === '.') { + if ( + relative.startsWith('../') || + relative.startsWith('..\\') + ) { return callback(); } // Find path from src to the requested file @@ -49,7 +52,10 @@ class ModuleScopePlugin { ) ); // Error if in a parent directory of src/ - if (requestRelative[0] === '.') { + if ( + requestRelative.startsWith('../') || + requestRelative.startsWith('..\\') + ) { callback( new Error( `You attempted to import ${chalk.cyan(request.__innerRequest_request)} which falls outside of the project ${chalk.cyan('src/')} directory. ` + diff --git a/packages/react-dev-utils/WebpackDevServerUtils.js b/packages/react-dev-utils/WebpackDevServerUtils.js index b681c601f7c..51a0feb56f3 100644 --- a/packages/react-dev-utils/WebpackDevServerUtils.js +++ b/packages/react-dev-utils/WebpackDevServerUtils.js @@ -107,7 +107,7 @@ function printInstructions(appName, urls, useYarn) { console.log('Note that the development build is not optimized.'); console.log( `To create a production build, use ` + - `${chalk.cyan(`${useYarn ? 'yarn' : 'npm'} run build`)}.` + `${chalk.cyan(`${useYarn ? 'yarn' : 'npm run'} build`)}.` ); console.log(); } diff --git a/packages/react-dev-utils/launchEditor.js b/packages/react-dev-utils/launchEditor.js index 8bfa3f3dcc9..a1893d13bc8 100644 --- a/packages/react-dev-utils/launchEditor.js +++ b/packages/react-dev-utils/launchEditor.js @@ -72,6 +72,12 @@ function getArgumentsForLineNumber(editor, fileName, lineNumber, workspace) { ['-g', fileName + ':' + lineNumber], workspace ); + case 'webstorm': + case 'webstorm64': + return addWorkspaceToArgumentsIfExists( + ['--line', lineNumber, fileName], + workspace + ); } // For all others, drop the lineNumber until we have diff --git a/packages/react-dev-utils/package.json b/packages/react-dev-utils/package.json index f62d87f8bd3..46f3a92033a 100644 --- a/packages/react-dev-utils/package.json +++ b/packages/react-dev-utils/package.json @@ -1,6 +1,6 @@ { "name": "react-dev-utils", - "version": "2.0.1", + "version": "3.0.0", "description": "Webpack utilities used by Create React App", "repository": "facebookincubator/create-react-app", "license": "BSD-3-Clause", diff --git a/packages/react-error-overlay/package.json b/packages/react-error-overlay/package.json index 70a01e3f6b8..88c909e1154 100644 --- a/packages/react-error-overlay/package.json +++ b/packages/react-error-overlay/package.json @@ -1,6 +1,6 @@ { "name": "react-error-overlay", - "version": "1.0.6", + "version": "1.0.7", "description": "An overlay for displaying stack frames.", "main": "lib/index.js", "scripts": { @@ -34,7 +34,7 @@ "anser": "1.2.5", "babel-code-frame": "6.22.0", "babel-runtime": "6.23.0", - "react-dev-utils": "^2.0.1", + "react-dev-utils": "^3.0.0", "settle-promise": "1.0.0", "source-map": "0.5.6" }, diff --git a/packages/react-scripts/config/webpack.config.prod.js b/packages/react-scripts/config/webpack.config.prod.js index 26f84a62b30..963ecfa4a0e 100644 --- a/packages/react-scripts/config/webpack.config.prod.js +++ b/packages/react-scripts/config/webpack.config.prod.js @@ -290,10 +290,11 @@ module.exports = { new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false, - // This feature has been reported as buggy a few times, such as: - // https://github.com/mishoo/UglifyJS2/issues/1964 - // We'll wait with enabling it by default until it is more solid. - reduce_vars: false, + // Disabled because of an issue with Uglify breaking seemingly valid code: + // https://github.com/facebookincubator/create-react-app/issues/2376 + // Pending further investigation: + // https://github.com/mishoo/UglifyJS2/issues/2011 + comparisons: false, }, output: { comments: false, diff --git a/packages/react-scripts/package.json b/packages/react-scripts/package.json index bcfe73ecd10..8390721933c 100644 --- a/packages/react-scripts/package.json +++ b/packages/react-scripts/package.json @@ -1,6 +1,6 @@ { "name": "react-scripts", - "version": "1.0.6", + "version": "1.0.7", "description": "Configuration and scripts for Create React App.", "repository": "facebookincubator/create-react-app", "license": "BSD-3-Clause", @@ -49,12 +49,12 @@ "postcss-flexbugs-fixes": "3.0.0", "postcss-loader": "2.0.5", "promise": "7.1.1", - "react-dev-utils": "^2.0.1", - "react-error-overlay": "^1.0.6", + "react-dev-utils": "^3.0.0", + "react-error-overlay": "^1.0.7", "style-loader": "0.17.0", "sw-precache-webpack-plugin": "0.9.1", "url-loader": "0.5.8", - "webpack": "2.6.0", + "webpack": "2.6.1", "webpack-dev-server": "2.4.5", "webpack-manifest-plugin": "1.1.0", "whatwg-fetch": "2.0.3" diff --git a/packages/react-scripts/scripts/build.js b/packages/react-scripts/scripts/build.js index bc46c71d6da..a83d287ded4 100644 --- a/packages/react-scripts/scripts/build.js +++ b/packages/react-scripts/scripts/build.js @@ -11,6 +11,7 @@ 'use strict'; // Do this as the first thing so that any code reading it knows the right env. +process.env.BABEL_ENV = 'production'; process.env.NODE_ENV = 'production'; // Makes the script crash on unhandled rejections instead of silently diff --git a/packages/react-scripts/scripts/start.js b/packages/react-scripts/scripts/start.js index a451228df8b..b86943b4d9d 100644 --- a/packages/react-scripts/scripts/start.js +++ b/packages/react-scripts/scripts/start.js @@ -10,6 +10,10 @@ // @remove-on-eject-end 'use strict'; +// Do this as the first thing so that any code reading it knows the right env. +process.env.BABEL_ENV = 'development'; +process.env.NODE_ENV = 'development'; + // Makes the script crash on unhandled rejections instead of silently // ignoring them. In the future, promise rejections that are not handled will // terminate the Node.js process with a non-zero exit code. @@ -17,8 +21,6 @@ process.on('unhandledRejection', err => { throw err; }); -process.env.NODE_ENV = 'development'; - // Ensure environment variables are read. require('../config/env'); diff --git a/packages/react-scripts/scripts/test.js b/packages/react-scripts/scripts/test.js index ef333e6c004..e9adb48f0b5 100644 --- a/packages/react-scripts/scripts/test.js +++ b/packages/react-scripts/scripts/test.js @@ -10,6 +10,8 @@ // @remove-on-eject-end 'use strict'; +// Do this as the first thing so that any code reading it knows the right env. +process.env.BABEL_ENV = 'test'; process.env.NODE_ENV = 'test'; process.env.PUBLIC_URL = ''; diff --git a/packages/react-scripts/template/README.md b/packages/react-scripts/template/README.md index a04686c9ce3..ca2879b9c13 100644 --- a/packages/react-scripts/template/README.md +++ b/packages/react-scripts/template/README.md @@ -1171,10 +1171,10 @@ Additionally, you might find [jest-enzyme](https://github.com/blainekasten/enzym expect(wrapper).toContainReact(welcome) ``` -To setup jest-enzyme with Create React App, follow the instructions for [initializing your test environment](#initializing-test-environment) to import `jest-enzyme`. **Note that currently only version 2.x is compatible with Create React App.** +To setup jest-enzyme with Create React App, follow the instructions for [initializing your test environment](#initializing-test-environment) to import `jest-enzyme`. ```sh -npm install --save-dev jest-enzyme@2.x +npm install --save-dev jest-enzyme ``` ```js diff --git a/tasks/e2e-installs.sh b/tasks/e2e-installs.sh index b27b1239eda..8f4789ff0c7 100755 --- a/tasks/e2e-installs.sh +++ b/tasks/e2e-installs.sh @@ -83,6 +83,30 @@ set -x cd .. root_path=$PWD +# Clear cache to avoid issues with incorrect packages being used +if hash yarnpkg 2>/dev/null +then + # AppVeyor uses an old version of yarn. + # Once updated to 0.24.3 or above, the workaround can be removed + # and replaced with `yarnpkg cache clean` + # Issues: + # https://github.com/yarnpkg/yarn/issues/2591 + # https://github.com/appveyor/ci/issues/1576 + # https://github.com/facebookincubator/create-react-app/pull/2400 + # When removing workaround, you may run into + # https://github.com/facebookincubator/create-react-app/issues/2030 + case "$(uname -s)" in + *CYGWIN*|MSYS*|MINGW*) yarn=yarn.cmd;; + *) yarn=yarnpkg;; + esac + $yarn cache clean +fi + +if hash npm 2>/dev/null +then + npm cache clean +fi + # Prevent lerna bootstrap, we only want top-level dependencies cp package.json package.json.bak grep -v "lerna bootstrap" package.json > temp && mv temp package.json diff --git a/tasks/e2e-kitchensink.sh b/tasks/e2e-kitchensink.sh index 2295615e8ea..fcd687e4b0d 100755 --- a/tasks/e2e-kitchensink.sh +++ b/tasks/e2e-kitchensink.sh @@ -22,7 +22,7 @@ temp_module_path=`mktemp -d 2>/dev/null || mktemp -d -t 'temp_module_path'` function cleanup { echo 'Cleaning up.' - ps -ef | grep 'react-scripts' | grep -v grep | awk '{print $2}' | xargs kill -s 9 + ps -ef | grep 'react-scripts' | grep -v grep | awk '{print $2}' | xargs kill -9 cd "$root_path" # TODO: fix "Device or resource busy" and remove ``|| $CI` rm -rf "$temp_cli_path" "$temp_app_path" "$temp_module_path" || $CI @@ -66,6 +66,30 @@ set -x cd .. root_path=$PWD +# Clear cache to avoid issues with incorrect packages being used +if hash yarnpkg 2>/dev/null +then + # AppVeyor uses an old version of yarn. + # Once updated to 0.24.3 or above, the workaround can be removed + # and replaced with `yarnpkg cache clean` + # Issues: + # https://github.com/yarnpkg/yarn/issues/2591 + # https://github.com/appveyor/ci/issues/1576 + # https://github.com/facebookincubator/create-react-app/pull/2400 + # When removing workaround, you may run into + # https://github.com/facebookincubator/create-react-app/issues/2030 + case "$(uname -s)" in + *CYGWIN*|MSYS*|MINGW*) yarn=yarn.cmd;; + *) yarn=yarnpkg;; + esac + $yarn cache clean +fi + +if hash npm 2>/dev/null +then + npm cache clean +fi + # Prevent lerna bootstrap, we only want top-level dependencies cp package.json package.json.bak grep -v "lerna bootstrap" package.json > temp && mv temp package.json @@ -156,7 +180,7 @@ REACT_APP_SHELL_ENV_MESSAGE=fromtheshell \ CI=true \ NODE_PATH=src \ NODE_ENV=test \ - npm test -- --no-cache --testPathPattern="/src/" + npm test -- --no-cache --testPathPattern=src # Test "development" environment tmp_server_log=`mktemp` @@ -220,7 +244,7 @@ REACT_APP_SHELL_ENV_MESSAGE=fromtheshell \ CI=true \ NODE_PATH=src \ NODE_ENV=test \ - npm test -- --no-cache --testPathPattern='/src/' + npm test -- --no-cache --testPathPattern=src # Test "development" environment tmp_server_log=`mktemp` diff --git a/tasks/e2e-simple.sh b/tasks/e2e-simple.sh index 4795d09a8b2..163bec0818a 100755 --- a/tasks/e2e-simple.sh +++ b/tasks/e2e-simple.sh @@ -65,6 +65,30 @@ set -x cd .. root_path=$PWD +# Clear cache to avoid issues with incorrect packages being used +if hash yarnpkg 2>/dev/null +then + # AppVeyor uses an old version of yarn. + # Once updated to 0.24.3 or above, the workaround can be removed + # and replaced with `yarnpkg cache clean` + # Issues: + # https://github.com/yarnpkg/yarn/issues/2591 + # https://github.com/appveyor/ci/issues/1576 + # https://github.com/facebookincubator/create-react-app/pull/2400 + # When removing workaround, you may run into + # https://github.com/facebookincubator/create-react-app/issues/2030 + case "$(uname -s)" in + *CYGWIN*|MSYS*|MINGW*) yarn=yarn.cmd;; + *) yarn=yarnpkg;; + esac + $yarn cache clean +fi + +if hash npm 2>/dev/null +then + npm cache clean +fi + # Prevent lerna bootstrap, we only want top-level dependencies cp package.json package.json.bak grep -v "lerna bootstrap" package.json > temp && mv temp package.json