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

ES6 syntax (#2213)

parent 07c75aa5
Showing with 15 additions and 20 deletions
+15 -20
......@@ -10,16 +10,16 @@
'use strict';
var spawn = require('cross-spawn');
var script = process.argv[2];
var args = process.argv.slice(3);
const spawn = require('cross-spawn');
const script = process.argv[2];
const args = process.argv.slice(3);
switch (script) {
case 'build':
case 'eject':
case 'start':
case 'test':
var result = spawn.sync(
case 'test': {
const result = spawn.sync(
'node',
[require.resolve('../scripts/' + script)].concat(args),
{ stdio: 'inherit' }
......@@ -42,6 +42,7 @@ switch (script) {
}
process.exit(result.status);
break;
}
default:
console.log('Unknown script "' + script + '".');
console.log('Perhaps you need to update react-scripts?');
......
......@@ -10,10 +10,10 @@
// @remove-on-eject-end
'use strict';
var fs = require('fs');
var paths = require('./paths');
const fs = require('fs');
const paths = require('./paths');
var NODE_ENV = process.env.NODE_ENV;
const NODE_ENV = process.env.NODE_ENV;
if (!NODE_ENV) {
throw new Error(
'The NODE_ENV environment variable is required but was not specified.'
......@@ -22,9 +22,9 @@ if (!NODE_ENV) {
// https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use
var dotenvFiles = [
paths.dotenv + '.' + NODE_ENV + '.local',
paths.dotenv + '.' + NODE_ENV,
paths.dotenv + '.local',
`${paths.dotenv}.${NODE_ENV}.local`,
`${paths.dotenv}.${NODE_ENV}`,
`${paths.dotenv}.local`,
paths.dotenv,
];
// Load environment variables from .env* files. Suppress warnings using silent
......
......@@ -17,9 +17,7 @@ const url = require('url');
// Make sure any symlinks in the project folder are resolved:
// https://github.com/facebookincubator/create-react-app/issues/637
const appDirectory = fs.realpathSync(process.cwd());
function resolveApp(relativePath) {
return path.resolve(appDirectory, relativePath);
}
const resolveApp = (relativePath) => path.resolve(appDirectory, relativePath);
// We support resolving modules according to `NODE_PATH`.
// This lets you use absolute paths in imports inside large monorepos:
......@@ -55,9 +53,7 @@ function ensureSlash(path, needsSlash) {
}
}
function getPublicUrl(appPackageJson) {
return envPublicUrl || require(appPackageJson).homepage;
}
const getPublicUrl = (appPackageJson) => envPublicUrl || require(appPackageJson).homepage;
// We use `PUBLIC_URL` environment variable or "homepage" field to infer
// "public path" at which the app is served.
......@@ -90,9 +86,7 @@ module.exports = {
};
// @remove-on-eject-begin
function resolveOwn(relativePath) {
return path.resolve(__dirname, '..', relativePath);
}
const resolveOwn = (relativePath) => path.resolve(__dirname, '..', relativePath);
// config before eject: we're in ./node_modules/react-scripts/config/
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