Skip to content

Commit 07623e2

Browse files
SimenBfson
authored andcommitted
Use pre node@4 compatible path-exists (facebook#685)
* Revert "Add ES5 version of `path-exists` to CLI" This reverts commit fc3ab46. * Use pre node@4 compatible `path-exists` Ref facebook#617
1 parent c217ea5 commit 07623e2

File tree

3 files changed

+4
-15
lines changed

3 files changed

+4
-15
lines changed

packages/create-react-app/index.js

+2-14
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ var spawn = require('cross-spawn');
4444
var chalk = require('chalk');
4545
var semver = require('semver');
4646
var argv = require('minimist')(process.argv.slice(2));
47+
var pathExists = require('path-exists');
4748

4849
/**
4950
* Arguments:
@@ -75,7 +76,7 @@ function createApp(name, verbose, version) {
7576

7677
checkAppName(appName);
7778

78-
if (!pathExistsSync(name)) {
79+
if (!pathExists.sync(name)) {
7980
fs.mkdirSync(root);
8081
} else if (!isSafeToCreateProjectIn(root)) {
8182
console.log('The directory `' + name + '` contains file(s) that could conflict. Aborting.');
@@ -219,16 +220,3 @@ function isSafeToCreateProjectIn(root) {
219220
return validFiles.indexOf(file) >= 0;
220221
});
221222
}
222-
223-
// This is an ES5 version of https://github.com/sindresorhus/path-exists.
224-
// The reason it exists is so that the CLI doesn't break before being able to
225-
// warn the user they're using an unsupported version of Node.
226-
// See https://github.com/facebookincubator/create-react-app/issues/570
227-
function pathExistsSync(fp) {
228-
try {
229-
fs.accessSync(fp);
230-
return true;
231-
} catch (err) {
232-
return false;
233-
}
234-
}

packages/create-react-app/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"chalk": "^1.1.1",
2424
"cross-spawn": "^4.0.0",
2525
"minimist": "^1.2.0",
26+
"path-exists": "^2.1.0",
2627
"semver": "^5.0.3"
2728
}
2829
}

packages/react-scripts/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"json-loader": "0.5.4",
5959
"object-assign": "4.1.0",
6060
"opn": "4.0.2",
61-
"path-exists": "3.0.0",
61+
"path-exists": "2.1.0",
6262
"postcss-loader": "0.13.0",
6363
"promise": "7.1.1",
6464
"recursive-readdir": "2.0.0",

0 commit comments

Comments
 (0)