Skip to content

Commit

Permalink
Merge branch 'masterd' into feat/modern-build
Browse files Browse the repository at this point in the history
* masterd: (24 commits)
  Add TypeScript linting support (facebook#6513)
  Support React Hooks (facebook#5602) (facebook#5997)
  Support browserslist in @babel/preset-env (facebook#6608)
  Add empty mock for http2 (facebook#5686)
  Add note about npx caching (facebook#6374)
  change named import into default import (facebook#6625)
  Stage files for commit after ejecting (facebook#5960)
  Upgrade dependencies (facebook#6614)
  Make compiler variable const instead of let (facebook#6621)
  Type check JSON files (facebook#6615)
  Change class components to functional components in templates (facebook#6451)
  Convert JSON.stringify \n to os.EOL when writing tsconfig.json (facebook#6610)
  Update html-webpack-plugin (facebook#6361)
  Enable click to go to error in console for TypeScript (facebook#6502)
  Update webpack-dev-server to 3.2.1 (facebook#6483)
  [docs] revert removal of newlines from html (facebook#6386)
  Publish
  Prepare 2.1.8 release
  Reapply "Speed up TypeScript v2 (facebook#6406)" (facebook#6586)
  Publish
  ...

# Conflicts:
#	packages/babel-preset-react-app/create.js
#	packages/react-scripts/scripts/build.js
  • Loading branch information
JoviDeCroock committed Mar 15, 2019
2 parents 89aed63 + eee8491 commit 231a136
Show file tree
Hide file tree
Showing 31 changed files with 984 additions and 691 deletions.
120 changes: 120 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,123 @@
## 2.1.8 (March 7, 2019)

v2.1.8 is a maintenance release that reapplies the TypeScript speed improvements ([#6406](https://github.com/facebook/create-react-app/pull/6406)) in a new major version of `react-dev-utils`.

### Migrating from 2.1.7 to 2.1.8

Inside any created project that has not been ejected, run:

```sh
npm install --save --save-exact [email protected]
```

or

```sh
yarn add --exact [email protected]
```

## 2.1.7 (March 7, 2019)

v2.1.7 is a maintenance release that temporarily reverts the TypeScript speed improvements ([#6406](https://github.com/facebook/create-react-app/pull/6406)) to fix a dependency issue in `react-dev-utils`.

### Migrating from 2.1.6 to 2.1.7

Inside any created project that has not been ejected, run:

```sh
npm install --save --save-exact [email protected]
```

or

```sh
yarn add --exact [email protected]
```

## 2.1.6 (March 6, 2019)

v2.1.6 is a maintenance release that brings a few new improvements, most notably:

- :rocket: Reduced TypeScript rebuild times while running the development server. This was previously introduced in v2.1.4 but had to be reverted. Thanks to [@ianschmitz](https://github.com/ianschmitz) for getting this ready.

#### :bug: Bug Fix

- `react-dev-utils`
- [#6511](https://github.com/facebook/create-react-app/pull/6511) Fix deploy instructions to make link clickable. ([@sbimochan](https://github.com/sbimochan))
- `react-scripts`
- [#6472](https://github.com/facebook/create-react-app/pull/6472) Revert CSS sourcemaps in development. ([@bugzpodder](https://github.com/bugzpodder))
- [#6444](https://github.com/facebook/create-react-app/pull/6444) Revert "Switch to eval-source-map (#5060)". ([@ianschmitz](https://github.com/ianschmitz))

#### :nail_care: Enhancement

- `react-dev-utils`, `react-scripts`
- [#6406](https://github.com/facebook/create-react-app/pull/6406) Speed up TypeScript rebuild times in development. ([@ianschmitz](https://github.com/ianschmitz))
- `create-react-app`
- [#6253](https://github.com/facebook/create-react-app/pull/6253) Only use `yarn.lock.cached` if using the default Yarn registry. ([@hangryCat](https://github.com/hangryCat))
- `react-scripts`
- [#5457](https://github.com/facebook/create-react-app/pull/5457) Add forward ref to React SVG Component. ([@GasimGasimzada](https://github.com/GasimGasimzada))

#### :memo: Documentation

- `babel-preset-react-app`
- [#6254](https://github.com/facebook/create-react-app/pull/6254) Improve Flow and TypeScript usage docs. ([@saranshkataria](https://github.com/saranshkataria))
- `babel-preset-react-app`, `confusing-browser-globals`, `react-app-polyfill`
- [#6419](https://github.com/facebook/create-react-app/pull/6419) Improve language used in markdown code blocks. ([@cherouvim](https://github.com/cherouvim))
- `create-react-app`
- [#6481](https://github.com/facebook/create-react-app/pull/6481) Fix typo. ([@adyouri](https://github.com/adyouri))
- `react-dev-utils`
- [#6482](https://github.com/facebook/create-react-app/pull/6482) Fix typo. ([@mattfwood](https://github.com/mattfwood))
- Other
- [#6438](https://github.com/facebook/create-react-app/pull/6438) Update `source-map-explorer` docs to analyze all chunks. ([@Kamahl19](https://github.com/Kamahl19))
- [#6454](https://github.com/facebook/create-react-app/pull/6454) Fix typo. ([@DenrizSusam](https://github.com/DenrizSusam))
- [#5767](https://github.com/facebook/create-react-app/pull/5767) Add information about using custom registries in e2e testing #4488. ([@juanpicado](https://github.com/juanpicado))
- `react-dev-utils`, `react-scripts`
- [#6239](https://github.com/facebook/create-react-app/pull/6239) Convert all bit.ly links from http to https. ([@leighhalliday](https://github.com/leighhalliday))

#### :house: Internal

- [#6493](https://github.com/facebook/create-react-app/pull/6493) Remove AppVeyor config files. ([@iansu](https://github.com/iansu))
- [#6474](https://github.com/facebook/create-react-app/pull/6474) Remove latest Node version from Travis config. ([@iansu](https://github.com/iansu))

#### :hammer: Underlying Tools

- `react-scripts`
- [#6387](https://github.com/facebook/create-react-app/pull/6387) Use contenthash instead of chunkhash for better long-term caching. ([@ianschmitz](https://github.com/ianschmitz))
- Other
- [#6365](https://github.com/facebook/create-react-app/pull/6365) Upgrade Docusaurus and enable new features. ([@yangshun](https://github.com/yangshun))

#### Committers: 15

- Abdelhadi Dyouri ([adyouri](https://github.com/adyouri))
- Bimochan Shrestha ([sbimochan](https://github.com/sbimochan))
- Deniz Susman ([DenrizSusam](https://github.com/DenrizSusam))
- Gasim Gasimzada ([GasimGasimzada](https://github.com/GasimGasimzada))
- Ian Schmitz ([ianschmitz](https://github.com/ianschmitz))
- Ian Sutherland ([iansu](https://github.com/iansu))
- Ioannis Cherouvim ([cherouvim](https://github.com/cherouvim))
- Jack Zhao ([bugzpodder](https://github.com/bugzpodder))
- Juan Picado @jotadeveloper ([juanpicado](https://github.com/juanpicado))
- Leigh Halliday ([leighhalliday](https://github.com/leighhalliday))
- Martin Litvaj ([Kamahl19](https://github.com/Kamahl19))
- Matt Wood ([mattfwood](https://github.com/mattfwood))
- Meo H. ([hangryCat](https://github.com/hangryCat))
- Saransh Kataria ([saranshkataria](https://github.com/saranshkataria))
- Yangshun Tay ([yangshun](https://github.com/yangshun))

### Migrating from 2.1.5 to 2.1.6

Inside any created project that has not been ejected, run:

```sh
npm install --save --save-exact [email protected]
```

or

```sh
yarn add --exact [email protected]
```

## 2.1.5 (February 11, 2019)

v2.1.5 is a maintenance release that reverts the TypeScript speed improvements ([#5903](https://github.com/facebook/create-react-app/pull/5903)) to fix a dependency issue in `react-dev-utils`.
Expand Down
8 changes: 7 additions & 1 deletion docusaurus/docs/adding-custom-environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,19 @@ During the build, `process.env.REACT_APP_NOT_SECRET_CODE` will be replaced with

When you load the app in the browser and inspect the `<input>`, you will see its value set to `abcdef`, and the bold text will show the environment provided when using `npm start`:

<!-- prettier-ignore-start -->

```html
<div>
<small>You are running this application in <b>development</b> mode.</small>
<form><input type="hidden" value="abcdef" /></form>
<form>
<input type="hidden" value="abcdef" />
</form>
</div>
```

<!-- prettier-ignore-end -->

The above form is looking for a variable called `REACT_APP_NOT_SECRET_CODE` from the environment. In order to consume this value, we need to have it defined in the environment. This can be done using two ways: either in your shell or in a `.env` file. Both of these ways are described in the next few sections.

Having access to the `NODE_ENV` is also useful for performing actions conditionally:
Expand Down
3 changes: 3 additions & 0 deletions docusaurus/docs/adding-typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ Type errors will show up in the same console as the build one.

To learn more about TypeScript, check out [its documentation](https://www.typescriptlang.org/).

> **Note:** If your project is not created with TypeScript enabled, npx may be using a cached version of `create-react-app`.
> Remove previously installed versions with `npm uninstall -g create-react-app` (see [#6119](https://github.com/facebook/create-react-app/issues/6119#issuecomment-451614035)).
> **Note:** You are not required to make a [`tsconfig.json` file](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html), one will be made for you.
> You are allowed to edit the generated TypeScript configuration.
Expand Down
13 changes: 13 additions & 0 deletions docusaurus/docs/setting-up-your-editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,19 @@ You would need to install an ESLint plugin for your editor first. Then, add a fi
}
```

If you're using TypeScript and Visual Studio Code, the [ESLint Visual Studio Code extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint#overview) currently [doesn't have TypeScript support enabled by default](https://github.com/Microsoft/vscode-eslint/issues/609). To enable TypeScript support in the ESLint extension, add the following to your project's Visual Studio Code settings file, located at `.vscode/settings.json` (you can create this file if it doesn't already exist):

```json
{
"eslint.validate": [
"javascript",
"javascriptreact",
{ "language": "typescript", "autoFix": true },
{ "language": "typescriptreact", "autoFix": true }
]
}
```

Now your editor should report the linting warnings.

Note that even if you edit your `.eslintrc.json` file further, these changes will **only affect the editor integration**. They won’t affect the terminal and in-browser lint output. This is because Create React App intentionally provides a minimal set of rules that find common mistakes.
Expand Down
33 changes: 32 additions & 1 deletion docusaurus/docs/supported-browsers-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sidebar_label: Supported Browsers and Features

## Supported Browsers

By default, the generated project supports all modern browsers. Support for Internet Explorer 9, 10, and 11 requires [polyfills](https://github.com/facebook/create-react-app/blob/master/packages/react-app-polyfill/README.md).
By default, the generated project supports all modern browsers. Support for Internet Explorer 9, 10, and 11 requires polyfills. For a minimum set of polyfills to support older browsers, use [react-app-polyfill](https://github.com/facebook/create-react-app/blob/master/packages/react-app-polyfill/README.md). To polyfill other language features, see the [Adding Polyfills](#adding-polyfills) section below

## Supported Language Features

Expand All @@ -26,3 +26,34 @@ While we recommend using experimental proposals with some caution, Facebook heav
Note that **this project includes no [polyfills](https://github.com/facebook/create-react-app/blob/master/packages/react-app-polyfill/README.md)** by default.

If you use any other ES6+ features that need **runtime support** (such as `Array.from()` or `Symbol`), make sure you are [including the appropriate polyfills manually](https://github.com/facebook/create-react-app/blob/master/packages/react-app-polyfill/README.md), or that the browsers you are targeting already support them.

## Adding Polyfills

You can install [`@babel/polyfill`](https://babeljs.io/docs/en/babel-polyfill) as a dependency in your application, and import it at the very top of your app's entry point (`src/index.js` or `src/index.tsx`) to emulate a full ES2015+ environment. Your `browerslist` configuration will be used to only include the polyfills necessary by your target browsers.

## Configuring Supported Browsers

By default, the generated project includes a [`browerslist`](https://github.com/browserslist/browserslist) configuration in your `package.json` file to target a broad range of browsers based on global usage (`> 0.2%`) for production builds, and modern browsers for development. This gives a good development experience, especially when using language features such as async/await, but still provides high compatibility with many browsers in production.

The `browserslist` configuration controls the outputted JavaScript so that the emitted code will be compatible with the browsers specified. The `production` list will be used when creating a production build by running the `build` script, and the `development` list will be used when running the `start` script. You can use [https://browserl.ist](https://browserl.ist/?q=%3E+0.2%25%2C+not+dead%2C+not+op_mini+all) to see the browsers supported by your configured `browserslist`.

Here is an example `browserslist` that is specified in `package.json`:

```json
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
```

> Note that this does not include polyfills automatically for you. You will still need to polyfill language features (see above) as needed based on the browsers your are supporting.
> When editing the `browerslist` config, you may notice that your changes don't get picked up right away. This is due to an [issue in babel-loader](https://github.com/babel/babel-loader/issues/690) not detecting the change in your `package.json`. An easy solution is to delete the `node_modules/.cache` folder and try again.
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,24 @@
"compile:lockfile": "node tasks/compile-lockfile.js"
},
"devDependencies": {
"eslint": "5.12.0",
"eslint": "5.15.1",
"execa": "1.0.0",
"fs-extra": "^7.0.0",
"get-port": "^4.0.0",
"globby": "^8.0.1",
"husky": "1.0.0-rc.15",
"fs-extra": "^7.0.1",
"get-port": "^4.2.0",
"globby": "^9.1.0",
"husky": "^1.3.1",
"jest": "^23.6.0",
"lerna": "2.9.1",
"lerna-changelog": "^0.7.0",
"lerna-changelog": "~0.8.2",
"lint-staged": "^8.0.4",
"meow": "^5.0.0",
"multimatch": "^2.1.0",
"prettier": "1.15.2",
"puppeteer": "^1.8.0",
"strip-ansi": "^4.0.0",
"multimatch": "^3.0.0",
"prettier": "1.16.4",
"puppeteer": "^1.13.0",
"strip-ansi": "^5.1.0",
"svg-term-cli": "^2.1.1",
"tempy": "^0.2.1",
"wait-for-localhost": "2.0.1"
"wait-for-localhost": "^3.1.0"
},
"husky": {
"hooks": {
Expand Down
23 changes: 21 additions & 2 deletions packages/babel-preset-react-app/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ module.exports = function(api, opts, env) {
ignoreBrowserslistConfig: true,
// If users import all core-js they're probably not concerned with
// bundle size. We shouldn't rely on magic to try and shrink it.
useBuiltIns: !isModern || !shouldBuildModern ? false : 'entry',
useBuiltIns: 'entry',
// Do not transform modules to CJS
modules: false,
// Exclude transforms that make all code slower
Expand Down Expand Up @@ -141,7 +141,26 @@ module.exports = function(api, opts, env) {
// Necessary to include regardless of the environment because
// in practice some other transforms (such as object-rest-spread)
// don't work without it: https://github.com/babel/babel/issues/7215
require('@babel/plugin-transform-destructuring').default,
[
require('@babel/plugin-transform-destructuring').default,
{
// Use loose mode for performance:
// https://github.com/facebook/create-react-app/issues/5602
loose: false,
selectiveLoose: [
'useState',
'useEffect',
'useContext',
'useReducer',
'useCallback',
'useMemo',
'useRef',
'useImperativeHandle',
'useLayoutEffect',
'useDebugValue',
],
},
],
// Turn on legacy decorators for TypeScript files
isTypeScriptEnabled && [
require('@babel/plugin-proposal-decorators').default,
Expand Down
20 changes: 10 additions & 10 deletions packages/babel-preset-react-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "babel-preset-react-app",
"version": "7.0.1",
"version": "7.0.2",
"description": "Babel preset used by Create React App",
"repository": "facebook/create-react-app",
"license": "MIT",
Expand All @@ -17,21 +17,21 @@
"test.js"
],
"dependencies": {
"@babel/core": "7.2.2",
"@babel/plugin-proposal-class-properties": "7.3.0",
"@babel/core": "7.3.4",
"@babel/plugin-proposal-class-properties": "7.3.4",
"@babel/plugin-proposal-decorators": "7.3.0",
"@babel/plugin-proposal-object-rest-spread": "7.3.2",
"@babel/plugin-proposal-object-rest-spread": "7.3.4",
"@babel/plugin-syntax-dynamic-import": "7.2.0",
"@babel/plugin-transform-classes": "7.2.2",
"@babel/plugin-transform-classes": "7.3.4",
"@babel/plugin-transform-destructuring": "7.3.2",
"@babel/plugin-transform-flow-strip-types": "7.2.3",
"@babel/plugin-transform-flow-strip-types": "7.3.4",
"@babel/plugin-transform-react-constant-elements": "7.2.0",
"@babel/plugin-transform-react-display-name": "7.2.0",
"@babel/plugin-transform-runtime": "7.2.0",
"@babel/preset-env": "7.3.1",
"@babel/plugin-transform-runtime": "7.3.4",
"@babel/preset-env": "7.3.4",
"@babel/preset-react": "7.0.0",
"@babel/preset-typescript": "7.1.0",
"@babel/runtime": "7.3.1",
"@babel/preset-typescript": "7.3.3",
"@babel/runtime": "7.3.4",
"babel-loader": "8.0.5",
"babel-plugin-dynamic-import-node": "2.2.0",
"babel-plugin-macros": "2.5.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/confusing-browser-globals/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "confusing-browser-globals",
"version": "1.0.5",
"version": "1.0.6",
"description": "A list of browser globals that are often used by mistake instead of local variables",
"license": "MIT",
"main": "index.js",
Expand Down
1 change: 0 additions & 1 deletion packages/create-react-app/createReactApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ if (program.info) {
npmGlobalPackages: ['create-react-app'],
},
{
clipboard: false,
duplicates: true,
showNotFound: true,
}
Expand Down
16 changes: 8 additions & 8 deletions packages/create-react-app/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "create-react-app",
"version": "2.1.5",
"version": "2.1.8",
"keywords": [
"react"
],
"description": "Create React apps with no build configuration.",
"repository": "facebook/create-react-app",
"license": "MIT",
"engines": {
"node": ">=4"
"node": ">=8"
},
"bugs": {
"url": "https://github.com/facebook/create-react-app/issues"
Expand All @@ -22,13 +22,13 @@
"create-react-app": "./index.js"
},
"dependencies": {
"chalk": "1.1.3",
"commander": "2.18.0",
"cross-spawn": "4.0.2",
"envinfo": "5.11.1",
"fs-extra": "5.0.0",
"chalk": "2.4.2",
"commander": "2.19.0",
"cross-spawn": "6.0.5",
"envinfo": "7.1.0",
"fs-extra": "7.0.1",
"hyperquest": "2.1.3",
"semver": "5.5.1",
"semver": "5.6.0",
"tar-pack": "3.4.1",
"tmp": "0.0.33",
"validate-npm-package-name": "3.0.0"
Expand Down
Loading

0 comments on commit 231a136

Please sign in to comment.