Skip to content

Commit 01b65b5

Browse files
committed
Merge branch 'facebook-next' into next
2 parents b6442bd + 71b7766 commit 01b65b5

File tree

25 files changed

+794
-658
lines changed

25 files changed

+794
-658
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ cache:
99
directories:
1010
- .npm
1111
before_install:
12-
- curl -o- -L https://yarnpkg.com/install.sh | bash
12+
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --nightly
1313
- export PATH="$HOME/.yarn/bin:$PATH"
1414
install: true
1515
script:

CHANGELOG.md

Lines changed: 625 additions & 575 deletions
Large diffs are not rendered by default.

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ platform:
3737
install:
3838
- ps: Install-Product node $env:nodejs_version $env:platform
3939
- ps: |
40-
(New-Object Net.WebClient).DownloadFile("https://yarnpkg.com/latest.msi", "$env:temp\yarn.msi")
40+
(New-Object Net.WebClient).DownloadFile("https://nightly.yarnpkg.com/latest.msi", "$env:temp\yarn.msi")
4141
cmd /c start /wait msiexec.exe /i $env:temp\yarn.msi /quiet /qn /norestart
4242
4343
build: off

packages/babel-plugin-named-asset-import/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "babel-plugin-named-asset-import",
3-
"version": "0.2.0",
3+
"version": "0.2.1",
44
"description": "Babel plugin for named asset imports in Create React App",
55
"repository": "facebookincubator/create-react-app",
66
"license": "MIT",

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": "5.0.0",
3+
"version": "5.0.1",
44
"description": "Babel preset used by Create React App",
55
"repository": "facebook/create-react-app",
66
"license": "MIT",

packages/confusing-browser-globals/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "confusing-browser-globals",
3-
"version": "1.0.1",
3+
"version": "1.0.2",
44
"description": "A list of browser globals that are often used by mistake instead of local variables",
55
"license": "MIT",
66
"main": "index.js",

packages/create-react-app/createReactApp.js

Lines changed: 73 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ const program = new commander.Command(packageJson.name)
7676
'use a non-standard version of react-scripts'
7777
)
7878
.option('--use-npm')
79+
.option('--use-pnp')
7980
.allowUnknownOption()
8081
.on('--help', () => {
8182
console.log(` Only ${chalk.green('<project-directory>')} is required.`);
@@ -178,10 +179,11 @@ createApp(
178179
program.verbose,
179180
program.scriptsVersion,
180181
program.useNpm,
182+
program.usePnp,
181183
hiddenProgram.internalTestingTemplate
182184
);
183185

184-
function createApp(name, verbose, version, useNpm, template) {
186+
function createApp(name, verbose, version, useNpm, usePnp, template) {
185187
const root = path.resolve(name);
186188
const appName = path.basename(root);
187189

@@ -241,7 +243,16 @@ function createApp(name, verbose, version, useNpm, template) {
241243
version = 'react-scripts@0.9.x';
242244
}
243245
}
244-
run(root, appName, version, verbose, originalDirectory, template, useYarn);
246+
run(
247+
root,
248+
appName,
249+
version,
250+
verbose,
251+
originalDirectory,
252+
template,
253+
useYarn,
254+
usePnp
255+
);
245256
}
246257

247258
function shouldUseYarn() {
@@ -253,7 +264,7 @@ function shouldUseYarn() {
253264
}
254265
}
255266

256-
function install(root, useYarn, dependencies, verbose, isOnline) {
267+
function install(root, useYarn, usePnp, dependencies, verbose, isOnline) {
257268
return new Promise((resolve, reject) => {
258269
let command;
259270
let args;
@@ -263,6 +274,9 @@ function install(root, useYarn, dependencies, verbose, isOnline) {
263274
if (!isOnline) {
264275
args.push('--offline');
265276
}
277+
if (usePnp) {
278+
args.push('--enable-pnp');
279+
}
266280
[].push.apply(args, dependencies);
267281

268282
// Explicitly set cwd() to work around issues like
@@ -287,6 +301,12 @@ function install(root, useYarn, dependencies, verbose, isOnline) {
287301
'--loglevel',
288302
'error',
289303
].concat(dependencies);
304+
305+
if (usePnp) {
306+
console.log(chalk.yellow("NPM doesn't support PnP."));
307+
console.log(chalk.yellow('Falling back to the regular installs.'));
308+
console.log();
309+
}
290310
}
291311

292312
if (verbose) {
@@ -313,7 +333,8 @@ function run(
313333
verbose,
314334
originalDirectory,
315335
template,
316-
useYarn
336+
useYarn,
337+
usePnp
317338
) {
318339
const packageToInstall = getInstallPackage(version, originalDirectory);
319340
const allDependencies = ['react', 'react-dom', packageToInstall];
@@ -336,23 +357,34 @@ function run(
336357
);
337358
console.log();
338359

339-
return install(root, useYarn, allDependencies, verbose, isOnline).then(
340-
() => packageName
341-
);
360+
return install(
361+
root,
362+
useYarn,
363+
usePnp,
364+
allDependencies,
365+
verbose,
366+
isOnline
367+
).then(() => packageName);
342368
})
343-
.then(packageName => {
369+
.then(async packageName => {
344370
checkNodeVersion(packageName);
345371
setCaretRangeForRuntimeDeps(packageName);
346372

347-
const scriptsPath = path.resolve(
348-
process.cwd(),
349-
'node_modules',
350-
packageName,
351-
'scripts',
352-
'init.js'
373+
const pnpPath = path.resolve(process.cwd(), '.pnp.js');
374+
375+
const nodeArgs = fs.existsSync(pnpPath) ? ['--require', pnpPath] : [];
376+
377+
await executeNodeScript(
378+
{
379+
cwd: process.cwd(),
380+
args: nodeArgs,
381+
},
382+
[root, appName, verbose, originalDirectory, template],
383+
`
384+
var init = require('${packageName}/scripts/init.js');
385+
init.apply(null, JSON.parse(process.argv[1]));
386+
`
353387
);
354-
const init = require(scriptsPath);
355-
init(root, appName, verbose, originalDirectory, template);
356388

357389
if (version === 'react-scripts@0.9.x') {
358390
console.log(
@@ -540,6 +572,11 @@ function checkNodeVersion(packageName) {
540572
packageName,
541573
'package.json'
542574
);
575+
576+
if (!fs.existsSync(packageJsonPath)) {
577+
return;
578+
}
579+
543580
const packageJson = require(packageJsonPath);
544581
if (!packageJson.engines || !packageJson.engines.node) {
545582
return;
@@ -794,3 +831,23 @@ function checkIfOnline(useYarn) {
794831
});
795832
});
796833
}
834+
835+
function executeNodeScript({ cwd, args }, data, source) {
836+
return new Promise((resolve, reject) => {
837+
const child = spawn(
838+
process.execPath,
839+
[...args, '-e', source, '--', JSON.stringify(data)],
840+
{ cwd, stdio: 'inherit' }
841+
);
842+
843+
child.on('close', code => {
844+
if (code !== 0) {
845+
reject({
846+
command: `node ${args.join(' ')}`,
847+
});
848+
return;
849+
}
850+
resolve();
851+
});
852+
});
853+
}

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": "2.0.0",
3+
"version": "2.0.1",
44
"keywords": [
55
"react"
66
],

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,10 @@ module.exports = {
199199
'react/jsx-uses-react': 'warn',
200200
'react/jsx-uses-vars': 'warn',
201201
'react/no-danger-with-children': 'warn',
202-
'react/no-deprecated': 'warn',
202+
// Disabled because of undesirable warnings
203+
// See https://github.com/facebook/create-react-app/issues/5204 for
204+
// blockers until its re-enabled
205+
// 'react/no-deprecated': 'warn',
203206
'react/no-direct-mutation-state': 'warn',
204207
'react/no-is-mounted': 'warn',
205208
'react/react-in-jsx-scope': 'error',

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eslint-config-react-app",
3-
"version": "3.0.0",
3+
"version": "3.0.2",
44
"description": "ESLint configuration used by Create React App",
55
"repository": "facebook/create-react-app",
66
"license": "MIT",
@@ -19,6 +19,6 @@
1919
"eslint-plugin-react": "7.x"
2020
},
2121
"dependencies": {
22-
"confusing-browser-globals": "^1.0.1"
22+
"confusing-browser-globals": "^1.0.2"
2323
}
2424
}

0 commit comments

Comments
 (0)