Skip to content

Commit

Permalink
Merge branch 'master' into zangrafx
Browse files Browse the repository at this point in the history
* master:
  Add WebStorm >2017 launchEditor Support (facebook#2414)
  docs: update `jest-enzyme` section (facebook#2392)
  Fix detection of parent directory in ModuleScopePlugin (facebook#2405)
  Added cache clear to e2e scripts (facebook#2400)
  Fix kill command in e2e-kitchensink.sh cleanup (facebook#2397)
  Revert "Catch "No tests found" during CI" (facebook#2390)
  Fix wrong path expansion in end-to-end test (facebook#2388)
  Suggest just "yarn build" (facebook#2385)
  Catch "No tests found" during CI (facebook#2387)
  Publish
  Add changelog for 1.0.7 (facebook#2384)
  Update webpack to 2.6.1 (facebook#2383)
  Consistently set environment variables (facebook#2382)
  Disable comparisons feature in uglify compression in production (facebook#2379)
  Removed the overriding of reduce_vars to false since webpack v2.6.0 included the fixed for Uglify bug (facebook#2351)
  • Loading branch information
zangrafx committed May 31, 2017
2 parents d0fc718 + 0da313f commit 5411717
Show file tree
Hide file tree
Showing 15 changed files with 161 additions and 21 deletions.
50 changes: 50 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
10 changes: 8 additions & 2 deletions packages/react-dev-utils/ModuleScopePlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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. ` +
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dev-utils/WebpackDevServerUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
6 changes: 6 additions & 0 deletions packages/react-dev-utils/launchEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dev-utils/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 2 additions & 2 deletions packages/react-error-overlay/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down Expand Up @@ -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"
},
Expand Down
9 changes: 5 additions & 4 deletions packages/react-scripts/config/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions packages/react-scripts/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions packages/react-scripts/scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions packages/react-scripts/scripts/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@
// @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.
process.on('unhandledRejection', err => {
throw err;
});

process.env.NODE_ENV = 'development';

// Ensure environment variables are read.
require('../config/env');

Expand Down
2 changes: 2 additions & 0 deletions packages/react-scripts/scripts/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '';

Expand Down
4 changes: 2 additions & 2 deletions packages/react-scripts/template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 24 additions & 0 deletions tasks/e2e-installs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 27 additions & 3 deletions tasks/e2e-kitchensink.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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`
Expand Down Expand Up @@ -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`
Expand Down
24 changes: 24 additions & 0 deletions tasks/e2e-simple.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5411717

Please sign in to comment.