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
fc3ab46d
Commit
fc3ab46d
authored
8 years ago
by
Juan Soto
Committed by
Dan Abramov
8 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Add ES5 version of `path-exists` to CLI
parent
e333b8b8
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
global-cli/index.js
+14
-2
global-cli/index.js
global-cli/package.json
+0
-1
global-cli/package.json
with
14 additions
and
3 deletions
+14
-3
global-cli/index.js
+
14
-
2
View file @
fc3ab46d
...
...
@@ -41,7 +41,6 @@ var spawn = require('cross-spawn');
var
chalk
=
require
(
'
chalk
'
);
var
semver
=
require
(
'
semver
'
);
var
argv
=
require
(
'
minimist
'
)(
process
.
argv
.
slice
(
2
));
var
pathExists
=
require
(
'
path-exists
'
);
/**
* Arguments:
...
...
@@ -73,7 +72,7 @@ function createApp(name, verbose, version) {
checkAppName
(
appName
);
if
(
!
pathExists
.
s
ync
(
name
))
{
if
(
!
pathExists
S
ync
(
name
))
{
fs
.
mkdirSync
(
root
);
}
else
if
(
!
isSafeToCreateProjectIn
(
root
))
{
console
.
log
(
'
The directory `
'
+
name
+
'
` contains file(s) that could conflict. Aborting.
'
);
...
...
@@ -205,3 +204,16 @@ function isSafeToCreateProjectIn(root) {
return
validFiles
.
indexOf
(
file
)
>=
0
;
});
}
// This is an ES5 version of https://github.com/sindresorhus/path-exists.
// The reason it exists is so that the CLI doesn't break before being able to
// warn the user they're using an unsupported version of Node.
// See https://github.com/facebookincubator/create-react-app/issues/570
function
pathExistsSync
(
fp
)
{
try
{
fs
.
accessSync
(
fp
);
return
true
;
}
catch
(
err
)
{
return
false
;
}
}
This diff is collapsed.
Click to expand it.
global-cli/package.json
+
0
-
1
View file @
fc3ab46d
...
...
@@ -23,7 +23,6 @@
"chalk"
:
"^1.1.1"
,
"cross-spawn"
:
"^4.0.0"
,
"minimist"
:
"^1.2.0"
,
"path-exists"
:
"^3.0.0"
,
"semver"
:
"^5.0.3"
}
}
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