Skip to content

Commit 3fdbabf

Browse files
authored
Merge branch 'master' into master
2 parents bcb9477 + 88dfd49 commit 3fdbabf

File tree

16 files changed

+285
-230
lines changed

16 files changed

+285
-230
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,12 @@ Some of the more popular and actively maintained ones are:
239239
* [NYTimes/kyt](https://github.com/NYTimes/kyt)
240240
* [zeit/next.js](https://github.com/zeit/next.js)
241241
* [gatsbyjs/gatsby](https://github.com/gatsbyjs/gatsby)
242+
* [electrode-io/electrode](https://github.com/electrode-io/electrode)
242243

243244
Notable alternatives also include:
244245

245246
* [enclave](https://github.com/eanplatter/enclave)
246-
* [motion](https://github.com/motion/motion)
247+
* [motion](https://github.com/steelbrain/pundle/tree/master/packages/motion)
247248
* [quik](https://github.com/satya164/quik)
248249
* [sagui](https://github.com/saguijs/sagui)
249250
* [roc](https://github.com/rocjs/roc)

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

+1-4
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,7 @@ if (env === 'test') {
129129

130130
if (env === 'production') {
131131
// Optimization: hoist JSX that never changes out of render()
132-
// Disabled because of issues:
133-
// * https://github.com/facebookincubator/create-react-app/issues/525
134-
// * https://phabricator.babeljs.io/search/query/pCNlnC2xzwzx/
135-
// * https://github.com/babel/babel/issues/4516
132+
// Disabled because of issues: https://github.com/facebookincubator/create-react-app/issues/553
136133
// TODO: Enable again when these issues are resolved.
137134
// plugins.push.apply(plugins, [
138135
// require.resolve('babel-plugin-transform-react-constant-elements')

packages/create-react-app/createReactApp.js

+25-8
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,7 @@ function createApp(name, verbose, version, template) {
143143

144144
checkAppName(appName);
145145
fs.ensureDirSync(name);
146-
if (!isSafeToCreateProjectIn(root)) {
147-
console.log(
148-
`The directory ${chalk.green(name)} contains files that could conflict.`
149-
);
150-
console.log('Try using a new directory name.');
146+
if (!isSafeToCreateProjectIn(root, name)) {
151147
process.exit(1);
152148
}
153149

@@ -445,7 +441,7 @@ function getPackageName(installPackage) {
445441
// git+https://github.com/mycompany/react-scripts.git
446442
// git+ssh://github.com/mycompany/react-scripts.git#v1.2.3
447443
return Promise.resolve(installPackage.match(/([^\/]+)\.git(#.*)?$/)[1]);
448-
} else if (installPackage.indexOf('@') > 0) {
444+
} else if (installPackage.match(/.+@/)) {
449445
// Do not match @scope/ when stripping off @version or @tag
450446
return Promise.resolve(
451447
installPackage.charAt(0) + installPackage.substr(1).split('@')[0]
@@ -571,7 +567,7 @@ function setCaretRangeForRuntimeDeps(packageName) {
571567
// If project only contains files generated by GH, it’s safe.
572568
// We also special case IJ-based products .idea because it integrates with CRA:
573569
// https://github.com/facebookincubator/create-react-app/pull/368#issuecomment-243446094
574-
function isSafeToCreateProjectIn(root) {
570+
function isSafeToCreateProjectIn(root, name) {
575571
const validFiles = [
576572
'.DS_Store',
577573
'Thumbs.db',
@@ -585,7 +581,28 @@ function isSafeToCreateProjectIn(root) {
585581
'.hgignore',
586582
'.hgcheck',
587583
];
588-
return fs.readdirSync(root).every(file => validFiles.indexOf(file) >= 0);
584+
console.log();
585+
586+
const conflicts = fs
587+
.readdirSync(root)
588+
.filter(file => !validFiles.includes(file));
589+
if (conflicts.length < 1) {
590+
return true;
591+
}
592+
593+
console.log(
594+
`The directory ${chalk.green(name)} contains files that could conflict:`
595+
);
596+
console.log();
597+
for (const file of conflicts) {
598+
console.log(` ${file}`);
599+
}
600+
console.log();
601+
console.log(
602+
'Either try using a new directory name, or remove the files listed above.'
603+
);
604+
605+
return false;
589606
}
590607

591608
function checkIfOnline(useYarn) {

packages/eslint-config-react-app/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
],
1313
"peerDependencies": {
1414
"babel-eslint": "^7.2.3",
15-
"eslint": "^3.19.0",
15+
"eslint": "^4.1.1",
1616
"eslint-plugin-flowtype": "^2.34.1",
1717
"eslint-plugin-import": "^2.2.0",
1818
"eslint-plugin-jsx-a11y": "^5.0.3",

packages/react-dev-utils/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ Returns an object with local and remote URLs for the development server. Pass th
295295

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

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

300300
```js
301301
// Webpack development config

packages/react-dev-utils/ansiHTML.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
'use strict';
1111

1212
var Anser = require('anser');
13+
var Entities = require('html-entities').AllHtmlEntities;
14+
var entities = new Entities();
1315

1416
// Color scheme inspired by https://chriskempson.github.io/base16/css/base16-github.css
1517
// var base00 = 'ffffff'; // Default Background
@@ -61,7 +63,7 @@ var anserMap = {
6163
};
6264

6365
function ansiHTML(txt) {
64-
var arr = new Anser().ansiToJson(txt, {
66+
var arr = new Anser().ansiToJson(entities.encode(txt), {
6567
use_classes: true,
6668
});
6769

packages/react-dev-utils/launchEditor.js

+41-7
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,22 @@ const COMMON_EDITORS_OSX = {
3838
'/Applications/Sublime Text 2.app/Contents/MacOS/Sublime Text 2':
3939
'/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl',
4040
'/Applications/Visual Studio Code.app/Contents/MacOS/Electron': 'code',
41+
'/Applications/AppCode.app/Contents/MacOS/appcode':
42+
'/Applications/AppCode.app/Contents/MacOS/appcode',
43+
'/Applications/CLion.app/Contents/MacOS/clion':
44+
'/Applications/CLion.app/Contents/MacOS/clion',
45+
'/Applications/IntelliJ IDEA.app/Contents/MacOS/idea':
46+
'/Applications/IntelliJ IDEA.app/Contents/MacOS/idea',
47+
'/Applications/PhpStorm.app/Contents/MacOS/phpstorm':
48+
'/Applications/PhpStorm.app/Contents/MacOS/phpstorm',
49+
'/Applications/PyCharm.app/Contents/MacOS/pycharm':
50+
'/Applications/PyCharm.app/Contents/MacOS/pycharm',
51+
'/Applications/PyCharm CE.app/Contents/MacOS/pycharm':
52+
'/Applications/PyCharm CE.app/Contents/MacOS/pycharm',
53+
'/Applications/RubyMine.app/Contents/MacOS/rubymine':
54+
'/Applications/RubyMine.app/Contents/MacOS/rubymine',
55+
'/Applications/WebStorm.app/Contents/MacOS/webstorm':
56+
'/Applications/WebStorm.app/Contents/MacOS/webstorm',
4157
};
4258

4359
const COMMON_EDITORS_WIN = [
@@ -46,6 +62,18 @@ const COMMON_EDITORS_WIN = [
4662
'atom.exe',
4763
'sublime_text.exe',
4864
'notepad++.exe',
65+
'clion.exe',
66+
'clion64.exe',
67+
'idea.exe',
68+
'idea64.exe',
69+
'phpstorm.exe',
70+
'phpstorm64.exe',
71+
'pycharm.exe',
72+
'pycharm64.exe',
73+
'rubymine.exe',
74+
'rubymine64.exe',
75+
'webstorm.exe',
76+
'webstorm64.exe',
4977
];
5078

5179
function addWorkspaceToArgumentsIfExists(args, workspace) {
@@ -58,22 +86,19 @@ function addWorkspaceToArgumentsIfExists(args, workspace) {
5886
function getArgumentsForLineNumber(editor, fileName, lineNumber, workspace) {
5987
const editorBasename = path.basename(editor).replace(/\.(exe|cmd|bat)$/i, '');
6088
switch (editorBasename) {
61-
case 'vim':
62-
case 'mvim':
63-
return [fileName, '+' + lineNumber];
6489
case 'atom':
6590
case 'Atom':
6691
case 'Atom Beta':
6792
case 'subl':
6893
case 'sublime':
6994
case 'sublime_text':
7095
case 'wstorm':
71-
case 'appcode':
7296
case 'charm':
73-
case 'idea':
7497
return [fileName + ':' + lineNumber];
7598
case 'notepad++':
7699
return ['-n' + lineNumber, fileName];
100+
case 'vim':
101+
case 'mvim':
77102
case 'joe':
78103
case 'emacs':
79104
case 'emacsclient':
@@ -88,10 +113,19 @@ function getArgumentsForLineNumber(editor, fileName, lineNumber, workspace) {
88113
['-g', fileName + ':' + lineNumber],
89114
workspace
90115
);
91-
case 'webstorm':
92-
case 'webstorm64':
116+
case 'appcode':
117+
case 'clion':
118+
case 'clion64':
119+
case 'idea':
120+
case 'idea64':
93121
case 'phpstorm':
94122
case 'phpstorm64':
123+
case 'pycharm':
124+
case 'pycharm64':
125+
case 'rubymine':
126+
case 'rubymine64':
127+
case 'webstorm':
128+
case 'webstorm64':
95129
return addWorkspaceToArgumentsIfExists(
96130
['--line', lineNumber, fileName],
97131
workspace

packages/react-dev-utils/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"detect-port-alt": "1.1.3",
4242
"escape-string-regexp": "1.0.5",
4343
"filesize": "3.3.0",
44+
"global-modules": "1.0.0",
4445
"gzip-size": "3.0.0",
4546
"html-entities": "1.2.1",
4647
"inquirer": "3.1.1",

packages/react-dev-utils/printHostingInstructions.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
const chalk = require('chalk');
1313
const url = require('url');
14+
const globalModules = require('global-modules');
15+
const fs = require('fs');
1416

1517
function printHostingInstructions(
1618
appPackage,
@@ -121,10 +123,12 @@ function printHostingInstructions(
121123
);
122124
console.log('You may serve it with a static server:');
123125
console.log();
124-
if (useYarn) {
125-
console.log(` ${chalk.cyan('yarn')} global add serve`);
126-
} else {
127-
console.log(` ${chalk.cyan('npm')} install -g serve`);
126+
if (!fs.existsSync(`${globalModules}/serve`)) {
127+
if (useYarn) {
128+
console.log(` ${chalk.cyan('yarn')} global add serve`);
129+
} else {
130+
console.log(` ${chalk.cyan('npm')} install -g serve`);
131+
}
128132
}
129133
console.log(` ${chalk.cyan('serve')} -s ${buildFolder}`);
130134
console.log();

packages/react-dev-utils/webpackHotDevClient.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ var SockJS = require('sockjs-client');
2222
var stripAnsi = require('strip-ansi');
2323
var url = require('url');
2424
var formatWebpackMessages = require('./formatWebpackMessages');
25-
var Entities = require('html-entities').AllHtmlEntities;
2625
var ansiHTML = require('./ansiHTML');
27-
var entities = new Entities();
2826

2927
function createOverlayIframe(onIframeLoad) {
3028
var iframe = document.createElement('iframe');
@@ -138,7 +136,7 @@ function showErrorOverlay(message) {
138136
'margin-bottom: 0.5em; overflow-x: auto; white-space: pre-wrap; ' +
139137
'border-radius: 0.25rem; background-color: rgba(206, 17, 38, 0.05)">' +
140138
'<code style="font-family: Consolas, Menlo, monospace;">' +
141-
ansiHTML(entities.encode(message)) +
139+
ansiHTML(message) +
142140
'</code></pre>' +
143141
'<div style="' +
144142
'font-family: sans-serif; color: rgb(135, 142, 145); margin-top: 0.5rem; ' +

packages/react-scripts/bin/react-scripts.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ switch (script) {
2121
case 'test': {
2222
const result = spawn.sync(
2323
'node',
24-
[require.resolve('../scripts/' + script)].concat(args),
24+
[require.resolve(`../scripts/${script}`)].concat(args),
2525
{ stdio: 'inherit' }
2626
);
2727
if (result.signal) {

0 commit comments

Comments
 (0)