Skip to content
This repository was archived by the owner on Jan 26, 2019. It is now read-only.

Commit 31c81cb

Browse files
authored
Merge pull request #65 from wmonk/2.0.0
2.0.0
2 parents 5ad01fa + fc46e5e commit 31c81cb

File tree

168 files changed

+93536
-3426
lines changed

Some content is hidden

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

168 files changed

+93536
-3426
lines changed

.eslintrc

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
},
1212
"rules": {
1313
"no-console": "off",
14-
"strict": ["error", "global"]
14+
"strict": ["error", "global"],
15+
"curly": "warn"
1516
}
1617
}

.travis.yml

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
language: node_js
33
node_js:
4-
- 4
54
- 6
65
- 7
76
cache:
@@ -20,9 +19,12 @@ env:
2019
matrix:
2120
- TEST_SUITE=simple
2221
- TEST_SUITE=installs
22+
- TEST_SUITE=kitchensink
2323
matrix:
2424
include:
2525
- node_js: 0.10
2626
env: TEST_SUITE=simple
27-
- node_js: 6
28-
env: USE_YARN=yes TEST_SUITE=simple
27+
# There's a weird Yarn/Lerna bug related to prerelease versions.
28+
# TODO: reenable after we ship 1.0.
29+
# - node_js: 6
30+
# env: USE_YARN=yes TEST_SUITE=simple

CHANGELOG-0.x.md

+1,374
Large diffs are not rendered by default.

CHANGELOG.md

+407-1,141
Large diffs are not rendered by default.

CONTRIBUTING.md

+32
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,36 @@ Please **ask first** if somebody else is already working on this or the core dev
4141

4242
Please also provide a **test plan**, i.e. specify how you verified that your addition works.
4343

44+
## Folder Structure of Create React App
45+
`create-react-app` is a monorepo, meaning it is divided into independent sub-packages.<br>
46+
These packages can be found in the [`packages/`](https://github.com/facebookincubator/create-react-app/tree/master/packages) directory.
47+
48+
### Overview of directory structure
49+
```
50+
packages/
51+
babel-preset-react-app/
52+
create-react-app/
53+
eslint-config-react-app/
54+
react-dev-utils/
55+
react-scripts/
56+
```
57+
### Package Descriptions
58+
#### [babel-preset-react-app](https://github.com/facebookincubator/create-react-app/tree/master/packages/babel-preset-react-app)
59+
This package is a babel preset intended to be used with `react-scripts`.<br>
60+
It targets platforms that React is designed to support (IE 9+) and enables experimental features used heavily at Facebook.<br>
61+
This package is enabled by default for all `create-react-app` scaffolded applications.
62+
#### [create-react-app](https://github.com/facebookincubator/create-react-app/tree/master/packages/create-react-app)
63+
The global CLI command code can be found in this directory, and shouldn't often be changed. It should run on Node 0.10+.
64+
#### [eslint-config-react-app](https://github.com/facebookincubator/create-react-app/tree/master/packages/eslint-config-react-app)
65+
This package contains a conservative set of rules focused on making errors apparent and enforces no style rules.<br>
66+
This package is enabled by default for all `create-react-app` scaffolded applications.
67+
#### [react-dev-utils](https://github.com/facebookincubator/create-react-app/tree/master/packages/react-dev-utils)
68+
This package contains utilities used for `react-scripts` and sister packages.<br>
69+
Its main purpose is to conceal code which the user shouldn't be burdened with upon ejecting.
70+
#### [react-scripts](https://github.com/facebookincubator/create-react-app/tree/master/packages/react-scripts)
71+
This package is the heart of the project, which contains the scripts for setting up the development server, building production builds, configuring all software used, etc.<br>
72+
All functionality must be retained (and configuration given to the user) if they choose to eject.
73+
4474
## Setting Up a Local Copy
4575

4676
1. Clone the repo with `git clone https://github.com/facebookincubator/create-react-app`
@@ -58,6 +88,8 @@ cd my-app
5888

5989
and then run `npm start` or `npm run build`.
6090

91+
*Note: if you are using yarn, we suggest that you use `yarn install --no-lockfile` instead of the bare `yarn` or `yarn install` because we [intentionally](https://github.com/facebookincubator/create-react-app/pull/2014#issuecomment-300811661) do not ignore or add yarn.lock to our repo.*
92+
6193
## Cutting a Release
6294

6395
1. Tag all merged pull requests that go into the release with the relevant milestone. Each merged PR should also be labeled with one of the [labels](https://github.com/facebookincubator/create-react-app/labels) named `tag: ...` to indicate what kind of change it is.

PULL_REQUEST_TEMPLATE.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<!--
2+
Thank you for sending the PR!
3+
If you changed any code, there are just two more things to do:
4+
5+
* Provide us with clear instructions on how you verified your changes work. Bonus points for screenshots!
6+
7+
Happy contributing!
8+
-->

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ When you run `npm run build` the terminal will output the error, including the h
2323

2424
## Changelog
2525

26+
### 2.0.0
27+
* Upgrade to [`[email protected]`](https://github.com/facebookincubator/create-react-app/blob/0d1521aabf5a0201ea1bcccc33e286afe048f820/CHANGELOG.md)
28+
2629
### 1.4.0
2730
* Upgrade to [email protected] - thanks to @patrick91
2831
* Add tests around react-scripts-ts - thanks to @migerh

appveyor.yml

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
image: Visual Studio 2017
2+
13
environment:
24
matrix:
35
- nodejs_version: 7
@@ -12,12 +14,6 @@ environment:
1214
test_suite: "installs"
1315
- nodejs_version: 6
1416
test_suite: "kitchensink"
15-
- nodejs_version: 4
16-
test_suite: "simple"
17-
- nodejs_version: 4
18-
test_suite: "installs"
19-
- nodejs_version: 4
20-
test_suite: "kitchensink"
2117

2218
cache:
2319
- node_modules -> appveyor.cleanup-cache.txt
@@ -32,6 +28,8 @@ platform:
3228
- x64
3329

3430
install:
31+
# TODO: Remove after https://github.com/appveyor/ci/issues/1426 is fixed
32+
- set PATH=C:\Program Files\Git\mingw64\bin;%PATH%
3533
- ps: Install-Product node $env:nodejs_version $env:platform
3634

3735
build: off

package.json

+19-4
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,29 @@
55
"changelog": "lerna-changelog",
66
"create-react-app": "tasks/cra.sh",
77
"e2e": "tasks/e2e-simple.sh",
8-
"postinstall": "lerna bootstrap",
8+
"postinstall": "lerna bootstrap && cd packages/react-error-overlay/ && npm run build:prod",
99
"publish": "tasks/release.sh",
1010
"start": "node packages/react-scripts/scripts/start.js",
11-
"test": "node packages/react-scripts/scripts/test.js --env=jsdom"
11+
"test": "node packages/react-scripts/scripts/test.js --env=jsdom",
12+
"format": "prettier --trailing-comma es5 --single-quote --write 'packages/*/*.js' 'packages/*/!(node_modules)/**/*.js'",
13+
"precommit": "lint-staged"
1214
},
1315
"devDependencies": {
14-
"eslint": "3.16.1",
16+
"@types/jest": "^19.2.3",
17+
"@types/node": "^7.0.21",
18+
"@types/react": "^15.0.24",
19+
"@types/react-dom": "^15.5.0",
20+
"eslint": "3.19.0",
21+
"husky": "^0.13.2",
1522
"lerna": "2.0.0-beta.38",
16-
"lerna-changelog": "^0.2.3"
23+
"lerna-changelog": "^0.2.3",
24+
"lint-staged": "^3.3.1",
25+
"prettier": "^0.21.0"
26+
},
27+
"lint-staged": {
28+
"*.js": [
29+
"prettier --trailing-comma es5 --single-quote --write",
30+
"git add"
31+
]
1732
}
1833
}

packages/babel-preset-react-app/index.js

+64-41
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,34 @@
88
*/
99
'use strict';
1010

11-
var path = require('path');
12-
1311
const plugins = [
1412
// class { handleClick = () => { } }
1513
require.resolve('babel-plugin-transform-class-properties'),
1614
// The following two plugins use Object.assign directly, instead of Babel's
1715
// extends helper. Note that this assumes `Object.assign` is available.
1816
// { ...todo, completed: true }
19-
[require.resolve('babel-plugin-transform-object-rest-spread'), {
20-
useBuiltIns: true
21-
}],
17+
[
18+
require.resolve('babel-plugin-transform-object-rest-spread'),
19+
{
20+
useBuiltIns: true,
21+
},
22+
],
2223
// Transforms JSX
23-
[require.resolve('babel-plugin-transform-react-jsx'), {
24-
useBuiltIns: true
25-
}],
24+
[
25+
require.resolve('babel-plugin-transform-react-jsx'),
26+
{
27+
useBuiltIns: true,
28+
},
29+
],
2630
// Polyfills the runtime needed for async/await and generators
27-
[require.resolve('babel-plugin-transform-runtime'), {
28-
helpers: false,
29-
polyfill: false,
30-
regenerator: true,
31-
// Resolve the Babel runtime relative to the config.
32-
moduleName: path.dirname(require.resolve('babel-runtime/package'))
33-
}]
31+
[
32+
require.resolve('babel-plugin-transform-runtime'),
33+
{
34+
helpers: false,
35+
polyfill: false,
36+
regenerator: true,
37+
},
38+
],
3439
];
3540

3641
// This is similar to how `env` works in Babel:
@@ -42,9 +47,11 @@ const plugins = [
4247
var env = process.env.BABEL_ENV || process.env.NODE_ENV;
4348
if (env !== 'development' && env !== 'test' && env !== 'production') {
4449
throw new Error(
45-
'Using `babel-preset-react-app` requires that you specify `NODE_ENV` or '+
46-
'`BABEL_ENV` environment variables. Valid values are "development", ' +
47-
'"test", and "production". Instead, received: ' + JSON.stringify(env) + '.'
50+
'Using `babel-preset-react-app` requires that you specify `NODE_ENV` or ' +
51+
'`BABEL_ENV` environment variables. Valid values are "development", ' +
52+
'"test", and "production". Instead, received: ' +
53+
JSON.stringify(env) +
54+
'.'
4855
);
4956
}
5057

@@ -59,49 +66,65 @@ if (env === 'development' || env === 'test') {
5966
// Adds component stack to warning messages
6067
require.resolve('babel-plugin-transform-react-jsx-source'),
6168
// Adds __self attribute to JSX which React will use for some warnings
62-
require.resolve('babel-plugin-transform-react-jsx-self')
69+
require.resolve('babel-plugin-transform-react-jsx-self'),
6370
]);
6471
}
6572

6673
if (env === 'test') {
6774
module.exports = {
6875
presets: [
6976
// ES features necessary for user's Node version
70-
[require('babel-preset-env').default, {
71-
targets: {
72-
node: 'current',
77+
[
78+
require('babel-preset-env').default,
79+
{
80+
targets: {
81+
node: 'current',
82+
},
7383
},
74-
}],
84+
],
7585
// JSX, Flow
76-
require.resolve('babel-preset-react')
86+
require.resolve('babel-preset-react'),
7787
],
78-
plugins: plugins
88+
plugins: plugins.concat([
89+
// Compiles import() to a deferred require()
90+
require.resolve('babel-plugin-dynamic-import-node'),
91+
]),
7992
};
8093
} else {
8194
module.exports = {
8295
presets: [
8396
// Latest stable ECMAScript features
84-
[require.resolve('babel-preset-env'), {
85-
targets: {
86-
// React parses on ie 9, so we should too
87-
ie: 9,
88-
// We currently minify with uglify
89-
// Remove after https://github.com/mishoo/UglifyJS2/issues/448
90-
uglify: true
97+
[
98+
require.resolve('babel-preset-env'),
99+
{
100+
targets: {
101+
// React parses on ie 9, so we should too
102+
ie: 9,
103+
// We currently minify with uglify
104+
// Remove after https://github.com/mishoo/UglifyJS2/issues/448
105+
uglify: true,
106+
},
107+
// Disable polyfill transforms
108+
useBuiltIns: false,
109+
// Do not transform modules to CJS
110+
modules: false,
91111
},
92-
// Disable polyfill transforms
93-
useBuiltIns: false
94-
}],
112+
],
95113
// JSX, Flow
96-
require.resolve('babel-preset-react')
114+
require.resolve('babel-preset-react'),
97115
],
98116
plugins: plugins.concat([
99117
// function* () { yield 42; yield 43; }
100-
[require.resolve('babel-plugin-transform-regenerator'), {
101-
// Async functions are converted to generators by babel-preset-latest
102-
async: false
103-
}],
104-
])
118+
[
119+
require.resolve('babel-plugin-transform-regenerator'),
120+
{
121+
// Async functions are converted to generators by babel-preset-env
122+
async: false,
123+
},
124+
],
125+
// Adds syntax support for import()
126+
require.resolve('babel-plugin-syntax-dynamic-import'),
127+
]),
105128
};
106129

107130
if (env === 'production') {
+14-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "babel-preset-react-app",
3-
"version": "2.1.1",
3+
"version": "3.0.0",
44
"description": "Babel preset used by Create React App",
55
"repository": "facebookincubator/create-react-app",
66
"license": "BSD-3-Clause",
@@ -11,16 +11,20 @@
1111
"index.js"
1212
],
1313
"dependencies": {
14-
"babel-plugin-transform-class-properties": "6.22.0",
15-
"babel-plugin-transform-object-rest-spread": "6.22.0",
16-
"babel-plugin-transform-react-constant-elements": "6.22.0",
17-
"babel-plugin-transform-react-jsx": "6.22.0",
14+
"babel-plugin-dynamic-import-node": "1.0.2",
15+
"babel-plugin-syntax-dynamic-import": "6.18.0",
16+
"babel-plugin-transform-class-properties": "6.24.1",
17+
"babel-plugin-transform-object-rest-spread": "6.23.0",
18+
"babel-plugin-transform-react-constant-elements": "6.23.0",
19+
"babel-plugin-transform-react-jsx": "6.24.1",
1820
"babel-plugin-transform-react-jsx-self": "6.22.0",
1921
"babel-plugin-transform-react-jsx-source": "6.22.0",
20-
"babel-plugin-transform-regenerator": "6.22.0",
21-
"babel-plugin-transform-runtime": "6.22.0",
22-
"babel-preset-env": "1.2.1",
23-
"babel-preset-react": "6.22.0",
24-
"babel-runtime": "6.22.0"
22+
"babel-plugin-transform-regenerator": "6.24.1",
23+
"babel-plugin-transform-runtime": "6.23.0",
24+
"babel-preset-env": "1.4.0",
25+
"babel-preset-react": "6.24.1"
26+
},
27+
"peerDependencies": {
28+
"babel-runtime": "^6.23.0"
2529
}
2630
}

0 commit comments

Comments
 (0)