Skip to content
This repository was archived by the owner on Oct 19, 2022. It is now read-only.

Commit 0af394b

Browse files
author
Dominik Rowicki
authored
Merge pull request #14 from netguru/facebookincubator-master
Merge changes from upstream
2 parents 7f77950 + 5270de6 commit 0af394b

24 files changed

+311
-88
lines changed

CHANGELOG.md

Lines changed: 115 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,114 @@
1+
## 1.0.11 (2017-08-09)
2+
3+
#### :bug: Bug Fix
4+
* `create-react-app`
5+
* [#2884](https://github.com/facebookincubator/create-react-app/pull/2884) Improve offline heuristic for proxied environments. ([@bsyk](https://github.com/bsyk))
6+
7+
When a Yarn proxy is set, we will check its connectivity if we cannot reach Yarn's registry. This is often the case when DNS lookups must be made through the proxy.
8+
9+
* [#2853](https://github.com/facebookincubator/create-react-app/pull/2853) Allow use of scoped packages with a pinned version. ([@wileybenet](https://github.com/wileybenet))
10+
* `react-dev-utils`
11+
* [#2796](https://github.com/facebookincubator/create-react-app/pull/2796) Properly escape HTML tags in error overlay. ([@ccloli](https://github.com/ccloli))
12+
13+
Elements printed in their entirety would sometimes render as HTML. This should no longer happen and should properly render as text.
14+
15+
* `react-dev-utils`, `react-scripts`
16+
* [#2834](https://github.com/facebookincubator/create-react-app/pull/2834) Make `formatWebpackMessages` return all messages ([@onigoetz](https://github.com/onigoetz))
17+
* `react-scripts`
18+
* [#2806](https://github.com/facebookincubator/create-react-app/pull/2806) Fix SockJS version compatibility. ([@christianbundy](https://github.com/christianbundy))
19+
* [#2738](https://github.com/facebookincubator/create-react-app/pull/2738) Fix Jest `node` file resolution. ([@mostafah](https://github.com/mostafah))
20+
21+
#### :nail_care: Enhancement
22+
* `react-scripts`
23+
* [#2818](https://github.com/facebookincubator/create-react-app/pull/2818) Allow sourcemaps to be disabled. ([@viankakrisna](https://github.com/viankakrisna))
24+
25+
As applications grow more complex, it is possible webpack may run out of memory while generating source maps. They may now be disabled by setting `GENERATE_SOURCEMAP=false`.
26+
27+
* [#2913](https://github.com/facebookincubator/create-react-app/pull/2913) Allow flags to be passed to node when running `react-scripts`. ([@koistya](https://github.com/koistya))
28+
* [#2574](https://github.com/facebookincubator/create-react-app/pull/2574) Upgrade to `webpack@3`. ([@themre](https://github.com/themre))
29+
* [#2747](https://github.com/facebookincubator/create-react-app/pull/2747) Simplify webpack configuration using `Rule.oneOf`. ([@Furizaa](https://github.com/Furizaa))
30+
* `react-dev-utils`, `react-scripts`
31+
* [#2468](https://github.com/facebookincubator/create-react-app/pull/2468) Allow importing `package.json`. ([@iamdoron](https://github.com/iamdoron))
32+
* [#2650](https://github.com/facebookincubator/create-react-app/pull/2650) Make UglifyJS error friendlier. ([@viankakrisna](https://github.com/viankakrisna))
33+
* `create-react-app`
34+
* [#2785](https://github.com/facebookincubator/create-react-app/pull/2785) Change error wording and list conflicting files when initializing app. ([@OwenFlood](https://github.com/OwenFlood))
35+
* `react-dev-utils`
36+
* [#2761](https://github.com/facebookincubator/create-react-app/pull/2761) Don't prompt to install serve if already installed. ([@OwenFlood](https://github.com/OwenFlood))
37+
* [#2754](https://github.com/facebookincubator/create-react-app/pull/2754) Auto-detect JetBrains IDEs. ([@danrr](https://github.com/danrr))
38+
* [#2740](https://github.com/facebookincubator/create-react-app/pull/2740) Support PyCharm in `launchEditor`. ([@danrr](https://github.com/danrr))
39+
* [#2723](https://github.com/facebookincubator/create-react-app/pull/2723) Reorder vim arguments in `launchEditor` so `--remote` works. ([@trygveaa](https://github.com/trygveaa))
40+
* `eslint-config-react-app`, `react-scripts`
41+
* [#2735](https://github.com/facebookincubator/create-react-app/pull/2735) Upgrade to `eslint@4`. ([@trungdq88](https://github.com/trungdq88))
42+
* `eslint-config-react-app`
43+
* [#2701](https://github.com/facebookincubator/create-react-app/pull/2701) Set `allowTaggedTemplates` to true (eslint). ([@denkristoffer](https://github.com/denkristoffer))
44+
45+
#### :memo: Documentation
46+
* Other
47+
* [#2728](https://github.com/facebookincubator/create-react-app/pull/2728) Add Electrode to alternatives. ([@animesh10](https://github.com/animesh10))
48+
* [#2788](https://github.com/facebookincubator/create-react-app/pull/2788) Update link for motion. ([@viankakrisna](https://github.com/viankakrisna))
49+
* [#2697](https://github.com/facebookincubator/create-react-app/pull/2697) Fix env list ordering. ([@alexeyraspopov](https://github.com/alexeyraspopov))
50+
* `react-dev-utils`
51+
* [#2798](https://github.com/facebookincubator/create-react-app/pull/2798) Update note about `webpackHotDevClient` support. ([@ForbesLindesay](https://github.com/ForbesLindesay))
52+
* `react-scripts`
53+
* [#2822](https://github.com/facebookincubator/create-react-app/pull/2822) Add explicit "Opting Out of Caching" header. ([@gaearon](https://github.com/gaearon))
54+
* [#2725](https://github.com/facebookincubator/create-react-app/pull/2725) Fixed typo. ([@zeel](https://github.com/zeel))
55+
* [#2668](https://github.com/facebookincubator/create-react-app/pull/2668) Document `basename` feature in `react-router`. ([@viankakrisna](https://github.com/viankakrisna))
56+
* [#2719](https://github.com/facebookincubator/create-react-app/pull/2719) Remove Windows note for `source-map-explorer`. ([@hodanny](https://github.com/hodanny))
57+
* `babel-preset-react-app`
58+
* [#2732](https://github.com/facebookincubator/create-react-app/pull/2732) Update link to issue blocking JSX hoisting. ([@ForbesLindesay](https://github.com/ForbesLindesay))
59+
60+
#### :house: Internal
61+
* `create-react-app`, `eslint-config-react-app`, `react-dev-utils`, `react-error-overlay`, `react-scripts`
62+
* [#2923](https://github.com/facebookincubator/create-react-app/pull/2923) Update deps. ([@Timer](https://github.com/Timer))
63+
* `eslint-config-react-app`
64+
* [#2718](https://github.com/facebookincubator/create-react-app/pull/2718) Re-enable flowtype warning. ([@oskarkook](https://github.com/oskarkook))
65+
* Other
66+
* [#2700](https://github.com/facebookincubator/create-react-app/pull/2700) Unstage `yarn.lock` pre-commit. ([@jdcrensh](https://github.com/jdcrensh))
67+
* `react-scripts`
68+
* [#2873](https://github.com/facebookincubator/create-react-app/pull/2873) Use template strings. ([@monkindey](https://github.com/monkindey))
69+
70+
#### Committers: 26
71+
- 864907600cc ([ccloli](https://github.com/ccloli))
72+
- Ade Viankakrisna Fadlil ([viankakrisna](https://github.com/viankakrisna))
73+
- Alexey Raspopov ([alexeyraspopov](https://github.com/alexeyraspopov))
74+
- Andreas Hoffmann ([Furizaa](https://github.com/Furizaa))
75+
- Animesh Dutta ([animesh10](https://github.com/animesh10))
76+
- Ben Sykes ([bsyk](https://github.com/bsyk))
77+
- Christian Bundy ([christianbundy](https://github.com/christianbundy))
78+
- Dan Abramov ([gaearon](https://github.com/gaearon))
79+
- Dan Ristea ([danrr](https://github.com/danrr))
80+
- Danny Ho ([hodanny](https://github.com/hodanny))
81+
- Forbes Lindesay ([ForbesLindesay](https://github.com/ForbesLindesay))
82+
- Joe Haddad ([Timer](https://github.com/Timer))
83+
- Jon Crenshaw ([jdcrensh](https://github.com/jdcrensh))
84+
- Kiho · Cham ([monkindey](https://github.com/monkindey))
85+
- Konstantin Tarkus ([koistya](https://github.com/koistya))
86+
- Kristoffer ([denkristoffer](https://github.com/denkristoffer))
87+
- Mostafa Hajizadeh ([mostafah](https://github.com/mostafah))
88+
- Oskar Köök ([oskarkook](https://github.com/oskarkook))
89+
- Owen Flood ([OwenFlood](https://github.com/OwenFlood))
90+
- Stéphane Goetz ([onigoetz](https://github.com/onigoetz))
91+
- Trygve Aaberge ([trygveaa](https://github.com/trygveaa))
92+
- Wiley Bennett ([wileybenet](https://github.com/wileybenet))
93+
- [iamdoron](https://github.com/iamdoron)
94+
- [themre](https://github.com/themre)
95+
- zeel ([zeel](https://github.com/zeel))
96+
- Đinh Quang Trung ([trungdq88](https://github.com/trungdq88))
97+
98+
### Migrating from 1.0.10 to 1.0.11
99+
100+
Inside any created project that has not been ejected, run:
101+
102+
```
103+
npm install --save --save-exact [email protected]
104+
```
105+
106+
or
107+
108+
```
109+
yarn add --exact [email protected]
110+
```
111+
1112
## 1.0.10 (June 29, 2017)
2113

3114
#### :bug: Bug Fix
@@ -110,7 +221,7 @@ yarn add --exact [email protected]
110221
* [#2600](https://github.com/facebookincubator/create-react-app/pull/2600) Add empty mock for `dgram` Node module. ([@micopiira](https://github.com/micopiira))
111222
* [#2458](https://github.com/facebookincubator/create-react-app/pull/2458) Add names to module factories in development. ([@Zaccc123](https://github.com/Zaccc123))
112223
* [#2551](https://github.com/facebookincubator/create-react-app/pull/2551) In new projects, unregister service worker and force reload if `service-worker.js` is not found. ([@ro-savage](https://github.com/ro-savage))
113-
224+
114225
* `babel-preset-react-app`, `react-dev-utils`, `react-scripts`
115226

116227
* [#2658](https://github.com/facebookincubator/create-react-app/pull/2658) Bump dependencies. ([@gaearon](https://github.com/gaearon))
@@ -119,7 +230,7 @@ yarn add --exact [email protected]
119230

120231
* [#2657](https://github.com/facebookincubator/create-react-app/pull/2657) Put `react-scripts` in `dependencies`, not `devDependencies`. ([@gaearon](https://github.com/gaearon))
121232
* [#2635](https://github.com/facebookincubator/create-react-app/pull/2635) Silence unhelpful npm warnings. ([@gaearon](https://github.com/gaearon))
122-
233+
123234
* `react-dev-utils`
124235

125236
* [#2637](https://github.com/facebookincubator/create-react-app/pull/2637) Auto-detect Brackets editor from error overlay. ([@petetnt](https://github.com/petetnt))
@@ -176,7 +287,7 @@ yarn add --exact [email protected]
176287
* [#2397](https://github.com/facebookincubator/create-react-app/pull/2397) Fix command in e2e-kitchensink.sh cleanup. ([@ro-savage](https://github.com/ro-savage))
177288
* [#2388](https://github.com/facebookincubator/create-react-app/pull/2388) Fix wrong path expansion in end-to-end test. ([@gaearon](https://github.com/gaearon))
178289
* [#2387](https://github.com/facebookincubator/create-react-app/pull/2387) Catch "No tests found" during CI. ([@EnoahNetzach](https://github.com/EnoahNetzach))
179-
290+
180291
* `react-scripts`
181292

182293
* [#2408](https://github.com/facebookincubator/create-react-app/pull/2408) E2E testing enhancements. ([@EnoahNetzach](https://github.com/EnoahNetzach))
@@ -573,7 +684,7 @@ yarn add --dev --exact [email protected]
573684

574685
We’ve been working on this release for the past few months, and there are many big impovements, from migrating to webpack 2 to a brand new runtime error overlay and built-in support for Progressive Web Apps.
575686

576-
So instead of just enumerating them here, we decided to write a blog post about all the new features.
687+
So instead of just enumerating them here, we decided to write a blog post about all the new features.<br>
577688
Check it out: **[What’s New in Create React App](https://facebook.github.io/react/blog/2017/05/18/whats-new-in-create-react-app.html)**.
578689

579690
Have you read it? Now let's see how to update your app to the latest version.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,4 @@ to:
5656
#### 3. SCSS and CSS Modules, WTF?
5757
With this approach we can benefit from what is best from those two worlds. We can use SCSS syntax for mixins, variables etc. and still have our rules scoped to the component ;)
5858

59-
How to use it? Since there is no global scope we need to implicitly import our variables/mixins etc. Check the `src/Components/App/style.scss` file. On the first line it imports the shared styles with variables and mixins.
59+
How to use it? Since there is no global scope we need to implicitly import our variables/mixins etc. Check the `src/Components/App/style.scss` file. On the first line it imports the shared styles with variables and mixins.

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"lerna": "2.0.0-rc.5",
2+
"lerna": "2.0.0",
33
"version": "independent",
44
"changelog": {
55
"repo": "facebookincubator/create-react-app",

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,20 @@
1414
"precommit": "lint-staged"
1515
},
1616
"devDependencies": {
17-
"eslint": "3.19.0",
17+
"eslint": "^4.4.1",
1818
"husky": "^0.13.2",
19-
"lerna": "2.0.0-rc.5",
20-
"lerna-changelog": "^0.2.3",
19+
"lerna": "^2.0.0",
20+
"lerna-changelog": "^0.6.0",
2121
"lint-staged": "^3.3.1",
2222
"prettier": "^1.5.2"
2323
},
2424
"lint-staged": {
2525
"*.js": [
2626
"prettier --trailing-comma es5 --single-quote --write",
2727
"git add"
28+
],
29+
"yarn.lock": [
30+
"git rm --cached"
2831
]
2932
}
3033
}

packages/babel-preset-react-app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "babel-preset-react-app",
3-
"version": "3.0.1",
3+
"version": "3.0.2",
44
"description": "Babel preset used by Create React App",
55
"repository": "facebookincubator/create-react-app",
66
"license": "BSD-3-Clause",

packages/create-react-app/createReactApp.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ const semver = require('semver');
4747
const dns = require('dns');
4848
const tmp = require('tmp');
4949
const unpack = require('tar-pack').unpack;
50+
const url = require('url');
5051
const hyperquest = require('hyperquest');
5152

5253
const packageJson = require('./package.json');
@@ -440,8 +441,8 @@ function getPackageName(installPackage) {
440441
// Pull package name out of git urls e.g:
441442
// git+https://github.com/mycompany/react-scripts.git
442443
// git+ssh://github.com/mycompany/react-scripts.git#v1.2.3
443-
return Promise.resolve(installPackage.match(/([^\/]+)\.git(#.*)?$/)[1]);
444-
} else if (installPackage.indexOf('@') > 0) {
444+
return Promise.resolve(installPackage.match(/([^/]+)\.git(#.*)?$/)[1]);
445+
} else if (installPackage.match(/.+@/)) {
445446
// Do not match @scope/ when stripping off @version or @tag
446447
return Promise.resolve(
447448
installPackage.charAt(0) + installPackage.substr(1).split('@')[0]
@@ -614,7 +615,15 @@ function checkIfOnline(useYarn) {
614615

615616
return new Promise(resolve => {
616617
dns.lookup('registry.yarnpkg.com', err => {
617-
resolve(err === null);
618+
if (err != null && process.env.https_proxy) {
619+
// If a proxy is defined, we likely can't resolve external hostnames.
620+
// Try to resolve the proxy name as an indication of a connection.
621+
dns.lookup(url.parse(process.env.https_proxy).hostname, proxyErr => {
622+
resolve(proxyErr == null);
623+
});
624+
} else {
625+
resolve(err == null);
626+
}
618627
});
619628
});
620629
}

packages/create-react-app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "create-react-app",
3-
"version": "1.3.3",
3+
"version": "1.4.0",
44
"keywords": [
55
"react"
66
],

packages/eslint-config-react-app/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,7 @@ module.exports = {
291291

292292
// https://github.com/gajus/eslint-plugin-flowtype
293293
'flowtype/define-flow-type': 'warn',
294-
// TODO: Reenable once https://github.com/gajus/eslint-plugin-flowtype/issues/165 is fixed
295-
//'flowtype/require-valid-file-annotation': 'warn',
294+
'flowtype/require-valid-file-annotation': 'warn',
296295
'flowtype/use-flow-type': 'warn',
297296
},
298297
};
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eslint-config-react-app",
3-
"version": "1.0.5",
3+
"version": "2.0.0",
44
"description": "ESLint configuration used by Create React App",
55
"repository": "facebookincubator/create-react-app",
66
"license": "BSD-3-Clause",
@@ -13,9 +13,9 @@
1313
"peerDependencies": {
1414
"babel-eslint": "^7.2.3",
1515
"eslint": "^4.1.1",
16-
"eslint-plugin-flowtype": "^2.33.0",
17-
"eslint-plugin-import": "^2.2.0",
18-
"eslint-plugin-jsx-a11y": "^5.0.3",
19-
"eslint-plugin-react": "^7.0.1"
16+
"eslint-plugin-flowtype": "^2.34.1",
17+
"eslint-plugin-import": "^2.6.0",
18+
"eslint-plugin-jsx-a11y": "^5.1.1",
19+
"eslint-plugin-react": "^7.1.0"
2020
}
2121
}

packages/react-dev-utils/ModuleScopePlugin.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ const chalk = require('chalk');
1313
const path = require('path');
1414

1515
class ModuleScopePlugin {
16-
constructor(appSrc) {
16+
constructor(appSrc, allowedFiles = []) {
1717
this.appSrc = appSrc;
18+
this.allowedFiles = new Set(allowedFiles);
1819
}
1920

2021
apply(resolver) {
@@ -40,15 +41,16 @@ class ModuleScopePlugin {
4041
if (relative.startsWith('../') || relative.startsWith('..\\')) {
4142
return callback();
4243
}
43-
// Find path from src to the requested file
44-
const requestRelative = path.relative(
45-
appSrc,
46-
path.resolve(
47-
path.dirname(request.context.issuer),
48-
request.__innerRequest_request
49-
)
44+
const requestFullPath = path.resolve(
45+
path.dirname(request.context.issuer),
46+
request.__innerRequest_request
5047
);
48+
if (this.allowedFiles.has(requestFullPath)) {
49+
return callback();
50+
}
51+
// Find path from src to the requested file
5152
// Error if in a parent directory of src/
53+
const requestRelative = path.relative(appSrc, requestFullPath);
5254
if (
5355
requestRelative.startsWith('../') ||
5456
requestRelative.startsWith('..\\')

packages/react-dev-utils/README.md

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ module.exports = {
5757
```
5858

5959

60-
#### `new ModuleScopePlugin(appSrc: string)`
60+
#### `new ModuleScopePlugin(appSrc: string, allowedFiles?: string[])`
6161

6262
This Webpack plugin ensures that relative imports from app's source directory don't reach outside of it.
6363

@@ -71,7 +71,7 @@ module.exports = {
7171
resolve: {
7272
// ...
7373
plugins: [
74-
new ModuleScopePlugin(paths.appSrc),
74+
new ModuleScopePlugin(paths.appSrc, [paths.appPackageJson]),
7575
// ...
7676
],
7777
// ...
@@ -170,9 +170,9 @@ module: {
170170

171171
Captures JS and CSS asset sizes inside the passed `buildFolder`. Save the result value to compare it after the build.
172172

173-
##### `printFileSizesAfterBuild(webpackStats: WebpackStats, previousFileSizes: OpaqueFileSizes)`
173+
##### `printFileSizesAfterBuild(webpackStats: WebpackStats, previousFileSizes: OpaqueFileSizes, buildFolder: string, maxBundleGzipSize?: number, maxChunkGzipSize?: number)`
174174

175-
Prints the JS and CSS asset sizes after the build, and includes a size comparison with `previousFileSizes` that were captured earlier using `measureFileSizesBeforeBuild()`.
175+
Prints the JS and CSS asset sizes after the build, and includes a size comparison with `previousFileSizes` that were captured earlier using `measureFileSizesBeforeBuild()`. `maxBundleGzipSize` and `maxChunkGzipSizemay` may optionally be specified to display a warning when the main bundle or a chunk exceeds the specified size (in bytes).
176176

177177
```js
178178
var {
@@ -182,7 +182,7 @@ var {
182182

183183
measureFileSizesBeforeBuild(buildFolder).then(previousFileSizes => {
184184
return cleanAndRebuild().then(webpackStats => {
185-
printFileSizesAfterBuild(webpackStats, previousFileSizes);
185+
printFileSizesAfterBuild(webpackStats, previousFileSizes, buildFolder);
186186
});
187187
});
188188
```
@@ -220,6 +220,20 @@ compiler.plugin('done', function(stats) {
220220
});
221221
```
222222

223+
#### `printBuildError(error: Object): void`
224+
225+
Prettify some known build errors.
226+
Pass an Error object to log a prettified error message in the console.
227+
228+
```
229+
const printBuildError = require('react-dev-utils/printBuildError')
230+
try {
231+
build()
232+
} catch(e) {
233+
printBuildError(e) // logs prettified message
234+
}
235+
```
236+
223237
#### `getProcessForPort(port: number): string`
224238

225239
Finds the currently running process on `port`.
@@ -295,7 +309,7 @@ Returns an object with local and remote URLs for the development server. Pass th
295309

296310
This is an alternative client for [WebpackDevServer](https://github.com/webpack/webpack-dev-server) that shows a syntax error overlay.
297311

298-
It currently supports only Webpack 1.x.
312+
It currently supports only Webpack 3.x.
299313

300314
```js
301315
// Webpack development config

packages/react-dev-utils/WebpackDevServerUtils.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,11 @@ function createCompiler(webpack, config, appName, urls, useYarn) {
164164

165165
// If errors exist, only show errors.
166166
if (messages.errors.length) {
167+
// Only keep the first error. Others are often indicative
168+
// of the same problem, but confuse the reader with noise.
169+
if (messages.errors.length > 1) {
170+
messages.errors.length = 1;
171+
}
167172
console.log(chalk.red('Failed to compile.\n'));
168173
console.log(messages.errors.join('\n\n'));
169174
return;

0 commit comments

Comments
 (0)