Skip to content

Commit 20c7de5

Browse files
committed
# By Dan Abramov (5) and others # Via Dan Abramov * 'master' of https://github.com/facebookincubator/create-react-app: docs(readme): peer dependencies applied (facebook#818) Fix typos on ISSUE_TEMPLATE.md (facebook#817) Add explicit linebreaks (facebook#813) Fix typo (facebook#810) Fix some typos (facebook#809) Beaufity output of eject.js script (facebook#769) Define process.env as object (facebook#807) Typo fix in webpack.config.dev.js comments (facebook#777) Add Netlify to deploy instructions Fix usage example to match react-dev-utils@0.2.x API Relaxed eslint rule no-unused-expressions (facebook#724) Fix the doc Publish Add 0.6.1 changelog Moved Babel and ESLint config to package.json after ejecting (facebook#773) Conflicts: packages/react-scripts/package.json
2 parents 0acb5b9 + 94ec885 commit 20c7de5

File tree

17 files changed

+142
-67
lines changed

17 files changed

+142
-67
lines changed

CHANGELOG.md

+18
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
## 0.6.1 (September 27, 2016)
2+
3+
### Build Dependency (`react-scripts`)
4+
5+
* Babel and ESLint configuration is now placed into `package.json` after ejecting. ([@montogeek](https://github.com/montogeek) in [#773](https://github.com/facebookincubator/create-react-app/pull/773))
6+
7+
### Utilities (`react-dev-utils`)
8+
9+
* Fixes the syntax error overlay padding. ([@fson](https://github.com/fson) in [#758](https://github.com/facebookincubator/create-react-app/pull/758))
10+
11+
### Migrating from 0.6.0 to 0.6.1
12+
13+
Inside any created project that has not been ejected, run:
14+
15+
```
16+
npm install --save-dev --save-exact react-scripts@0.6.1
17+
```
18+
119
## 0.6.0 (September 25, 2016)
220

321
### Build Dependency (`react-scripts`)

ISSUE_TEMPLATE.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
If you are reporting a bug, please fill in below. Otherwise feel to remove this template entirely.
1+
If you are reporting a bug, please fill in below. Otherwise feel free to remove this template entirely.
22

33
### Description
44

@@ -31,7 +31,7 @@ Please take the time to create a new app that reproduces the issue.
3131

3232
Alternatively, you could copy your app that experiences the problem and start removing things until you’re left with the minimal reproducible demo.
3333

34-
(Accidentially, you might get to the root of your problem during that process.)
34+
(Accidentally, you might get to the root of your problem during that process.)
3535

3636
Push to GitHub and paste the link here.
3737

packages/babel-preset-react-app/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The easiest way to use this configuration is with [Create React App](https://git
1212

1313
## Usage Outside of Create React App
1414

15-
If you want to use this ESLint configuration in a project not built with Create React App, you can install it with following steps.
15+
If you want to use this Babel preset in a project not built with Create React App, you can install it with following steps.
1616

1717
First, [install Babel](https://babeljs.io/docs/setup/).
1818

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

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

1919
```sh
20-
npm install --save-dev eslint-config-react-app babel-eslint@6.1.2 eslint@3.5.0 eslint-plugin-flowtype@2.18.1 eslint-plugin-import@1.12.0 eslint-plugin-jsx-a11y@2.2.2 eslint-plugin-react@5.2.2
20+
npm install --save-dev eslint-config-react-app babel-eslint@6.1.2 eslint@3.5.0 eslint-plugin-flowtype@2.18.1 eslint-plugin-import@1.12.0 eslint-plugin-jsx-a11y@2.2.2 eslint-plugin-react@6.3.0
2121
```
2222

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

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

+5-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
// Inspired by https://github.com/airbnb/javascript but less opinionated.
1111

12-
// We use eslint-loader so even warnings are very visibile.
12+
// We use eslint-loader so even warnings are very visible.
1313
// This is why we only use "WARNING" level for potential errors,
1414
// and we don't use "ERROR" level at all.
1515

@@ -127,7 +127,10 @@ module.exports = {
127127
'no-undef': 'error',
128128
'no-unexpected-multiline': 'warn',
129129
'no-unreachable': 'warn',
130-
'no-unused-expressions': 'warn',
130+
'no-unused-expressions': ['warn', {
131+
'allowShortCircuit': true,
132+
'allowTernary': true
133+
}],
131134
'no-unused-labels': 'warn',
132135
'no-unused-vars': ['warn', {
133136
vars: 'local',

packages/react-dev-utils/README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ clearConsole();
110110
console.log('Just cleared the screen!');
111111
```
112112

113-
#### `formatWebpackMessages(stats: WebpackStats): {errors: Array<string>, warnings: Array<string>}`
113+
#### `formatWebpackMessages({errors: Array<string>, warnings: Array<string>}): {errors: Array<string>, warnings: Array<string>}`
114114

115115
Extracts and prettifies warning and error messages from webpack [stats](https://github.com/webpack/docs/wiki/node.js-api#stats) object.
116116

@@ -125,7 +125,8 @@ compiler.plugin('invalid', function() {
125125
});
126126

127127
compiler.plugin('done', function(stats) {
128-
var messages = formatWebpackMessages(stats);
128+
var rawMessages = stats.toJson({}, true);
129+
var messages = formatWebpackMessages(rawMessages);
129130
if (!messages.errors.length && !messages.warnings.length) {
130131
console.log('Compiled successfully!');
131132
}

packages/react-dev-utils/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-dev-utils",
3-
"version": "0.2.0",
3+
"version": "0.2.1",
44
"description": "Webpack utilities used by Create React App",
55
"repository": "facebookincubator/create-react-app",
66
"license": "BSD-3-Clause",

packages/react-dev-utils/webpackHotDevClient.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ function ensureOverlayDivExists(onOverlayDivReady) {
106106
lastOnOverlayDivReady(overlayDiv);
107107
});
108108

109-
// Zalgo alert: onIframeLoad() will be called either synchronouly
109+
// Zalgo alert: onIframeLoad() will be called either synchronously
110110
// or asynchronously depending on the browser.
111111
// We delay adding it so `overlayIframe` is set when `onIframeLoad` fires.
112112
document.body.appendChild(overlayIframe);

packages/react-scripts/config/env.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,25 @@
1515
var REACT_APP = /^REACT_APP_/i;
1616

1717
function getClientEnvironment(publicUrl) {
18-
return Object
18+
var processEnv = Object
1919
.keys(process.env)
2020
.filter(key => REACT_APP.test(key))
2121
.reduce((env, key) => {
22-
env['process.env.' + key] = JSON.stringify(process.env[key]);
22+
env[key] = JSON.stringify(process.env[key]);
2323
return env;
2424
}, {
2525
// Useful for determining whether we’re running in production mode.
2626
// Most importantly, it switches React into the correct mode.
27-
'process.env.NODE_ENV': JSON.stringify(
27+
'NODE_ENV': JSON.stringify(
2828
process.env.NODE_ENV || 'development'
2929
),
3030
// Useful for resolving the correct path to static assets in `public`.
3131
// For example, <img src={process.env.PUBLIC_URL + '/img/logo.png'} />.
3232
// This should only be used as an escape hatch. Normally you would put
3333
// images into the `src` and `import` them in code to get their paths.
34-
'process.env.PUBLIC_URL': JSON.stringify(publicUrl)
34+
'PUBLIC_URL': JSON.stringify(publicUrl)
3535
});
36+
return {'process.env': processEnv};
3637
}
3738

3839
module.exports = getClientEnvironment;

packages/react-scripts/config/webpack.config.dev.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ var getCustomConfig = require('./get-custom-config');
2626
var publicPath = '/';
2727
// `publicUrl` is just like `publicPath`, but we will provide it to our app
2828
// as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript.
29-
// Omit trailing shlash as %PUBLIC_PATH%/xyz looks better than %PUBLIC_PATH%xyz.
29+
// Omit trailing slash as %PUBLIC_PATH%/xyz looks better than %PUBLIC_PATH%xyz.
3030
var publicUrl = '';
31-
// Get enrivonment variables to inject into our app.
31+
// Get environment variables to inject into our app.
3232
var env = getClientEnvironment(publicUrl);
3333
//Get custom configuration for injecting plugins, presets and loaders
3434
var customConfig = getCustomConfig(false);

packages/react-scripts/config/webpack.config.prod.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ var publicPath = ensureSlash(homepagePathname, true);
4545
// as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript.
4646
// Omit trailing shlash as %PUBLIC_PATH%/xyz looks better than %PUBLIC_PATH%xyz.
4747
var publicUrl = ensureSlash(homepagePathname, false);
48-
// Get enrivonment variables to inject into our app.
48+
// Get environment variables to inject into our app.
4949
var env = getClientEnvironment(publicUrl);
5050
//Get custom configuration for injecting plugins, presets and loaders
5151
var customConfig = getCustomConfig(true);
5252

5353
// Assert this just to be safe.
5454
// Development builds of React are slow and not intended for production.
55-
if (env['process.env.NODE_ENV'] !== '"production"') {
55+
if (env['process.env'].NODE_ENV !== '"production"') {
5656
throw new Error('Production builds must have NODE_ENV=production.');
5757
}
5858

packages/react-scripts/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
"path-exists": "2.1.0",
6464
"postcss-loader": "0.13.0",
6565
"promise": "7.1.1",
66-
"react-dev-utils": "^0.2.0",
66+
"react-dev-utils": "^0.2.1",
6767
"recursive-readdir": "2.1.0",
6868
"rimraf": "2.5.4",
6969
"strip-ansi": "3.0.1",

packages/react-scripts/scripts/build.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// Do this as the first thing so that any code reading it knows the right env.
1313
process.env.NODE_ENV = 'production';
1414

15-
// Load environment variables from .env file. Surpress warnings using silent
15+
// Load environment variables from .env file. Suppress warnings using silent
1616
// if this file is missing. dotenv will never modify any environment variables
1717
// that have already been set.
1818
// https://github.com/motdotla/dotenv

packages/react-scripts/scripts/eject.js

+38-16
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,24 @@ var path = require('path');
1313
var prompt = require('react-dev-utils/prompt');
1414
var rimrafSync = require('rimraf').sync;
1515
var spawnSync = require('cross-spawn').sync;
16+
var chalk = require('chalk');
17+
var green = chalk.green;
18+
var cyan = chalk.cyan;
1619

1720
prompt(
1821
'Are you sure you want to eject? This action is permanent.',
1922
false
2023
).then(shouldEject => {
2124
if (!shouldEject) {
22-
console.log('Close one! Eject aborted.');
25+
console.log(cyan('Close one! Eject aborted.'));
2326
process.exit(1);
2427
}
2528

2629
console.log('Ejecting...');
27-
console.log();
2830

2931
var ownPath = path.join(__dirname, '..');
3032
var appPath = path.join(ownPath, '..', '..');
3133
var files = [
32-
'.babelrc',
33-
'.eslintrc',
3434
path.join('config', 'env.js'),
3535
path.join('config', 'paths.js'),
3636
path.join('config', 'polyfills.js'),
@@ -61,8 +61,10 @@ prompt(
6161
fs.mkdirSync(path.join(appPath, 'config', 'jest'));
6262
fs.mkdirSync(path.join(appPath, 'scripts'));
6363

64+
console.log();
65+
console.log('Copying files to ' + cyan(appPath));
6466
files.forEach(function(file) {
65-
console.log('Copying ' + file + ' to ' + appPath);
67+
console.log(' Copying ' + cyan(file));
6668
var content = fs
6769
.readFileSync(path.join(ownPath, file), 'utf8')
6870
// Remove dead code from .js files on eject
@@ -76,48 +78,68 @@ prompt(
7678

7779
var ownPackage = require(path.join(ownPath, 'package.json'));
7880
var appPackage = require(path.join(appPath, 'package.json'));
81+
var babelConfig = JSON.parse(fs.readFileSync(path.join(ownPath, '.babelrc'), 'utf8'));
82+
var eslintConfig = JSON.parse(fs.readFileSync(path.join(ownPath, '.eslintrc'), 'utf8'));
7983

84+
console.log(cyan('Updating dependencies...'));
8085
var ownPackageName = ownPackage.name;
81-
console.log('Removing dependency: ' + ownPackageName);
86+
console.log(' Removing dependency: ' + cyan(ownPackageName));
8287
delete appPackage.devDependencies[ownPackageName];
8388

8489
Object.keys(ownPackage.dependencies).forEach(function (key) {
8590
// For some reason optionalDependencies end up in dependencies after install
8691
if (ownPackage.optionalDependencies[key]) {
8792
return;
8893
}
89-
console.log('Adding dependency: ' + key);
94+
console.log(' Adding dependency: ' + cyan(key));
9095
appPackage.devDependencies[key] = ownPackage.dependencies[key];
9196
});
92-
93-
console.log('Updating scripts');
97+
console.log();
98+
console.log(cyan('Updating scripts...'));
9499
delete appPackage.scripts['eject'];
95100
Object.keys(appPackage.scripts).forEach(function (key) {
96101
appPackage.scripts[key] = appPackage.scripts[key]
97102
.replace(/react-scripts (\w+)/g, 'node scripts/$1.js');
103+
console.log(
104+
' Replacing ' +
105+
cyan('\"react-scripts ' + key + '\"') +
106+
' with ' +
107+
cyan('\"' + appPackage.scripts[key] + '\"')
108+
);
98109
});
99110

111+
console.log();
112+
console.log(cyan('Adding configuration to ') + 'package.json' + cyan('...'));
100113
// Add Jest config
114+
console.log(' Adding ' + cyan('Jest') + ' configuration');
101115
appPackage.jest = createJestConfig(
102116
filePath => path.join('<rootDir>', filePath),
103117
null,
104118
true
105119
);
106120

107-
console.log('Writing package.json');
121+
// Add Babel config
122+
123+
console.log(' Adding ' + cyan('Babel') + ' preset');
124+
appPackage.babel = babelConfig;
125+
126+
// Add ESlint config
127+
console.log(' Adding ' + cyan('ESLint') +' configuration');
128+
appPackage.eslintConfig = eslintConfig;
129+
108130
fs.writeFileSync(
109131
path.join(appPath, 'package.json'),
110132
JSON.stringify(appPackage, null, 2)
111133
);
112134
console.log();
113135

114-
console.log('Running npm install...');
136+
console.log(cyan('Running npm install...'));
115137
rimrafSync(ownPath);
116138
spawnSync('npm', ['install'], {stdio: 'inherit'});
117-
console.log('Ejected successfully!');
139+
console.log(green('Ejected successfully!'));
118140
console.log();
119141

120-
console.log('Please consider sharing why you ejected in this survey:');
121-
console.log(' http://goo.gl/forms/Bi6CZjk1EqsdelXk1');
122-
console.log();
123-
});
142+
console.log(green('Please consider sharing why you ejected in this survey:'));
143+
console.log(green(' http://goo.gl/forms/Bi6CZjk1EqsdelXk1'));
144+
console.log()
145+
})

packages/react-scripts/scripts/start.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
process.env.NODE_ENV = 'development';
1313

14-
// Load environment variables from .env file. Surpress warnings using silent
14+
// Load environment variables from .env file. Suppress warnings using silent
1515
// if this file is missing. dotenv will never modify any environment variables
1616
// that have already been set.
1717
// https://github.com/motdotla/dotenv

packages/react-scripts/scripts/test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
process.env.NODE_ENV = 'test';
1313
process.env.PUBLIC_URL = '';
1414

15-
// Load environment variables from .env file. Surpress warnings using silent
15+
// Load environment variables from .env file. Suppress warnings using silent
1616
// if this file is missing. dotenv will never modify any environment variables
1717
// that have already been set.
1818
// https://github.com/motdotla/dotenv

0 commit comments

Comments
 (0)