Commit 5f93bc4d authored by Danil Shashkov's avatar Danil Shashkov Committed by Dan Abramov
Browse files

ES6 syntax (#2213)

parent 07c75aa5
3 merge requests!12191Lim.Pisey.168:/Identified - We are currently investigating reports of missing build logs. The issue has been identified and a resolution is in progress. We will provide a further update when available.Mar 21, 09:02 UTC,!12853brikk,!5717Automatically extract project file structure from build bundle file
Showing with 15 additions and 20 deletions
+15 -20
...@@ -10,16 +10,16 @@ ...@@ -10,16 +10,16 @@
'use strict'; 'use strict';
var spawn = require('cross-spawn'); const spawn = require('cross-spawn');
var script = process.argv[2]; const script = process.argv[2];
var args = process.argv.slice(3); const args = process.argv.slice(3);
switch (script) { switch (script) {
case 'build': case 'build':
case 'eject': case 'eject':
case 'start': case 'start':
case 'test': case 'test': {
var result = spawn.sync( const result = spawn.sync(
'node', 'node',
[require.resolve('../scripts/' + script)].concat(args), [require.resolve('../scripts/' + script)].concat(args),
{ stdio: 'inherit' } { stdio: 'inherit' }
...@@ -42,6 +42,7 @@ switch (script) { ...@@ -42,6 +42,7 @@ switch (script) {
} }
process.exit(result.status); process.exit(result.status);
break; break;
}
default: default:
console.log('Unknown script "' + script + '".'); console.log('Unknown script "' + script + '".');
console.log('Perhaps you need to update react-scripts?'); console.log('Perhaps you need to update react-scripts?');
......
...@@ -10,10 +10,10 @@ ...@@ -10,10 +10,10 @@
// @remove-on-eject-end // @remove-on-eject-end
'use strict'; 'use strict';
var fs = require('fs'); const fs = require('fs');
var paths = require('./paths'); const paths = require('./paths');
var NODE_ENV = process.env.NODE_ENV; const NODE_ENV = process.env.NODE_ENV;
if (!NODE_ENV) { if (!NODE_ENV) {
throw new Error( throw new Error(
'The NODE_ENV environment variable is required but was not specified.' 'The NODE_ENV environment variable is required but was not specified.'
...@@ -22,9 +22,9 @@ if (!NODE_ENV) { ...@@ -22,9 +22,9 @@ if (!NODE_ENV) {
// https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use // https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use
var dotenvFiles = [ var dotenvFiles = [
paths.dotenv + '.' + NODE_ENV + '.local', `${paths.dotenv}.${NODE_ENV}.local`,
paths.dotenv + '.' + NODE_ENV, `${paths.dotenv}.${NODE_ENV}`,
paths.dotenv + '.local', `${paths.dotenv}.local`,
paths.dotenv, paths.dotenv,
]; ];
// Load environment variables from .env* files. Suppress warnings using silent // Load environment variables from .env* files. Suppress warnings using silent
......
...@@ -17,9 +17,7 @@ const url = require('url'); ...@@ -17,9 +17,7 @@ const url = require('url');
// Make sure any symlinks in the project folder are resolved: // Make sure any symlinks in the project folder are resolved:
// https://github.com/facebookincubator/create-react-app/issues/637 // https://github.com/facebookincubator/create-react-app/issues/637
const appDirectory = fs.realpathSync(process.cwd()); const appDirectory = fs.realpathSync(process.cwd());
function resolveApp(relativePath) { const resolveApp = (relativePath) => path.resolve(appDirectory, relativePath);
return path.resolve(appDirectory, relativePath);
}
// We support resolving modules according to `NODE_PATH`. // We support resolving modules according to `NODE_PATH`.
// This lets you use absolute paths in imports inside large monorepos: // This lets you use absolute paths in imports inside large monorepos:
...@@ -55,9 +53,7 @@ function ensureSlash(path, needsSlash) { ...@@ -55,9 +53,7 @@ function ensureSlash(path, needsSlash) {
} }
} }
function getPublicUrl(appPackageJson) { const getPublicUrl = (appPackageJson) => envPublicUrl || require(appPackageJson).homepage;
return envPublicUrl || require(appPackageJson).homepage;
}
// We use `PUBLIC_URL` environment variable or "homepage" field to infer // We use `PUBLIC_URL` environment variable or "homepage" field to infer
// "public path" at which the app is served. // "public path" at which the app is served.
...@@ -90,9 +86,7 @@ module.exports = { ...@@ -90,9 +86,7 @@ module.exports = {
}; };
// @remove-on-eject-begin // @remove-on-eject-begin
function resolveOwn(relativePath) { const resolveOwn = (relativePath) => path.resolve(__dirname, '..', relativePath);
return path.resolve(__dirname, '..', relativePath);
}
// config before eject: we're in ./node_modules/react-scripts/config/ // config before eject: we're in ./node_modules/react-scripts/config/
module.exports = { module.exports = {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment