Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Meta
create-react-app
Commits
5f93bc4d
Commit
5f93bc4d
authored
7 years ago
by
Danil Shashkov
Committed by
Dan Abramov
7 years ago
Browse files
Options
Download
Email Patches
Plain Diff
ES6 syntax (#2213)
parent
07c75aa5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
packages/react-scripts/bin/react-scripts.js
+6
-5
packages/react-scripts/bin/react-scripts.js
packages/react-scripts/config/env.js
+6
-6
packages/react-scripts/config/env.js
packages/react-scripts/config/paths.js
+3
-9
packages/react-scripts/config/paths.js
with
15 additions
and
20 deletions
+15
-20
packages/react-scripts/bin/react-scripts.js
+
6
-
5
View file @
5f93bc4d
...
...
@@ -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?
'
);
...
...
This diff is collapsed.
Click to expand it.
packages/react-scripts/config/env.js
+
6
-
6
View file @
5f93bc4d
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
packages/react-scripts/config/paths.js
+
3
-
9
View file @
5f93bc4d
...
...
@@ -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
=
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets