Skip to content

Commit 8a152ae

Browse files
author
matar
committed
* 'master' of https://github.com/facebookincubator/create-react-app: Resolved issue facebook#2971 (facebook#2989) Revert "run npm 5.4.0 in CI (facebook#3026)" (facebook#3107) Updated react-error-overlay to latest Flow (0.54.0) (facebook#3065) Auto-detect running editor on Linux for error overlay (facebook#3077) Clean target directory before compiling overlay (facebook#3102) Rerun prettier and pin version (facebook#3058) Reload the page when an error has occurred (facebook#3098) run npm 5.4.0 in CI (facebook#3026) Unmapper Windows compatibility (facebook#3079) Update eslint-config npm install command (facebook#3072) Set travis config to use 'precise' ci environment Publish Changelog for 1.0.13 Add missing slash Make error overlay filename configurable (facebook#3028) provide empty mock for child_process so importing libraries with it works (facebook#3033) Rename Overlay to ErrorOvelay (facebook#3051) Strip hash from chunk file name (facebook#3049) Fix error overlay 'Object.assign' issue in IE by including polyfills before webpack client (facebook#3046)
2 parents bdc1366 + 206f9e8 commit 8a152ae

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+315
-189
lines changed

.travis.yml

+5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
---
2+
# Use Ubuntu Precise instead of new default Trusty which cause build fail
3+
# with pre installed yarn v0.17.8
4+
# https://github.com/facebookincubator/create-react-app/issues/3054
5+
# TODO: remove after Trusty environment is updated with a lastet version of yarn
6+
dist: precise
27
language: node_js
38
node_js:
49
- 6

CHANGELOG.md

+51
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,52 @@
1+
## 1.0.13 (September 2, 2017)
2+
3+
#### :bug: Bug Fix
4+
5+
* `react-error-overlay`
6+
7+
* [#3051](https://github.com/facebookincubator/create-react-app/pull/3051) Fix case-sensitivity issue with upgrading the package version. ([@tharakawj](https://github.com/tharakawj))
8+
9+
* `react-dev-utils`
10+
11+
* [#3049](https://github.com/facebookincubator/create-react-app/pull/3049) Print filesize difference for chunks. ([@esturcke](https://github.com/esturcke))
12+
13+
* `react-scripts`
14+
15+
* [#3046](https://github.com/facebookincubator/create-react-app/pull/3046) Fix crash in development mode on IE11. ([@tharakawj](https://github.com/tharakawj))
16+
17+
#### :nail_care: Enhancement
18+
19+
* `react-scripts`
20+
21+
* [#3033](https://github.com/facebookincubator/create-react-app/pull/3033) Add an empty mock for `child_process` to let some libraries compile. ([@McFlurriez](https://github.com/McFlurriez))
22+
23+
#### :house: Internal
24+
25+
* `react-dev-utils`, `react-error-overlay`
26+
27+
* [#3028](https://github.com/facebookincubator/create-react-app/pull/3028) Make error overlay filename configurable. ([@jaredpalmer](https://github.com/jaredpalmer))
28+
29+
#### Committers: 4
30+
31+
- Anthony ([McFlurriez](https://github.com/McFlurriez))
32+
- Erik J. Sturcke ([esturcke](https://github.com/esturcke))
33+
- Jared Palmer ([jaredpalmer](https://github.com/jaredpalmer))
34+
- Tharaka Wijebandara ([tharakawj](https://github.com/tharakawj))
35+
36+
### Migrating from 1.0.12 to 1.0.13
37+
38+
Inside any created project that has not been ejected, run:
39+
40+
```
41+
npm install --save --save-exact [email protected]
42+
```
43+
44+
or
45+
46+
```
47+
yarn add --exact [email protected]
48+
```
49+
150
## 1.0.12 (August 28, 2017)
251

352
#### :bug: Bug Fix
@@ -62,6 +111,8 @@ or
62111
yarn add --exact [email protected]
63112
```
64113

114+
**Note:** there’s a [known issue](https://github.com/facebookincubator/create-react-app/issues/3041) that might cause the project to not compile after upgrading. In this case, migrate straight to `1.0.13` which doesn’t have this issue.
115+
65116
## 1.0.11 (August 9, 2017)
66117

67118
#### :bug: Bug Fix

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"lerna": "^2.0.0",
2020
"lerna-changelog": "^0.6.0",
2121
"lint-staged": "^3.3.1",
22-
"prettier": "^1.5.2"
22+
"prettier": "1.6.1"
2323
},
2424
"lint-staged": {
2525
"*.js": [

packages/create-react-app/createReactApp.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,9 @@ function checkNpmVersion() {
455455
let hasMinNpm = false;
456456
let npmVersion = null;
457457
try {
458-
npmVersion = execSync('npm --version').toString().trim();
458+
npmVersion = execSync('npm --version')
459+
.toString()
460+
.trim();
459461
hasMinNpm = semver.gte(npmVersion, '3.0.0');
460462
} catch (err) {
461463
// ignore

packages/eslint-config-react-app/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ If you want to use this ESLint configuration in a project not built with Create
1919
First, install this package, ESLint and the necessary plugins.
2020

2121
```sh
22-
npm install --save-dev eslint-config-react-app [email protected] eslint@3.19.0 eslint-plugin-flowtype@2.33.0 eslint-plugin-import@2.2.0 eslint-plugin-jsx-a11y@5.0.1 eslint-plugin-react@7.0.1
22+
npm install --save-dev eslint-config-react-app babel-eslint@^7.2.3 eslint@^4.1.1 eslint-plugin-flowtype@^2.34.1 eslint-plugin-import@^2.6.0 eslint-plugin-jsx-a11y@^5.1.1 eslint-plugin-react@^7.1.0
2323
```
2424

2525
Then create a file named `.eslintrc` with following contents in the root folder of your project:

packages/react-dev-utils/FileSizeReporter.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,10 @@ function printFileSizesAfterBuild(
9292
function removeFileNameHash(buildFolder, fileName) {
9393
return fileName
9494
.replace(buildFolder, '')
95-
.replace(/\/?(.*)(\.\w+)(\.js|\.css)/, (match, p1, p2, p3) => p1 + p3);
95+
.replace(
96+
/\/?(.*)(\.[0-9a-f]+)(\.chunk)?(\.js|\.css)/,
97+
(match, p1, p2, p3, p4) => p1 + p4
98+
);
9699
}
97100

98101
// Input: 1024, 2048

packages/react-dev-utils/launchEditor.js

+33-4
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const COMMON_EDITORS_OSX = {
4343
'/Applications/CLion.app/Contents/MacOS/clion':
4444
'/Applications/CLion.app/Contents/MacOS/clion',
4545
'/Applications/IntelliJ IDEA.app/Contents/MacOS/idea':
46-
'/Applications/IntelliJ IDEA.app/Contents/MacOS/idea',
46+
'/Applications/IntelliJ IDEA.app/Contents/MacOS/idea',
4747
'/Applications/PhpStorm.app/Contents/MacOS/phpstorm':
4848
'/Applications/PhpStorm.app/Contents/MacOS/phpstorm',
4949
'/Applications/PyCharm.app/Contents/MacOS/pycharm':
@@ -53,7 +53,21 @@ const COMMON_EDITORS_OSX = {
5353
'/Applications/RubyMine.app/Contents/MacOS/rubymine':
5454
'/Applications/RubyMine.app/Contents/MacOS/rubymine',
5555
'/Applications/WebStorm.app/Contents/MacOS/webstorm':
56-
'/Applications/WebStorm.app/Contents/MacOS/webstorm',
56+
'/Applications/WebStorm.app/Contents/MacOS/webstorm',
57+
};
58+
59+
const COMMON_EDITORS_LINUX = {
60+
atom: 'atom',
61+
Brackets: 'brackets',
62+
code: 'code',
63+
emacs: 'emacs',
64+
'idea.sh': 'idea',
65+
'phpstorm.sh': 'phpstorm',
66+
'pycharm.sh': 'pycharm',
67+
'rubymine.sh': 'rubymine',
68+
sublime_text: 'sublime_text',
69+
vim: 'vim',
70+
'webstorm.sh': 'webstorm',
5771
};
5872

5973
const COMMON_EDITORS_WIN = [
@@ -144,8 +158,9 @@ function guessEditor() {
144158
return shellQuote.parse(process.env.REACT_EDITOR);
145159
}
146160

147-
// Using `ps x` on OSX or `Get-Process` on Windows we can find out which editor is currently running.
148-
// Potentially we could use similar technique for Linux
161+
// We can find out which editor is currently running by:
162+
// `ps x` on macOS and Linux
163+
// `Get-Process` on Windows
149164
try {
150165
if (process.platform === 'darwin') {
151166
const output = child_process.execSync('ps x').toString();
@@ -176,6 +191,20 @@ function guessEditor() {
176191
return [fullProcessPath];
177192
}
178193
}
194+
} else if (process.platform === 'linux') {
195+
// --no-heading No header line
196+
// x List all processes owned by you
197+
// -o comm Need only names column
198+
const output = child_process
199+
.execSync('ps x --no-heading -o comm --sort=comm')
200+
.toString();
201+
const processNames = Object.keys(COMMON_EDITORS_LINUX);
202+
for (let i = 0; i < processNames.length; i++) {
203+
const processName = processNames[i];
204+
if (output.indexOf(processName) !== -1) {
205+
return [COMMON_EDITORS_LINUX[processName]];
206+
}
207+
}
179208
}
180209
} catch (error) {
181210
// Ignore...

packages/react-dev-utils/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-dev-utils",
3-
"version": "4.0.0",
3+
"version": "4.0.1",
44
"description": "Webpack utilities used by Create React App",
55
"repository": "facebookincubator/create-react-app",
66
"license": "BSD-3-Clause",
@@ -47,7 +47,7 @@
4747
"inquirer": "3.2.1",
4848
"is-root": "1.0.0",
4949
"opn": "5.1.0",
50-
"react-error-overlay": "^2.0.0",
50+
"react-error-overlay": "^2.0.1",
5151
"recursive-readdir": "2.2.1",
5252
"shell-quote": "1.6.1",
5353
"sockjs-client": "1.1.4",

packages/react-dev-utils/webpackHotDevClient.js

+10-5
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,19 @@ var launchEditorEndpoint = require('./launchEditorEndpoint');
2525
var formatWebpackMessages = require('./formatWebpackMessages');
2626
var ErrorOverlay = require('react-error-overlay');
2727

28+
// We need to keep track of if there has been a runtime error.
29+
// Essentially, we cannot guarantee application state was not corrupted by the
30+
// runtime error. To prevent confusing behavior, we forcibly reload the entire
31+
// application. This is handled below when we are notified of a compile (code
32+
// change).
33+
// See https://github.com/facebookincubator/create-react-app/issues/3096
34+
var hadRuntimeError = false;
2835
ErrorOverlay.startReportingRuntimeErrors({
2936
launchEditorEndpoint: launchEditorEndpoint,
3037
onError: function() {
31-
// TODO: why do we need this?
32-
if (module.hot && typeof module.hot.decline === 'function') {
33-
module.hot.decline();
34-
}
38+
hadRuntimeError = true;
3539
},
40+
filename: '/static/js/bundle.js',
3641
});
3742

3843
if (module.hot && typeof module.hot.dispose === 'function') {
@@ -226,7 +231,7 @@ function tryApplyUpdates(onHotUpdateSuccess) {
226231
}
227232

228233
function handleApplyUpdates(err, updatedModules) {
229-
if (err || !updatedModules) {
234+
if (err || !updatedModules || hadRuntimeError) {
230235
window.location.reload();
231236
return;
232237
}

packages/react-error-overlay/package.json

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"name": "react-error-overlay",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"description": "An overlay for displaying stack frames.",
55
"main": "lib/index.js",
66
"scripts": {
77
"prepublishOnly": "npm run build:prod && npm test",
8-
"start": "cross-env NODE_ENV=development npm run build -- --watch",
8+
"start": "rimraf lib/ && cross-env NODE_ENV=development npm run build -- --watch",
99
"test": "flow && jest",
10-
"build": "babel src/ -d lib/",
11-
"build:prod": "cross-env NODE_ENV=production babel src/ -d lib/"
10+
"build": "rimraf lib/ && babel src/ -d lib/",
11+
"build:prod": "rimraf lib/ && cross-env NODE_ENV=production babel src/ -d lib/"
1212
},
1313
"repository": "facebookincubator/create-react-app",
1414
"license": "BSD-3-Clause",
@@ -51,9 +51,10 @@
5151
"eslint-plugin-import": "2.7.0",
5252
"eslint-plugin-jsx-a11y": "5.1.1",
5353
"eslint-plugin-react": "7.1.0",
54-
"flow-bin": "0.52.0",
54+
"flow-bin": "^0.54.0",
5555
"jest": "20.0.4",
56-
"jest-fetch-mock": "1.2.1"
56+
"jest-fetch-mock": "1.2.1",
57+
"rimraf": "^2.6.1"
5758
},
5859
"jest": {
5960
"setupFiles": [

packages/react-error-overlay/src/components/Collapsible.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
import React, { Component } from 'react';
1212
import { black } from '../styles';
1313

14+
import type { Element as ReactElement } from 'react';
15+
1416
const _collapsibleStyle = {
1517
color: black,
1618
cursor: 'pointer',
@@ -35,7 +37,15 @@ const collapsibleExpandedStyle = {
3537
marginBottom: '0.6em',
3638
};
3739

38-
class Collapsible extends Component {
40+
type Props = {|
41+
children: ReactElement<any>[],
42+
|};
43+
44+
type State = {|
45+
collapsed: boolean,
46+
|};
47+
48+
class Collapsible extends Component<Props, State> {
3949
state = {
4050
collapsed: true,
4151
};

packages/react-error-overlay/src/components/Overlay.js packages/react-error-overlay/src/components/ErrorOverlay.js

+14-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
import React, { Component } from 'react';
1212
import { black } from '../styles';
1313

14+
import type { Node as ReactNode } from 'react';
15+
1416
const overlayStyle = {
1517
position: 'relative',
1618
display: 'inline-flex',
@@ -31,10 +33,19 @@ const overlayStyle = {
3133
color: black,
3234
};
3335

34-
class Overlay extends Component {
36+
type Props = {|
37+
children: ReactNode,
38+
shortcutHandler?: (eventKey: string) => void,
39+
|};
40+
41+
type State = {|
42+
collapsed: boolean,
43+
|};
44+
45+
class ErrorOverlay extends Component<Props, State> {
3546
iframeWindow: window = null;
3647

37-
getIframeWindow = (element: HTMLDivElement) => {
48+
getIframeWindow = (element: ?HTMLDivElement) => {
3849
if (element) {
3950
const document = element.ownerDocument;
4051
this.iframeWindow = document.defaultView;
@@ -71,4 +82,4 @@ class Overlay extends Component {
7182
}
7283
}
7384

74-
export default Overlay;
85+
export default ErrorOverlay;

packages/react-error-overlay/src/components/Header.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,7 @@ type HeaderPropType = {|
2929
|};
3030

3131
function Header(props: HeaderPropType) {
32-
return (
33-
<div style={headerStyle}>
34-
{props.headerText}
35-
</div>
36-
);
32+
return <div style={headerStyle}>{props.headerText}</div>;
3733
}
3834

3935
export default Header;

packages/react-error-overlay/src/containers/CompileErrorContainer.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,25 @@
99

1010
/* @flow */
1111
import React, { PureComponent } from 'react';
12-
import Overlay from '../components/Overlay';
12+
import ErrorOverlay from '../components/ErrorOverlay';
1313
import Footer from '../components/Footer';
1414
import Header from '../components/Header';
1515
import CodeBlock from '../components/CodeBlock';
1616
import generateAnsiHTML from '../utils/generateAnsiHTML';
1717

18-
class CompileErrorContainer extends PureComponent {
18+
type Props = {|
19+
error: string,
20+
|};
21+
22+
class CompileErrorContainer extends PureComponent<Props, void> {
1923
render() {
2024
const { error } = this.props;
2125
return (
22-
<Overlay>
26+
<ErrorOverlay>
2327
<Header headerText="Failed to compile" />
2428
<CodeBlock main={true} codeHTML={generateAnsiHTML(error)} />
2529
<Footer line1="This error occurred during the build time and cannot be dismissed." />
26-
</Overlay>
30+
</ErrorOverlay>
2731
);
2832
}
2933
}

packages/react-error-overlay/src/containers/RuntimeError.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@
1111
import React from 'react';
1212
import Header from '../components/Header';
1313
import StackTrace from './StackTrace';
14+
1415
import type { StackFrame } from '../utils/stack-frame';
1516

1617
const wrapperStyle = {
1718
display: 'flex',
1819
flexDirection: 'column',
1920
};
2021

21-
type ErrorRecord = {|
22+
export type ErrorRecord = {|
2223
error: Error,
2324
unhandledRejection: boolean,
2425
contextSize: number,

0 commit comments

Comments
 (0)