Commit 07623e2f authored by Simen Bekkhus's avatar Simen Bekkhus Committed by Ville Immonen
Browse files

Use pre node@4 compatible `path-exists` (#685)

* Revert "Add ES5 version of `path-exists` to CLI"

This reverts commit fc3ab46d.

* Use pre node@4 compatible `path-exists`

Ref #617
parent c217ea5a
No related merge requests found
Showing with 4 additions and 15 deletions
+4 -15
...@@ -44,6 +44,7 @@ var spawn = require('cross-spawn'); ...@@ -44,6 +44,7 @@ var spawn = require('cross-spawn');
var chalk = require('chalk'); var chalk = require('chalk');
var semver = require('semver'); var semver = require('semver');
var argv = require('minimist')(process.argv.slice(2)); var argv = require('minimist')(process.argv.slice(2));
var pathExists = require('path-exists');
/** /**
* Arguments: * Arguments:
...@@ -75,7 +76,7 @@ function createApp(name, verbose, version) { ...@@ -75,7 +76,7 @@ function createApp(name, verbose, version) {
checkAppName(appName); checkAppName(appName);
if (!pathExistsSync(name)) { if (!pathExists.sync(name)) {
fs.mkdirSync(root); fs.mkdirSync(root);
} else if (!isSafeToCreateProjectIn(root)) { } else if (!isSafeToCreateProjectIn(root)) {
console.log('The directory `' + name + '` contains file(s) that could conflict. Aborting.'); console.log('The directory `' + name + '` contains file(s) that could conflict. Aborting.');
...@@ -219,16 +220,3 @@ function isSafeToCreateProjectIn(root) { ...@@ -219,16 +220,3 @@ function isSafeToCreateProjectIn(root) {
return validFiles.indexOf(file) >= 0; 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;
}
}
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
"chalk": "^1.1.1", "chalk": "^1.1.1",
"cross-spawn": "^4.0.0", "cross-spawn": "^4.0.0",
"minimist": "^1.2.0", "minimist": "^1.2.0",
"path-exists": "^2.1.0",
"semver": "^5.0.3" "semver": "^5.0.3"
} }
} }
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
"json-loader": "0.5.4", "json-loader": "0.5.4",
"object-assign": "4.1.0", "object-assign": "4.1.0",
"opn": "4.0.2", "opn": "4.0.2",
"path-exists": "3.0.0", "path-exists": "2.1.0",
"postcss-loader": "0.13.0", "postcss-loader": "0.13.0",
"promise": "7.1.1", "promise": "7.1.1",
"recursive-readdir": "2.0.0", "recursive-readdir": "2.0.0",
......
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